Mock Version: 3.0 Mock Version: 3.0 Mock Version: 3.0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target noarch --nodeps /builddir/build/SPECS/python-MultipartPostHandler2.spec'], chrootPath='/var/lib/mock/f37-build-side-28-python-devel-97831-5313/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target noarch --nodeps /builddir/build/SPECS/python-MultipartPostHandler2.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False warning: extra tokens at the end of %endif directive in line 61: %endif # with internet Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1658448000 Wrote: /builddir/build/SRPMS/python-MultipartPostHandler2-0.1.5-27.fc37.src.rpm RPM build warnings: extra tokens at the end of %endif directive in line 61: %endif # with internet Child return code was: 0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target noarch --nodeps /builddir/build/SPECS/python-MultipartPostHandler2.spec'], chrootPath='/var/lib/mock/f37-build-side-28-python-devel-97831-5313/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=864000uid=996gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target noarch --nodeps /builddir/build/SPECS/python-MultipartPostHandler2.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'} and shell False warning: extra tokens at the end of %endif directive in line 61: %endif # with internet Building target platforms: noarch Building for target noarch setting SOURCE_DATE_EPOCH=1658448000 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.iIpzJ6 + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf MultipartPostHandler2-0.1.5 + /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/MultipartPostHandler2-0.1.5.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd MultipartPostHandler2-0.1.5 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + rm -rf doc + '[' -z sP ']' + shebang_flags=-kasP + /usr/bin/python3 -B /usr/lib/rpm/redhat/pathfix.py -pni /usr/bin/python3 -kasP . recursedown('.') recursedown('./MultipartPostHandler2.egg-info') recursedown('./examples') ./MultipartPostHandler.py: no change ./setup.py: no change ./examples/MultipartPostHandler-example.py: updating + 2to3 --write --nobackup MultipartPostHandler.py setup.py examples/MultipartPostHandler-example.py /usr/bin/2to3:3: DeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+ from lib2to3.main import main RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored MultipartPostHandler.py RefactoringTool: No changes to setup.py RefactoringTool: Refactored examples/MultipartPostHandler-example.py RefactoringTool: Files that were modified: RefactoringTool: MultipartPostHandler.py RefactoringTool: setup.py RefactoringTool: examples/MultipartPostHandler-example.py --- MultipartPostHandler.py (original) +++ MultipartPostHandler.py (refactored) @@ -51,11 +51,11 @@ opener.open("http://wwww.bobsite.com/upload/", params) """ -import urllib -import urllib2 +import urllib.request, urllib.parse, urllib.error +import urllib.request, urllib.error, urllib.parse import mimetools, mimetypes import os, stat -from cStringIO import StringIO +from io import StringIO class Callable: def __init__(self, anycallable): @@ -65,8 +65,8 @@ # assigning a sequence. doseq = 1 -class MultipartPostHandler(urllib2.BaseHandler): - handler_order = urllib2.HTTPHandler.handler_order - 10 # needs to run first +class MultipartPostHandler(urllib.request.BaseHandler): + handler_order = urllib.request.HTTPHandler.handler_order - 10 # needs to run first def http_request(self, request): data = request.get_data() @@ -74,23 +74,23 @@ v_files = [] v_vars = [] try: - for(key, value) in data.items(): + for(key, value) in list(data.items()): if type(value) == file: v_files.append((key, value)) else: v_vars.append((key, value)) except TypeError: systype, value, traceback = sys.exc_info() - raise TypeError, "not a valid non-string sequence or mapping object", traceback + raise TypeError("not a valid non-string sequence or mapping object").with_traceback(traceback) if len(v_files) == 0: - data = urllib.urlencode(v_vars, doseq) + data = urllib.parse.urlencode(v_vars, doseq) else: boundary, data = self.multipart_encode(v_vars, v_files) contenttype = 'multipart/form-data; boundary=%s' % boundary if(request.has_header('Content-Type') and request.get_header('Content-Type').find('multipart/form-data') != 0): - print "Replacing %s with %s" % (request.get_header('content-type'), 'multipart/form-data') + print("Replacing %s with %s" % (request.get_header('content-type'), 'multipart/form-data')) request.add_unredirected_header('Content-Type', contenttype) request.add_data(data) --- examples/MultipartPostHandler-example.py (original) +++ examples/MultipartPostHandler-example.py (refactored) @@ -5,10 +5,10 @@ """ def main(): - import tempfile, sys, os, urllib2, MultipartPostHandler + import tempfile, sys, os, urllib.request, urllib.error, urllib.parse, MultipartPostHandler validatorURL = "http://validator.w3.org/check" - opener = urllib2.build_opener(MultipartPostHandler.MultipartPostHandler) + opener = urllib.request.build_opener(MultipartPostHandler.MultipartPostHandler) def validateFile(url): temp = tempfile.mkstemp(suffix=".html") @@ -16,7 +16,7 @@ params = { "ss" : "0", # show source "doctype" : "Inline", "uploaded_file" : open(temp[1], "rb") } - print(opener.open(validatorURL, params).read()) + print((opener.open(validatorURL, params).read())) os.remove(temp[1]) if len(sys.argv[1:]) > 0: + echo 'Patch #1 (python-MultipartPostHandler2-python3.patch):' Patch #1 (python-MultipartPostHandler2-python3.patch): + /usr/bin/patch --no-backup-if-mismatch -f -p1 --fuzz=0 patching file MultipartPostHandler.py patching file examples/MultipartPostHandler-example.py + sed -i 's|http://www.google.com|https://getfedora.org/|' examples/MultipartPostHandler-example.py + RPM_EC=0 ++ jobs -p + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.jJMH9U + umask 022 + cd /builddir/build/BUILD + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib/gfortran/modules' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib/gfortran/modules' + export FCFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd MultipartPostHandler2-0.1.5 + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -sP' running build running build_py creating build creating build/lib copying MultipartPostHandler.py -> build/lib + RPM_EC=0 ++ jobs -p + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.k6hLsg + umask 022 + cd /builddir/build/BUILD + '[' /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch '!=' / ']' + rm -rf /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch ++ dirname /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch + mkdir -p /builddir/build/BUILDROOT + mkdir /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib/gfortran/modules' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib/gfortran/modules' + export FCFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd MultipartPostHandler2-0.1.5 + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + /usr/bin/python3 setup.py install -O1 --skip-build --root /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch --prefix /usr running install /usr/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running install_lib creating /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr creating /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/lib creating /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/lib/python3.11 creating /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/lib/python3.11/site-packages copying build/lib/MultipartPostHandler.py -> /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/lib/python3.11/site-packages byte-compiling /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/lib/python3.11/site-packages/MultipartPostHandler.py to MultipartPostHandler.cpython-311.pyc writing byte-compilation script '/tmp/tmpxixrjycx.py' /usr/bin/python3 /tmp/tmpxixrjycx.py removing /tmp/tmpxixrjycx.py running install_egg_info running egg_info writing MultipartPostHandler2.egg-info/PKG-INFO writing dependency_links to MultipartPostHandler2.egg-info/dependency_links.txt writing top-level names to MultipartPostHandler2.egg-info/top_level.txt reading manifest file 'MultipartPostHandler2.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'MultipartPostHandler2.egg-info/SOURCES.txt' Copying MultipartPostHandler2.egg-info to /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/lib/python3.11/site-packages/MultipartPostHandler2-0.1.5-py3.11.egg-info running install_scripts + rm -rfv /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/bin/__pycache__ + /usr/bin/find-debuginfo -j8 --strict-build-id -m -i --build-id-seed 0.1.5-27.fc37 --unique-debug-suffix -0.1.5-27.fc37.noarch --unique-debug-src-base python-MultipartPostHandler2-0.1.5-27.fc37.noarch --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 50000000 -S debugsourcefiles.list /builddir/build/BUILD/MultipartPostHandler2-0.1.5 find: 'debug': No such file or directory + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-ldconfig + /usr/lib/rpm/brp-compress + /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/check-rpaths + /usr/lib/rpm/redhat/brp-mangle-shebangs + /usr/lib/rpm/brp-remove-la-files + /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0 Bytecompiling .py files below /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/lib/python3.11 using python3.11 + /usr/lib/rpm/redhat/brp-python-hardlink Processing files: python3-MultipartPostHandler2-0.1.5-27.fc37.noarch Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.UjyK8T + umask 022 + cd /builddir/build/BUILD + cd MultipartPostHandler2-0.1.5 + DOCDIR=/builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/share/doc/python3-MultipartPostHandler2 + export LC_ALL=C + LC_ALL=C + export DOCDIR + /usr/bin/mkdir -p /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/share/doc/python3-MultipartPostHandler2 + cp -pr README.txt /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/share/doc/python3-MultipartPostHandler2 + cp -pr examples/MultipartPostHandler-example.py /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch/usr/share/doc/python3-MultipartPostHandler2 + RPM_EC=0 ++ jobs -p + exit 0 Provides: python-MultipartPostHandler2 = 0.1.5-27.fc37 python3-MultipartPostHandler2 = 0.1.5-27.fc37 python3.11-MultipartPostHandler2 = 0.1.5-27.fc37 python3.11dist(multipartposthandler2) = 0.1.5 python3dist(multipartposthandler2) = 0.1.5 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PartialHardlinkSets) <= 4.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Requires: python(abi) = 3.11 Obsoletes: python-MultipartPostHandler2 < 0.1.5-12 python-MultipartPostHandler2 < 0.1.5-27.fc37 python2-MultipartPostHandler2 < 0.1.5-12 Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch Wrote: /builddir/build/RPMS/python3-MultipartPostHandler2-0.1.5-27.fc37.noarch.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.2uoqEn + umask 022 + cd /builddir/build/BUILD + cd MultipartPostHandler2-0.1.5 + /usr/bin/rm -rf /builddir/build/BUILDROOT/python-MultipartPostHandler2-0.1.5-27.fc37.noarch + RPM_EC=0 ++ jobs -p + exit 0 Executing(rmbuild): /bin/sh -e /var/tmp/rpm-tmp.NG1INE + umask 022 + cd /builddir/build/BUILD + rm -rf MultipartPostHandler2-0.1.5 MultipartPostHandler2-0.1.5.gemspec + RPM_EC=0 ++ jobs -p + exit 0 RPM build warnings: extra tokens at the end of %endif directive in line 61: %endif # with internet Child return code was: 0