mirror of
https://git.centos.org/centos/centpkg.git
synced 2025-02-23 16:22:55 +00:00
Drop Python 2 compatibility
This commit is contained in:
parent
df70e4f1c9
commit
b66e8a61f5
6 changed files with 10 additions and 24 deletions
|
@ -2,7 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six.moves.configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
module_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
module_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -16,7 +16,7 @@ setup(
|
||||||
'python-gitlab',
|
'python-gitlab',
|
||||||
'pycurl',
|
'pycurl',
|
||||||
'rpkg>=1.65',
|
'rpkg>=1.65',
|
||||||
'six',
|
|
||||||
],
|
],
|
||||||
scripts=['src/bin/centpkg', 'src/bin/centpkg-sig'],
|
scripts=['src/bin/centpkg', 'src/bin/centpkg-sig'],
|
||||||
|
python_requires='>=3.6',
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import six.moves.configparser as ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
import pyrpkg
|
import pyrpkg
|
||||||
import pyrpkg.utils
|
import pyrpkg.utils
|
||||||
|
@ -54,7 +54,7 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Setup a configuration object and read config file data
|
# Setup a configuration object and read config file data
|
||||||
config = ConfigParser.SafeConfigParser()
|
config = ConfigParser()
|
||||||
config.read(args.config)
|
config.read(args.config)
|
||||||
config.read(args.user_config)
|
config.read(args.user_config)
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ from centpkg.utils import config_get_safely, do_add_remote, do_fork
|
||||||
import centpkg.utils
|
import centpkg.utils
|
||||||
from pyrpkg.cli import cliClient
|
from pyrpkg.cli import cliClient
|
||||||
from pyrpkg import rpkgError
|
from pyrpkg import rpkgError
|
||||||
from six.moves.urllib_parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import six.moves.configparser as ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
import gitlab
|
import gitlab
|
||||||
import json
|
import json
|
||||||
|
@ -147,7 +147,7 @@ class centpkgClient(cliClient):
|
||||||
internal_config_file = "/etc/rpkg/centpkg_internal.conf"
|
internal_config_file = "/etc/rpkg/centpkg_internal.conf"
|
||||||
if os.path.exists(internal_config_file):
|
if os.path.exists(internal_config_file):
|
||||||
# Get our internal only variables
|
# Get our internal only variables
|
||||||
cfg = ConfigParser.SafeConfigParser()
|
cfg = ConfigParser()
|
||||||
cfg.read(internal_config_file)
|
cfg.read(internal_config_file)
|
||||||
pp_api_url = config_get_safely(cfg, "centpkg.internal", 'pp_api_url')
|
pp_api_url = config_get_safely(cfg, "centpkg.internal", 'pp_api_url')
|
||||||
gitbz_query_url = config_get_safely(cfg, "centpkg.internal", 'gitbz_query_url')
|
gitbz_query_url = config_get_safely(cfg, "centpkg.internal", 'gitbz_query_url')
|
||||||
|
@ -242,7 +242,7 @@ class centpkgClient(cliClient):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Get our internal only variables
|
# Get our internal only variables
|
||||||
cfg = ConfigParser.SafeConfigParser()
|
cfg = ConfigParser()
|
||||||
cfg.read(internal_config_file)
|
cfg.read(internal_config_file)
|
||||||
pp_api_url = config_get_safely(cfg, "centpkg.internal", 'pp_api_url')
|
pp_api_url = config_get_safely(cfg, "centpkg.internal", 'pp_api_url')
|
||||||
gitbz_query_url = config_get_safely(cfg, "centpkg.internal", 'gitbz_query_url')
|
gitbz_query_url = config_get_safely(cfg, "centpkg.internal", 'gitbz_query_url')
|
||||||
|
|
|
@ -16,7 +16,6 @@ download path.
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import pycurl
|
import pycurl
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from pyrpkg.errors import InvalidHashType, UploadError, LayoutError
|
from pyrpkg.errors import InvalidHashType, UploadError, LayoutError
|
||||||
|
@ -257,12 +256,6 @@ class SIGLookasideCache(CGILookasideCache):
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1241059
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1241059
|
||||||
_name = utils.get_repo_name(name) if is_dist_git(os.getcwd()) else name
|
_name = utils.get_repo_name(name) if is_dist_git(os.getcwd()) else name
|
||||||
|
|
||||||
if six.PY2 and isinstance(filename, six.text_type):
|
|
||||||
filename = filename.encode('utf-8')
|
|
||||||
|
|
||||||
if six.PY2 and isinstance(self.branch, six.text_type):
|
|
||||||
self.branch = self.branch.encode('utf-8')
|
|
||||||
|
|
||||||
post_data = [('name', _name),
|
post_data = [('name', _name),
|
||||||
('%ssum' % self.hashtype, hash),
|
('%ssum' % self.hashtype, hash),
|
||||||
('filename', filename)]
|
('filename', filename)]
|
||||||
|
@ -328,13 +321,6 @@ class SIGLookasideCache(CGILookasideCache):
|
||||||
"""
|
"""
|
||||||
filename = os.path.basename(filepath)
|
filename = os.path.basename(filepath)
|
||||||
|
|
||||||
# As in remote_file_exists, we need to convert unicode strings to str
|
|
||||||
if six.PY2:
|
|
||||||
if isinstance(name, six.text_type):
|
|
||||||
name = name.encode('utf-8')
|
|
||||||
if isinstance(filepath, six.text_type):
|
|
||||||
filepath = filepath.encode('utf-8')
|
|
||||||
|
|
||||||
if self.remote_file_exists(name, filename, hash):
|
if self.remote_file_exists(name, filename, hash):
|
||||||
self.log.info("File already uploaded: %s", filepath)
|
self.log.info("File already uploaded: %s", filepath)
|
||||||
return
|
return
|
||||||
|
|
|
@ -20,8 +20,8 @@ import sys
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from pyrpkg import rpkgError
|
from pyrpkg import rpkgError
|
||||||
from requests.exceptions import ConnectionError
|
from requests.exceptions import ConnectionError
|
||||||
from six.moves.configparser import NoOptionError, NoSectionError
|
from configparser import NoOptionError, NoSectionError
|
||||||
from six.moves.urllib.parse import quote_plus, urlparse
|
from urllib.parse import quote_plus, urlparse
|
||||||
|
|
||||||
import git as gitpython
|
import git as gitpython
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue