summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gentoo.org>2020-12-20 17:12:42 -0500
committerMatt Turner <mattst88@gentoo.org>2020-12-20 17:12:42 -0500
commit9601ad3b1b1e44c08f0eb35189cde05dd3a5e58d (patch)
treeef2549b13312dfbe2dea15199b3840cc1e54a2ae
parentRemove $Header$ (diff)
downloadgentoolkit-9601ad3b1b1e44c08f0eb35189cde05dd3a5e58d.tar.gz
gentoolkit-9601ad3b1b1e44c08f0eb35189cde05dd3a5e58d.tar.bz2
gentoolkit-9601ad3b1b1e44c08f0eb35189cde05dd3a5e58d.zip
Remove Python < 3 version checks
Signed-off-by: Matt Turner <mattst88@gentoo.org>
-rw-r--r--pym/gentoolkit/eclean/exclude.py2
-rw-r--r--pym/gentoolkit/enalyze/rebuild.py2
-rw-r--r--pym/gentoolkit/equery/uses.py2
-rw-r--r--pym/gentoolkit/equery/which.py2
-rw-r--r--pym/gentoolkit/helpers.py2
-rw-r--r--pym/gentoolkit/profile.py3
-rw-r--r--pym/gentoolkit/revdep_rebuild/analyse.py2
-rw-r--r--pym/gentoolkit/revdep_rebuild/assign.py6
-rw-r--r--pym/gentoolkit/revdep_rebuild/cache.py7
-rw-r--r--pym/gentoolkit/revdep_rebuild/collect.py10
-rw-r--r--pym/gentoolkit/revdep_rebuild/settings.py9
-rw-r--r--pym/gentoolkit/test/eclean/creator.py2
-rw-r--r--pym/gentoolkit/test/test_keyword.py2
13 files changed, 3 insertions, 48 deletions
diff --git a/pym/gentoolkit/eclean/exclude.py b/pym/gentoolkit/eclean/exclude.py
index ee5e1e1..45ecd52 100644
--- a/pym/gentoolkit/eclean/exclude.py
+++ b/pym/gentoolkit/eclean/exclude.py
@@ -6,8 +6,6 @@
import os
import sys
-if sys.hexversion < 0x3000000:
- from io import open
import re
import portage
from portage import _encodings, _unicode_encode
diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py
index 4ad571f..3f3f4fd 100644
--- a/pym/gentoolkit/enalyze/rebuild.py
+++ b/pym/gentoolkit/enalyze/rebuild.py
@@ -12,8 +12,6 @@ what packages according to the Installed package database"""
import os
import sys
-if sys.hexversion < 0x3000000:
- from io import open
import gentoolkit
from gentoolkit.module_base import ModuleBase
diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py
index 1260f56..dfb6f31 100644
--- a/pym/gentoolkit/equery/uses.py
+++ b/pym/gentoolkit/equery/uses.py
@@ -12,8 +12,6 @@ __docformat__ = 'epytext'
import os
import sys
-if sys.hexversion < 0x3000000:
- from io import open
from functools import partial
from getopt import gnu_getopt, GetoptError
diff --git a/pym/gentoolkit/equery/which.py b/pym/gentoolkit/equery/which.py
index 326e692..c7fabd7 100644
--- a/pym/gentoolkit/equery/which.py
+++ b/pym/gentoolkit/equery/which.py
@@ -14,8 +14,6 @@ __docformat__ = 'epytext'
import os
import sys
-if sys.hexversion < 0x3000000:
- from io import open
from getopt import gnu_getopt, GetoptError
diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py
index b4cc795..02ac20e 100644
--- a/pym/gentoolkit/helpers.py
+++ b/pym/gentoolkit/helpers.py
@@ -25,8 +25,6 @@ __docformat__ = 'epytext'
import os
import sys
-if sys.hexversion < 0x3000000:
- from io import open
import re
from functools import partial
from itertools import chain
diff --git a/pym/gentoolkit/profile.py b/pym/gentoolkit/profile.py
index 01f823a..dcd02cc 100644
--- a/pym/gentoolkit/profile.py
+++ b/pym/gentoolkit/profile.py
@@ -15,9 +15,6 @@ import os.path
import portage
import sys
-if sys.hexversion < 0x3000000:
- from io import open
-
from portage import _encodings, _unicode_encode
diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py
index 4269ade..6ce1568 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -6,8 +6,6 @@ import os
import re
import time
import sys
-if sys.hexversion < 0x3000000:
- from io import open
from portage import _encodings, _unicode_encode
from portage.output import bold, blue, yellow, green
diff --git a/pym/gentoolkit/revdep_rebuild/assign.py b/pym/gentoolkit/revdep_rebuild/assign.py
index 1e5f3e9..3fa9299 100644
--- a/pym/gentoolkit/revdep_rebuild/assign.py
+++ b/pym/gentoolkit/revdep_rebuild/assign.py
@@ -15,12 +15,6 @@ import portage
from portage import portdb
from portage.output import bold, red, yellow, green
-# Make all str conversions unicode
-try:
- str = unicode
-except NameError:
- pass
-
class _file_matcher(object):
"""
diff --git a/pym/gentoolkit/revdep_rebuild/cache.py b/pym/gentoolkit/revdep_rebuild/cache.py
index 66fbd9d..f8b7841 100644
--- a/pym/gentoolkit/revdep_rebuild/cache.py
+++ b/pym/gentoolkit/revdep_rebuild/cache.py
@@ -6,11 +6,6 @@ Functions for reading, saving and verifying the data caches
from portage import os
import time
import sys
-if sys.hexversion < 0x3000000:
- from io import open
- _unicode = unicode # noqa
-else:
- _unicode = str
from portage import _encodings, _unicode_encode
from portage.output import red
@@ -59,7 +54,7 @@ def save_cache(logger, to_save={}, temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
try:
_file = open(_unicode_encode(os.path.join(temp_path, 'timestamp'),
encoding=_encodings['fs']), mode='w', encoding=_encodings['content'])
- _file.write(_unicode(int(time.time())))
+ _file.write(str(int(time.time())))
_file.close()
for key,val in to_save.items():
diff --git a/pym/gentoolkit/revdep_rebuild/collect.py b/pym/gentoolkit/revdep_rebuild/collect.py
index 9f7d301..74a44f7 100644
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@ -7,8 +7,6 @@ from portage import os
import glob
import stat
import sys
-if sys.hexversion < 0x3000000:
- from io import open
import portage
from portage import _encodings, _unicode_encode
@@ -16,12 +14,6 @@ from portage.output import blue, yellow
from .settings import parse_revdep_config
-if sys.hexversion < 0x3000000:
- _basestring = basestring # noqa
-else:
- _basestring = str
-
-
def parse_conf(conf_file, visited=None, logger=None):
''' Parses supplied conf_file for libraries pathes.
conf_file is file or files to parse
@@ -30,7 +22,7 @@ def parse_conf(conf_file, visited=None, logger=None):
lib_dirs = set()
to_parse = set()
- if isinstance(conf_file, _basestring):
+ if isinstance(conf_file, str):
conf_file = [conf_file]
for conf in conf_file:
diff --git a/pym/gentoolkit/revdep_rebuild/settings.py b/pym/gentoolkit/revdep_rebuild/settings.py
index efdb975..c8d77bc 100644
--- a/pym/gentoolkit/revdep_rebuild/settings.py
+++ b/pym/gentoolkit/revdep_rebuild/settings.py
@@ -5,20 +5,13 @@
import argparse
import os
import sys
-if sys.hexversion < 0x3000000:
- from io import open
import re
import glob
import portage
from portage import _encodings, _unicode_encode
-if sys.version_info[0] >= 3:
- _unicode = str
-else:
- _unicode = unicode # noqa
-
-portage_root = _unicode(portage.root)
+portage_root = str(portage.root)
DEFAULTS = {
'DEFAULT_LD_FILE': os.path.join(portage_root, 'etc/ld.so.conf'),
diff --git a/pym/gentoolkit/test/eclean/creator.py b/pym/gentoolkit/test/eclean/creator.py
index 4320e88..678c203 100644
--- a/pym/gentoolkit/test/eclean/creator.py
+++ b/pym/gentoolkit/test/eclean/creator.py
@@ -6,8 +6,6 @@
import os
import sys
-if sys.hexversion < 0x3000000:
- from io import open
import shutil
import random
diff --git a/pym/gentoolkit/test/test_keyword.py b/pym/gentoolkit/test/test_keyword.py
index 6a03859..99a79b5 100644
--- a/pym/gentoolkit/test/test_keyword.py
+++ b/pym/gentoolkit/test/test_keyword.py
@@ -37,8 +37,6 @@ class TestGentoolkitKeyword(unittest.TestCase):
'~amd64', '~ppc', '~x86', '~amd64-linux', '~x86-linux',
'~ppc-macos', '~x86-macos', '~x86-solaris'
]
- if sys.hexversion < 0x3000000:
- self.assertEqual(sorted(kwds_presort, cmp=compare_strs), kwds_postsort)
self.assertEqual(sorted(kwds_presort, key = keyword.Keyword), kwds_postsort)