public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Matt Turner <mattst88@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Matt Turner <mattst88@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH gentoolkit 3/4] Remove Python < 3 version checks
Date: Sun, 20 Dec 2020 17:10:38 -0500	[thread overview]
Message-ID: <20201220221039.286828-3-mattst88@gentoo.org> (raw)
In-Reply-To: <20201220221039.286828-1-mattst88@gentoo.org>

Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
 pym/gentoolkit/eclean/exclude.py          |  2 --
 pym/gentoolkit/enalyze/rebuild.py         |  2 --
 pym/gentoolkit/equery/uses.py             |  2 --
 pym/gentoolkit/equery/which.py            |  2 --
 pym/gentoolkit/helpers.py                 |  2 --
 pym/gentoolkit/profile.py                 |  3 ---
 pym/gentoolkit/revdep_rebuild/analyse.py  |  2 --
 pym/gentoolkit/revdep_rebuild/assign.py   |  6 ------
 pym/gentoolkit/revdep_rebuild/cache.py    |  7 +------
 pym/gentoolkit/revdep_rebuild/collect.py  | 10 +---------
 pym/gentoolkit/revdep_rebuild/settings.py |  9 +--------
 pym/gentoolkit/test/eclean/creator.py     |  2 --
 pym/gentoolkit/test/test_keyword.py       |  2 --
 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)
 
 
-- 
2.26.2



  parent reply	other threads:[~2020-12-20 22:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-20 22:10 [gentoo-portage-dev] [PATCH gentoolkit 1/4] Remove imports from __future__ Matt Turner
2020-12-20 22:10 ` [gentoo-portage-dev] [PATCH gentoolkit 2/4] Remove $Header$ Matt Turner
2020-12-20 22:10 ` Matt Turner [this message]
2020-12-20 22:10 ` [gentoo-portage-dev] [PATCH gentoolkit 4/4] Remove inherits from object Matt Turner
2020-12-21  1:58 ` [gentoo-portage-dev] [PATCH gentoolkit 1/4] Remove imports from __future__ Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201220221039.286828-3-mattst88@gentoo.org \
    --to=mattst88@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox