#2490 Drop py 2.6 support (RHEL6)
Merged 2 years ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue2155a  into  master

file modified
+1 -11
@@ -3,7 +3,6 @@ 

  BINFILES = kojid

  LIBEXECFILES = mergerepos

  SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir)

- TYPE = systemd

  

  _default:

  	@echo "nothing to make.  try make install"
@@ -33,15 +32,6 @@ 

  	mkdir -p $(DESTDIR)/etc/kojid

  	install -p -m 644 kojid.conf $(DESTDIR)/etc/kojid/kojid.conf

  

- install-systemd: _install

+ install: _install

  	mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)

  	install -p -m 644 kojid.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)

- 

- install-sysv: _install

- 	mkdir -p $(DESTDIR)/etc/rc.d/init.d

- 	install -p -m 755 kojid.init $(DESTDIR)/etc/rc.d/init.d/kojid

- 

- 	mkdir -p $(DESTDIR)/etc/sysconfig

- 	install -p -m 644 kojid.sysconfig $(DESTDIR)/etc/sysconfig/kojid

- 

- install: install-$(TYPE)

file modified
+35 -206
@@ -26,6 +26,7 @@ 

  import copy

  import glob

  import grp

+ import io

  import json

  import logging

  import logging.handlers
@@ -48,6 +49,8 @@ 

  from optparse import SUPPRESS_HELP, OptionParser

  

  import Cheetah.Template

+ import dnf

+ import librepo

  import requests

  import rpm

  import six
@@ -79,26 +82,6 @@ 

      except ImportError:  # pragma: no cover

          reqgssapi = None

  

- try:

-     import librepo

-     import io

- except ImportError:

-     librepo = None

- 

- try:

-     import dnf

- except ImportError:

-     dnf = None

- 

- try:

-     # yum

-     from yum import repoMDObject

-     import yum.packages

-     import yum.Errors

-     yum_available = True

- except ImportError:

-     yum_available = False

- 

  # imports for LiveCD, LiveMedia, and Appliance handler

  try:

      import pykickstart.parser as ksparser
@@ -803,60 +786,42 @@ 

          opts = dict([(k, getattr(self.options, k)) for k in ('topurl', 'topdir')])

          opts['tempdir'] = self.options.workdir

  

-         # prefer librepo

-         if librepo is not None:

-             repo_url = os.path.join(repodir, self.br_arch)

-             # repo_url can start with '/', don't use os.path.join

-             if self.options.topurl:

-                 repo_url = '%s/%s' % (self.options.topurl, repo_url)

-             elif self.options.topdir:

-                 repo_url = '%s/%s' % (self.options.topdir, repo_url)

-             logging.error(repo_url)

-             tmpdir = os.path.join(self.tmpdir(), 'librepo-markExternalRPMs')

-             koji.ensuredir(tmpdir)

-             h = librepo.Handle()

-             r = librepo.Result()

-             h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO)

-             h.setopt(librepo.LRO_URLS, [repo_url])

-             h.setopt(librepo.LRO_DESTDIR, tmpdir)

-             # We are using this just to find out location of 'origin',

-             # we don't even need to download it since we use openRemoteFile

-             h.setopt(librepo.LRO_YUMDLIST, [])

-             h.perform(r)

-             pkgorigins = r.getinfo(librepo.LRR_YUM_REPOMD)['origin']['location_href']

-             koji.util.rmtree(tmpdir)

-         elif yum_available:

-             # XXX - cheap hack to get relative paths

-             repomdpath = os.path.join(repodir, self.br_arch, 'repodata', 'repomd.xml')

-             with koji.openRemoteFile(repomdpath, **opts) as fo:

-                 try:

-                     repodata = repoMDObject.RepoMD('ourrepo', fo)

-                 except Exception:

-                     raise koji.BuildError("Unable to parse repomd.xml file for %s" %

-                                           os.path.join(repodir, self.br_arch))

-             data = repodata.getData('origin')

-             pkgorigins = data.location[1]

-         else:

-             # shouldn't occur

-             raise koji.GenericError("install librepo or yum")

+         repo_url = os.path.join(repodir, self.br_arch)

+         # repo_url can start with '/', don't use os.path.join

+         if self.options.topurl:

+             repo_url = '%s/%s' % (self.options.topurl, repo_url)

+         elif self.options.topdir:

+             repo_url = '%s/%s' % (self.options.topdir, repo_url)

+         logging.error(repo_url)

+         tmpdir = os.path.join(self.tmpdir(), 'librepo-markExternalRPMs')

+         koji.ensuredir(tmpdir)

+         h = librepo.Handle()

+         r = librepo.Result()

+         h.setopt(librepo.LRO_REPOTYPE, librepo.LR_YUMREPO)

+         h.setopt(librepo.LRO_URLS, [repo_url])

+         h.setopt(librepo.LRO_DESTDIR, tmpdir)

+         # We are using this just to find out location of 'origin',

+         # we don't even need to download it since we use openRemoteFile

+         h.setopt(librepo.LRO_YUMDLIST, [])

+         h.perform(r)

+         pkgorigins = r.getinfo(librepo.LRR_YUM_REPOMD)['origin']['location_href']

+         koji.util.rmtree(tmpdir)

  

          relpath = os.path.join(repodir, self.br_arch, pkgorigins)

          with koji.openRemoteFile(relpath, **opts) as fo:

              # at this point we know there were external repos at the create event,

              # so there should be an origins file.

              origin_idx = {}

-             # don't use 'with GzipFile' as it is not supported on py2.6

-             fo2 = GzipFile(fileobj=fo, mode='r')

-             if six.PY3:

-                 fo2 = io.TextIOWrapper(fo2, encoding='utf-8')

-             for line in fo2:

-                 parts = line.split(None, 2)

-                 if len(parts) < 2:

-                     continue

-                 # first field is formated by yum as [e:]n-v-r.a

-                 nvra = "%(name)s-%(version)s-%(release)s.%(arch)s" % koji.parse_NVRA(parts[0])

-                 origin_idx[nvra] = parts[1]

-             fo2.close()

+             with GzipFile(fileobj=fo, mode='r') as fo2:

+                 if six.PY3:

+                     fo2 = io.TextIOWrapper(fo2, encoding='utf-8')

+                 for line in fo2:

+                     parts = line.split(None, 2)

+                     if len(parts) < 2:

+                         continue

+                     # first field is formated by yum as [e:]n-v-r.a

+                     nvra = "%(name)s-%(version)s-%(release)s.%(arch)s" % koji.parse_NVRA(parts[0])

+                     origin_idx[nvra] = parts[1]

          # mergerepo starts from a local repo in the task workdir, so internal

          # rpms have an odd-looking origin that we need to look for

          localtail = '/repo_%s_premerge/' % self.repo_info['id']
@@ -5756,10 +5721,7 @@ 

          self.uploadpath = self.getUploadDir()

          self.get_rpms(tag, arch, keys, opts)

          if opts['multilib'] and koji.arch.isMultiLibArch(arch):

-             if dnf is not None:

-                 self.do_multilib_dnf(arch, self.archmap[arch], opts['multilib'])

-             else:

-                 self.do_multilib_yum(arch, self.archmap[arch], opts['multilib'])

+             self.do_multilib(arch, self.archmap[arch], opts['multilib'])

          self.split_pkgs(opts)

          self.write_kojipkgs()

          self.write_pkglist()
@@ -5886,7 +5848,7 @@ 

              raise koji.GenericError('failed to create repo: %s'

                                      % parseStatus(status, ' '.join(cmd)))

  

-     def do_multilib_dnf(self, arch, ml_arch, conf):

+     def do_multilib(self, arch, ml_arch, conf):

          repodir = koji.pathinfo.distrepo(self.rinfo['id'], self.rinfo['tag_name'])

          mldir = os.path.join(repodir, koji.canonArch(ml_arch))

          ml_true = set()  # multilib packages we need to include before depsolve
@@ -6012,139 +5974,6 @@ 

              rpminfo['_multilib'] = True

              self.kojipkgs[bnp] = rpminfo

  

-     def do_multilib_yum(self, arch, ml_arch, conf):

-         repodir = koji.pathinfo.distrepo(self.rinfo['id'], self.rinfo['tag_name'])

-         mldir = os.path.join(repodir, koji.canonArch(ml_arch))

-         ml_true = set()  # multilib packages we need to include before depsolve

-         ml_conf = os.path.join(koji.pathinfo.work(), conf)

- 

-         # read pkgs data from multilib repo

-         ml_pkgfile = os.path.join(mldir, 'kojipkgs')

-         ml_pkgs = json.load(open(ml_pkgfile, 'r'))

- 

-         # step 1: figure out which packages are multilib (should already exist)

-         mlm = multilib.DevelMultilibMethod(ml_conf)

-         fs_missing = set()

-         for bnp in self.kojipkgs:

-             rpminfo = self.kojipkgs[bnp]

-             ppath = rpminfo['_pkgpath']

-             po = yum.packages.YumLocalPackage(filename=ppath)

-             if mlm.select(po):

-                 # we need a multilib package to be included

-                 ml_bnp = bnp.replace(arch, self.archmap[arch])

-                 ml_path = os.path.join(mldir, ml_bnp[0].lower(), ml_bnp)

-                 # ^ XXX - should actually generate this

-                 if ml_bnp not in ml_pkgs:

-                     # not in our multilib repo

-                     self.logger.error('%s (multilib) is not on the filesystem' % ml_path)

-                     fs_missing.add(ml_path)

-                     # we defer failure so can report all the missing deps

-                     continue

-                 ml_true.add(ml_path)

- 

-         # step 2: set up architectures for yum configuration

-         self.logger.info("Resolving multilib for %s using method devel" % arch)

-         yumbase = yum.YumBase()

-         yumbase.verbose_logger.setLevel(logging.ERROR)

-         yumdir = os.path.join(self.workdir, 'yum')

-         # TODO: unwind this arch mess

-         archlist = (arch, 'noarch')

-         transaction_arch = arch

-         archlist = archlist + self.compat[self.biarch[arch]]

-         best_compat = self.compat[self.biarch[arch]][0]

-         if koji.arch.archDifference(best_compat, arch) > 0:

-             transaction_arch = best_compat

-         if hasattr(koji.arch, 'ArchStorage'):

-             yumbase.preconf.arch = transaction_arch

-         else:

-             koji.arch.canonArch = transaction_arch

- 

-         yconfig = """

- [main]

- debuglevel=2

- pkgpolicy=newest

- exactarch=1

- gpgcheck=0

- reposdir=/dev/null

- cachedir=/yumcache

- installroot=%s

- logfile=/yum.log

- 

- [koji-%s]

- name=koji multilib task

- baseurl=file://%s

- enabled=1

- 

- """ % (yumdir, self.id, mldir)

-         os.makedirs(os.path.join(yumdir, "yumcache"))

-         os.makedirs(os.path.join(yumdir, 'var/lib/rpm'))

- 

-         # step 3: proceed with yum config and set up

-         yconfig_path = os.path.join(yumdir, 'yum.conf-koji-%s' % arch)

-         with open(yconfig_path, 'w') as f:

-             f.write(yconfig)

-         self.session.uploadWrapper(yconfig_path, self.uploadpath,

-                                    os.path.basename(yconfig_path))

-         yumbase.doConfigSetup(fn=yconfig_path)

-         yumbase.conf.cache = 0

-         yumbase.doRepoSetup()

-         yumbase.doTsSetup()

-         yumbase.doRpmDBSetup()

-         # we trust Koji's files, so skip verifying sigs and digests

-         yumbase.ts.pushVSFlags(

-             (rpm._RPMVSF_NOSIGNATURES | rpm._RPMVSF_NODIGESTS))

-         yumbase.doSackSetup(archlist=archlist, thisrepo='koji-%s' % arch)

-         yumbase.doSackFilelistPopulate()

-         for pkg in ml_true:

-             # TODO: store packages by first letter

-             # ppath = os.path.join(pkgdir, pkg.name[0].lower(), pname)

-             po = yum.packages.YumLocalPackage(filename=pkg)

-             yumbase.tsInfo.addInstall(po)

- 

-         # step 4: execute yum transaction to get dependencies

-         self.logger.info("Resolving depenencies for arch %s" % arch)

-         rc, errors = yumbase.resolveDeps()

-         ml_needed = {}

-         for tspkg in yumbase.tsInfo.getMembers():

-             bnp = os.path.basename(tspkg.po.localPkg())

-             dep_path = os.path.join(mldir, bnp[0].lower(), bnp)

-             ml_needed[dep_path] = tspkg

-             self.logger.debug("added %s" % dep_path)

-             if not os.path.exists(dep_path):

-                 self.logger.error('%s (multilib dep) not on filesystem' % dep_path)

-                 fs_missing.add(dep_path)

-         self.logger.info('yum return code: %s' % rc)

-         if not rc:

-             self.logger.error('yum depsolve was unsuccessful')

-             raise koji.GenericError(errors)

-         if len(fs_missing) > 0:

-             missing_log = os.path.join(self.workdir, 'missing_multilib.log')

-             with open(missing_log, 'w') as outfile:

-                 outfile.write('The following multilib files were missing:\n')

-                 for ml_path in fs_missing:

-                     outfile.write(ml_path)

-                     outfile.write('\n')

-             self.session.uploadWrapper(missing_log, self.uploadpath)

-             raise koji.GenericError('multilib packages missing. '

-                                     'See missing_multilib.log')

- 

-         # step 5: update kojipkgs

-         for dep_path in ml_needed:

-             tspkg = ml_needed[dep_path]

-             bnp = os.path.basename(dep_path)

-             if bnp in self.kojipkgs:

-                 # we expect duplication with noarch, but not other arches

-                 if tspkg.arch != 'noarch':

-                     self.logger.warning("Multilib duplicate: %s", bnp)

-                 continue

-             rpminfo = ml_pkgs[bnp].copy()

-             # fix _pkgpath, which comes from another task and could be wrong

-             # for us

-             # TODO: would be better if we could use the proper path here

-             rpminfo['_pkgpath'] = dep_path

-             rpminfo['_multilib'] = True

-             self.kojipkgs[bnp] = rpminfo

- 

      def pick_key(self, keys, avail_keys):

          best = None

          best_idx = None

file modified
+4 -4
@@ -1,15 +1,15 @@ 

- #!/usr/bin/python2

+ #!/usr/bin/python3

  

  from __future__ import absolute_import, print_function

  

  import ast

+ import io

  import os

  import os.path

  import pprint

  import sys

  

- from six.moves import cStringIO

- from six.moves.urllib.parse import quote

+ from urllib.parse import quote

  

  sys.path.insert(0, os.getcwd())

  sys.path.insert(1, os.path.join(os.getcwd(), 'hub'))
@@ -94,7 +94,7 @@ 

      environ['SERVER_NAME'] = 'myserver'

      environ['SERVER_PORT'] = '443'

      environ['REQUEST_URI'] = get_url(environ)

-     environ['wsgi.input'] = cStringIO(get_request())

+     environ['wsgi.input'] = io.StringIO(get_request())

      environ['REQUEST_METHOD'] = 'POST'

      environ['CONTENT_TYPE'] = 'text/xml'

      set_config(environ)

file modified
+2 -2
@@ -1,4 +1,4 @@ 

- #!/usr/bin/python2

+ #!/usr/bin/python3

  

  from __future__ import absolute_import, print_function

  
@@ -7,10 +7,10 @@ 

  import os.path

  import pprint

  import sys

+ from urllib.parse import quote

  from wsgiref.simple_server import make_server

  from wsgiref.util import setup_testing_defaults

  

- from six.moves.urllib.parse import quote

  

  CWD = os.getcwd()

  sys.path.insert(0, CWD)

file modified
+3 -3
@@ -548,9 +548,9 @@ 

  handling is done by cron, but can be substituted by anything else (Ansible

  tower, etc.)

  

- Script is by default installed on hub as `/usr/sbin/koji-sweep-db`. On systemd

- systems it also has corresponding `koji-sweep-db` service and timer. Note, that

- timer is not enabled by default, so you need to run usual `systemctl` commands:

+ Script is by default installed on hub as `/usr/sbin/koji-sweep-db`.  It has also

+ corresponding `koji-sweep-db` service and timer. Note, that timer is not enabled

+ by default, so you need to run usual `systemctl` commands:

  

  ::

  

file modified
+9 -85
@@ -18,9 +18,13 @@ 

  # and no python2 on rhel8+

  %define py2_support 0

  %else

- %if 0%{?rhel}

+ %if 0%{?rhel} >= 7

  # No python3 for older rhel

  %define py3_support 0

+ %else

+ # don't build anything for rhel6

+ %define py2_support 0

+ %define py3_support 0

  %endif

  %endif

  
@@ -66,13 +70,6 @@ 

  # If the definition isn't available for python3_pkgversion, define it

  %{?!python3_pkgversion:%global python3_pkgversion 3}

  

- %if 0%{?fedora} || 0%{?rhel} >= 7

- %global use_systemd 1

- %else

- %global use_systemd 0

- %global install_opt TYPE=sysv

- %endif

- 

  %define baserelease 1

  #build with --define 'testbuild 1' to have a timestamp appended to release

  %if "x%{?testbuild}" == "x1"
@@ -100,10 +97,8 @@ 

  Requires: python-libcomps

  %endif

  %endif

- %if %{use_systemd}

  BuildRequires: systemd

  BuildRequires: pkgconfig

- %endif

  

  %description

  Koji is a system for building and tracking RPMS.  The base package
@@ -261,16 +256,9 @@ 

  Requires: mock >= 0.9.14

  Requires(pre): /usr/sbin/useradd

  Requires: squashfs-tools

- %if %{use_systemd}

  Requires(post): systemd

  Requires(preun): systemd

  Requires(postun): systemd

- %else

- Requires(post): /sbin/chkconfig

- Requires(post): /sbin/service

- Requires(preun): /sbin/chkconfig

- Requires(preun): /sbin/service

- %endif

  Requires: /usr/bin/cvs

  Requires: /usr/bin/svn

  Requires: /usr/bin/git
@@ -295,16 +283,9 @@ 

  Group: Applications/System

  License: LGPLv2

  Requires: %{name} = %{version}-%{release}

- %if %{use_systemd}

  Requires(post): systemd

  Requires(preun): systemd

  Requires(postun): systemd

- %else

- Requires(post): /sbin/chkconfig

- Requires(post): /sbin/service

- Requires(preun): /sbin/chkconfig

- Requires(preun): /sbin/service

- %endif

  %if 0%{py3_support} > 1

  Requires: python%{python3_pkgversion}-libvirt

  Requires: python%{python3_pkgversion}-libxml2
@@ -333,11 +314,9 @@ 

  Obsoletes: python2-koji-sidetag-plugin-tools < %{version}-%{release}

  Provides: python2-koji-sidetag-plugin-tools = %{version}-%{release}

  %endif

- %if %{use_systemd}

  Requires(post): systemd

  Requires(preun): systemd

  Requires(postun): systemd

- %endif

  

  %description utils

  Utilities for the Koji system
@@ -388,12 +367,12 @@ 

  

  # python2 build

  %if 0%{py2_support} > 1

- make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} %{?install_opt} install

+ make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install

  %else

  %if 0%{py2_support}

  for d in koji cli plugins ; do

      pushd $d

-     make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python2} %{?install_opt} install

+     make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python2} install

      popd

  done

  %endif
@@ -402,7 +381,7 @@ 

  

  # python3 build

  %if 0%{py3_support} > 1

- make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install

+ make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} install

  # alter python interpreter in koji CLI

  scripts='%{_bindir}/koji %{_sbindir}/kojid %{_sbindir}/kojira %{_sbindir}/koji-shadow

           %{_sbindir}/koji-gc %{_sbindir}/kojivmd %{_sbindir}/koji-sweep-db
@@ -415,7 +394,7 @@ 

  # minimal

  for d in koji cli plugins ; do

      pushd $d

-     make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python3} %{?install_opt} install

+     make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python3} install

      popd

  done

  # alter python interpreter in koji CLI
@@ -505,10 +484,8 @@ 

  %config(noreplace) %attr(0640, root, apache) /etc/koji-hub/hub.conf

  %dir /etc/koji-hub/hub.conf.d

  %{_sbindir}/koji-sweep-db

- %if %{use_systemd}

  %{_unitdir}/koji-sweep-db.service

  %{_unitdir}/koji-sweep-db.timer

- %endif

  

  %files -n python%{python3_pkgversion}-%{name}-hub

  %{_datadir}/koji-hub/*.py
@@ -534,11 +511,9 @@ 

  

  %files utils

  %{_sbindir}/kojira

- %if %{use_systemd}

  %{_unitdir}/koji-gc.service

  %{_unitdir}/koji-gc.timer

  %{_unitdir}/kojira.service

- %endif

  %dir /etc/kojira

  %config(noreplace) /etc/kojira/kojira.conf

  %{_sbindir}/koji-gc
@@ -567,12 +542,7 @@ 

  %dir %{_libexecdir}/kojid

  %{_libexecdir}/kojid/mergerepos

  %endif

- %if %{use_systemd}

  %{_unitdir}/kojid.service

- %else

- %{_initrddir}/kojid

- %config(noreplace) /etc/sysconfig/kojid

- %endif

  %dir /etc/kojid

  %config(noreplace) /etc/kojid/kojid.conf

  %attr(-,kojibuilder,kojibuilder) /etc/mock/koji
@@ -580,8 +550,6 @@ 

  %pre builder

  /usr/sbin/useradd -r -s /bin/bash -G mock -d /builddir -M kojibuilder 2>/dev/null ||:

  

- %if %{use_systemd}

- 

  %post builder

  %systemd_post kojid.service

  
@@ -591,33 +559,14 @@ 

  %postun builder

  %systemd_postun kojid.service

  

- %else

- 

- %post builder

- /sbin/chkconfig --add kojid

- 

- %preun builder

- if [ $1 = 0 ]; then

-   /sbin/service kojid stop &> /dev/null

-   /sbin/chkconfig --del kojid

- fi

- %endif

- 

  %files vm

  %{_sbindir}/kojivmd

  #dir %%{_datadir}/kojivmd

  %{_datadir}/kojivmd/kojikamid

- %if %{use_systemd}

  %{_unitdir}/kojivmd.service

- %else

- %{_initrddir}/kojivmd

- %config(noreplace) /etc/sysconfig/kojivmd

- %endif

  %dir /etc/kojivmd

  %config(noreplace) /etc/kojivmd/kojivmd.conf

  

- %if %{use_systemd}

- 

  %post vm

  %systemd_post kojivmd.service

  
@@ -627,19 +576,6 @@ 

  %postun vm

  %systemd_postun kojivmd.service

  

- %else

- 

- %post vm

- /sbin/chkconfig --add kojivmd

- 

- %preun vm

- if [ $1 = 0 ]; then

-   /sbin/service kojivmd stop &> /dev/null

-   /sbin/chkconfig --del kojivmd

- fi

- 

- %if %{use_systemd}

- 

  %post utils

  %systemd_post kojira.service

  
@@ -649,18 +585,6 @@ 

  %postun utils

  %systemd_postun kojira.service

  

- %else

- %post utils

- /sbin/chkconfig --add kojira

- /sbin/service kojira condrestart &> /dev/null || :

- %preun utils

- if [ $1 = 0 ]; then

-   /sbin/service kojira stop &> /dev/null || :

-   /sbin/chkconfig --del kojira

- fi

- %endif

- %endif

- 

  %changelog

  * Tue Jul 28 2020 Mike McLean <mikem at redhat.com> - 1.22.0-1

  - PR#2404: release bump and changelog

file modified
-4
@@ -3304,10 +3304,6 @@ 

          t = datetime.datetime.fromtimestamp(value)

      else:

          t = value

-     # return date in local timezone, py 2.6 has tzone as astimezone required parameter

-     # would work simply as t.astimezone() for py 2.7+

-     if t.tzinfo is None:

-         t = t.replace(tzinfo=dateutil.tz.gettz())

      t = t.astimezone(dateutil.tz.gettz())

      return datetime.datetime.strftime(t, '%a, %d %b %Y %H:%M:%S %Z')

  

file modified
+2 -11
@@ -1,7 +1,5 @@ 

  from __future__ import absolute_import

  

- import sys

- 

  from setuptools import setup

  

  
@@ -13,6 +11,7 @@ 

  

      requires = [

          'python-dateutil',

+         'pyOpenSSL',

          'requests',

          'requests-gssapi',

          'six',
@@ -20,13 +19,6 @@ 

          # 'rpm-py-installer', # it is optional feature

          # 'rpm',

      ]

-     # since pyOpenSSL-18.0.0, py26 support is dropped

-     # see https://pagure.io/koji/issue/1060

-     if sys.version_info[0] == 2 and sys.version_info[1] < 7:

-         requires.append('pyOpenSSL<18.0.0')

-     else:

-         requires.append('pyOpenSSL')

- 

      return requires

  

  
@@ -51,7 +43,6 @@ 

          "Intended Audience :: Developers",

          "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",

          "Natural Language :: English",

-         "Programming Language :: Python :: 2.6",

          "Programming Language :: Python :: 2.7",

          "Programming Language :: Python :: 3",

          "Operating System :: POSIX :: Linux",
@@ -74,6 +65,6 @@ 

          'util/koji-sweep-db',

          'util/kojira',

      ],

-     python_requires='>=2.6',

+     python_requires='>=2.7',

      install_requires=get_install_requires(),

  )

file modified
+1 -3
@@ -2,8 +2,6 @@ 

  flake8

  flake8-import-order

  mock<=2.0.0

- requests-mock;python_version >= '2.7'

- requests-mock<1.5.0;python_version < '2.7'

+ requests-mock

  coverage

  nose

- unittest2;python_version < '3.0'

@@ -5,6 +5,7 @@ 

  import os

  import tempfile

  import time

+ import unittest

  

  import mock

  import six
@@ -13,12 +14,6 @@ 

  import koji.util

  from .loadkojid import kojid

  

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

- 

- 

  

  class MyClientSession(koji.ClientSession):

  

@@ -2,10 +2,7 @@ 

  import mock

  import rpm

  import tempfile

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  import koji

  from .loadkojid import kojid

  from six.moves import range

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji.daemon

  import koji

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import inspect

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  import koji

  import koji.tasks

  

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import tempfile

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  from .loadkojid import kojid

  import logging

  

@@ -2,10 +2,7 @@ 

  import mock

  import shutil

  import tempfile

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.lib import activate_session

  

@@ -2,10 +2,7 @@ 

  

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_add_group

  from . import utils

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_add_group_pkg

  from . import utils

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_add_group_req

  from . import utils

@@ -4,10 +4,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_add_host_to_channel

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import koji

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  from six.moves import StringIO

  

  from koji_cli.commands import handle_add_notification

@@ -4,10 +4,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from mock import call

  

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_add_tag

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_add_user

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_add_volume

  from . import utils

@@ -1,12 +1,7 @@ 

  from __future__ import absolute_import

  import mock

- import os

  import six

- import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  from koji_cli.commands import handle_assign_task

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_block_group_pkg

  from . import utils

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_block_group_req

  from . import utils

file modified
+1 -4
@@ -2,10 +2,7 @@ 

  import json

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_call

  from . import utils

@@ -4,10 +4,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_chain_build

  from . import utils

@@ -4,10 +4,7 @@ 

  import six

  from mock import call

  

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  from koji_cli.commands import handle_clone_tag

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from mock import call

  from koji_cli.commands import handle_disable_host

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_disable_user

  from . import utils

@@ -3,10 +3,7 @@ 

  import copy

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  

  from koji_cli.commands import handle_dist_repo

@@ -6,10 +6,7 @@ 

  import os

  import requests_mock

  import requests

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.lib import download_file, _download_progress

  

@@ -2,10 +2,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  from koji_cli.commands import handle_edit_external_repo

@@ -3,10 +3,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from mock import call

  

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import koji

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  from six.moves import StringIO

  

  from koji_cli.commands import handle_edit_notification

@@ -3,10 +3,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  

  from koji_cli.commands import handle_edit_user

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from mock import call

  from koji_cli.commands import handle_enable_host

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_enable_user

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_grant_cg_access

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_grant_permission

  from . import utils

file modified
+1 -4
@@ -2,10 +2,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  from koji_cli.commands import handle_moshimoshi, _printable_unicode

@@ -2,10 +2,7 @@ 

  import mock

  import six

  import os

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  

@@ -2,10 +2,7 @@ 

  import mock

  import os

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  from koji_cli.commands import handle_import

@@ -8,10 +8,7 @@ 

  

  import os

  

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  

  class TestImportCG(utils.CliTestCase):

@@ -4,10 +4,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  try:

      import libcomps

@@ -5,10 +5,7 @@ 

  import random

  import six

  from six.moves import range

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from mock import call

  from koji.util import base64encode

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import anon_handle_list_api

  from . import utils

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  from six.moves import StringIO

  

  import koji

@@ -2,10 +2,7 @@ 

  import mock

  import os

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from . import loadcli, utils

  cli = loadcli.cli

@@ -2,10 +2,7 @@ 

  import mock

  import six

  import time

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import anon_handle_list_groups

  from . import utils

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  from six.moves import StringIO

  

  import koji

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_list_permissions

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  from koji_cli.lib import _list_tasks

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_list_volumes

  from . import utils

@@ -2,10 +2,7 @@ 

  

  import os

  

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import mock

  

@@ -5,10 +5,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_maven_build

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_maven_chain

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import anon_handle_mock_config

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_move_build

  from . import utils

@@ -3,10 +3,7 @@ 

  import copy

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_regen_repo

  from . import utils

@@ -3,10 +3,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_remove_channel

  from . import utils

@@ -3,10 +3,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_remove_host_from_channel

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import koji

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from six.moves import StringIO

  

@@ -3,10 +3,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from mock import call

  

@@ -3,10 +3,7 @@ 

  import os

  import six

  import sys

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_rename_channel

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  import koji

  from koji_cli.commands import handle_restart_hosts

@@ -2,10 +2,7 @@ 

  from __future__ import print_function

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_resubmit

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_revoke_cg_access

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_revoke_permission

  from . import utils

@@ -1,9 +1,6 @@ 

  from __future__ import absolute_import

  import mock

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.lib import _running_in_bg

  

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import anon_handle_search

  from . import utils

@@ -1,10 +1,7 @@ 

  from __future__ import absolute_import

  import mock

  import six

- try:

-     import unittest2 as unittest

- except ImportError:

-     import unittest

+ import unittest

  

  from koji_cli.commands import handle_set_build_volume

  from . import utils