Mock Version: 1.4.20 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target aarch64 --nodeps /builddir/build/SPECS/python-google-apputils.spec'], chrootPath='/var/lib/mock/1062301-epel-8-aarch64-1571288486.837185/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': 'en_US.UTF-8'}shell=Falselogger=timeout=0uid=1000gid=135user='mockbuild'nspawn_args=['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.93vuh9eu:/etc/resolv.conf']unshare_net=TrueprintOutput=True) Using nspawn with args ['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.93vuh9eu:/etc/resolv.conf'] Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '6b6159c966324b1981f166fcf2551f6a', '-D', '/var/lib/mock/1062301-epel-8-aarch64-1571288486.837185/root', '-a', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.93vuh9eu:/etc/resolv.conf', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;\\007"', '--setenv=PS1= \\s-\\v\\$ ', '--setenv=LANG=en_US.UTF-8', '-u', 'mockbuild', 'bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target aarch64 --nodeps /builddir/build/SPECS/python-google-apputils.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': 'en_US.UTF-8'} and shell False warning: Macro expanded in comment on line 43: %{srcname} warning: Macro expanded in comment on line 44: %summary warning: Macro expanded in comment on line 48: %{?python_provide:%python_provide python2-%{srcname}} warning: Macro expanded in comment on line 50: %{srcname} %_description Building target platforms: aarch64 Building for target aarch64 Wrote: /builddir/build/SRPMS/python-google-apputils-0.4.2-18.el8.src.rpm Child return code was: 0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target aarch64 --nodeps /builddir/build/SPECS/python-google-apputils.spec'], chrootPath='/var/lib/mock/1062301-epel-8-aarch64-1571288486.837185/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': 'en_US.UTF-8'}shell=Falselogger=timeout=0uid=1000gid=135user='mockbuild'nspawn_args=['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.93vuh9eu:/etc/resolv.conf']unshare_net=TrueprintOutput=True) Using nspawn with args ['--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.93vuh9eu:/etc/resolv.conf'] Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '80c5d6f6e034450ab5214eef0ae6770a', '-D', '/var/lib/mock/1062301-epel-8-aarch64-1571288486.837185/root', '-a', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.93vuh9eu:/etc/resolv.conf', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;\\007"', '--setenv=PS1= \\s-\\v\\$ ', '--setenv=LANG=en_US.UTF-8', '-u', 'mockbuild', 'bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target aarch64 --nodeps /builddir/build/SPECS/python-google-apputils.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': 'en_US.UTF-8'} and shell False warning: Macro expanded in comment on line 43: %{srcname} warning: Macro expanded in comment on line 44: %summary warning: Macro expanded in comment on line 48: %{?python_provide:%python_provide python2-%{srcname}} warning: Macro expanded in comment on line 50: %{srcname} %_description Building target platforms: aarch64 Building for target aarch64 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.ybGD7M + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf python-google-apputils-0.4.2 + /usr/bin/mkdir -p python-google-apputils-0.4.2 + cd python-google-apputils-0.4.2 + /usr/bin/gzip -dc /builddir/build/SOURCES/google-apputils-0.4.2.tar.gz + /usr/bin/tar -xof - + STATUS=0 + '[' 0 -ne 0 ']' + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + mv google-apputils-0.4.2 python2 + find -name '*.py' + xargs sed -i '/^#!\/usr\/bin\/.*python/d' + sed -i -e 's/pytz>.*"/pytz"/' python2/setup.py + cp -a python2 python3 + 2to3 --write --nobackups python3 RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored python3/ez_setup.py RefactoringTool: No changes to python3/setup.py RefactoringTool: No changes to python3/google/__init__.py RefactoringTool: No changes to python3/google/apputils/__init__.py RefactoringTool: Refactored python3/google/apputils/app.py RefactoringTool: Refactored python3/google/apputils/appcommands.py RefactoringTool: Refactored python3/google/apputils/basetest.py --- python3/ez_setup.py (original) +++ python3/ez_setup.py (refactored) @@ -42,10 +42,10 @@ if egg_name in md5_data: digest = md5(data).hexdigest() if digest != md5_data[egg_name]: - print >>sys.stderr, ( + print(( "md5 validation of %s failed! (Possible download problem?)" % egg_name - ) + ), file=sys.stderr) sys.exit(2) return data @@ -75,14 +75,14 @@ return do_download() try: pkg_resources.require("setuptools>="+version); return - except pkg_resources.VersionConflict, e: + except pkg_resources.VersionConflict as e: if was_imported: - print >>sys.stderr, ( + print(( "The required version of setuptools (>=%s) is not available, and\n" "can't be installed while this script is running. Please install\n" " a more recent version first, using 'easy_install -U setuptools'." "\n\n(Currently using %r)" - ) % (version, e.args[0]) + ) % (version, e.args[0]), file=sys.stderr) sys.exit(2) except pkg_resources.DistributionNotFound: pass @@ -101,7 +101,7 @@ with a '/'). `to_dir` is the directory where the egg will be downloaded. `delay` is the number of seconds to pause before an actual download attempt. """ - import urllib2, shutil + import urllib.request, urllib.error, urllib.parse, shutil egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3]) url = download_base + egg_name saveto = os.path.join(to_dir, egg_name) @@ -127,7 +127,7 @@ version, download_base, delay, url ); from time import sleep; sleep(delay) log.warn("Downloading %s", url) - src = urllib2.urlopen(url) + src = urllib.request.urlopen(url) # Read/write all in one block, so we don't create a corrupt file # if the download is interrupted. data = _validate_md5(egg_name, src.read()) @@ -188,10 +188,10 @@ os.unlink(egg) else: if setuptools.__version__ == '0.0.1': - print >>sys.stderr, ( + print(( "You have an obsolete version of setuptools installed. Please\n" "remove it from your system entirely before rerunning this script." - ) + ), file=sys.stderr) sys.exit(2) req = "setuptools>="+version @@ -210,8 +210,8 @@ from setuptools.command.easy_install import main main(argv) else: - print "Setuptools version",version,"or greater has been installed." - print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' + print("Setuptools version",version,"or greater has been installed.") + print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)') def update_md5(filenames): """Update our built-in md5 registry""" @@ -224,7 +224,7 @@ md5_data[base] = md5(f.read()).hexdigest() f.close() - data = [" %r: %r,\n" % it for it in md5_data.items()] + data = [" %r: %r,\n" % it for it in list(md5_data.items())] data.sort() repl = "".join(data) @@ -234,7 +234,7 @@ match = re.search("\nmd5_data = {\n([^}]+)}", src) if not match: - print >>sys.stderr, "Internal error!" + print("Internal error!", file=sys.stderr) sys.exit(2) src = src[:match.start(1)] + repl + src[match.end(1):] --- python3/google/apputils/app.py (original) +++ python3/google/apputils/app.py (refactored) @@ -90,8 +90,8 @@ if arg: usage(shorthelp=1, writeto_stdout=1) # Advertise --helpfull on stdout, since usage() was on stdout. - print - print 'Try --helpfull to get a list of all flags.' + print() + print('Try --helpfull to get a list of all flags.') sys.exit(1) @@ -145,7 +145,7 @@ try: argv = FLAGS(args) return argv - except flags.FlagsError, error: + except flags.FlagsError as error: sys.stderr.write('FATAL Flags parsing error: %s\n' % error) sys.stderr.write('Pass --helpshort or --helpfull to see help on flags.\n') sys.exit(1) @@ -217,7 +217,7 @@ sys.exit(retval) else: sys.exit(main(argv)) - except UsageError, error: + except UsageError as error: usage(shorthelp=1, detailed_error=error, exitcode=error.exitcode) except: if FLAGS.pdb_post_mortem: @@ -264,9 +264,9 @@ try: really_start() - except SystemExit, e: + except SystemExit as e: raise - except Exception, e: + except Exception as e: # Call any installed exception handlers which may, for example, # log to a file or send email. for handler in EXCEPTION_HANDLERS: @@ -322,7 +322,7 @@ stdfile.write('\n') if detailed_error is not None: stdfile.write('\n%s\n' % detailed_error) - except IOError, e: + except IOError as e: # We avoid printing a huge backtrace if we get EPIPE, because # "foo.par --help | less" is a frequent use case. if e.errno != errno.EPIPE: --- python3/google/apputils/appcommands.py (original) +++ python3/google/apputils/appcommands.py (refactored) @@ -175,7 +175,7 @@ def GetFullCommandList(): """Return list of registered commands, including aliases.""" all_cmds = dict(GetCommandList()) - for cmd_alias, cmd_name in GetCommandAliasList().iteritems(): + for cmd_alias, cmd_name in GetCommandAliasList().items(): all_cmds[cmd_alias] = all_cmds.get(cmd_name) return all_cmds @@ -295,7 +295,7 @@ else: assert isinstance(ret, int) return ret - except app.UsageError, error: + except app.UsageError as error: app.usage(shorthelp=1, detailed_error=error, exitcode=error.exitcode) except: if FLAGS.pdb_post_mortem: @@ -622,7 +622,7 @@ else: # Show list of commands if show_cmd is None or show_cmd == 'help': - cmd_names = GetCommandList().keys() + cmd_names = list(GetCommandList().keys()) cmd_names.sort() stdfile.write('Any of the following commands:\n') doc = ', '.join(cmd_names) @@ -634,7 +634,7 @@ elif FLAGS.help or FLAGS.helpshort or shorthelp: cmd_names = [] else: - cmd_names = GetCommandList().keys() # show all commands + cmd_names = list(GetCommandList().keys()) # show all commands cmd_names.sort() # Show the command help (none, one specific, or all) for name in cmd_names: @@ -702,7 +702,7 @@ try: _cmd_argv = FLAGS(argv) return _cmd_argv - except flags.FlagsError, error: + except flags.FlagsError as error: ShortHelpAndExit('FATAL Flags parsing error: %s' % error) @@ -757,9 +757,9 @@ try: sys.modules['__main__'].main(GetCommandArgv()) # If sys.exit was called, return with error code. - except SystemExit, e: + except SystemExit as e: sys.exit(e.code) - except Exception, error: + except Exception as error: traceback.print_exc() # Print a backtrace to stderr. ShortHelpAndExit('\nFATAL error in main: %s' % error) --- python3/google/apputils/basetest.py (original) +++ python3/google/apputils/basetest.py (refactored) @@ -33,7 +33,7 @@ import tempfile import types import unittest -import urlparse +import urllib.parse try: import faulthandler # pylint: disable=g-import-not-at-top @@ -348,8 +348,8 @@ # Fail on strings: empirically, passing strings to this test method # is almost always a bug. If comparing the character sets of two strings # is desired, cast the inputs to sets or lists explicitly. - if (isinstance(expected_seq, basestring) or - isinstance(actual_seq, basestring)): + if (isinstance(expected_seq, str) or + isinstance(actual_seq, str)): self.fail('Passing a string to assertSameElements is usually a bug. ' 'Did you mean to use assertEqual?\n' 'Expected: %s\nActual: %s' % (expected_seq, actual_seq)) @@ -380,9 +380,9 @@ # has a different error format. However, I find this slightly more readable. def assertMultiLineEqual(self, first, second, msg=None): """Assert that two multi-line strings are equal.""" - assert isinstance(first, types.StringTypes), ( + assert isinstance(first, (str,)), ( 'First argument is not a string: %r' % (first,)) - assert isinstance(second, types.StringTypes), ( + assert isinstance(second, (str,)), ( 'Second argument is not a string: %r' % (second,)) if first == second: @@ -401,8 +401,8 @@ """Asserts that value is between minv and maxv (inclusive).""" if msg is None: msg = '"%r" unexpectedly not between "%r" and "%r"' % (value, minv, maxv) - self.assert_(minv <= value, msg) - self.assert_(maxv >= value, msg) + self.assertTrue(minv <= value, msg) + self.assertTrue(maxv >= value, msg) def assertRegexMatch(self, actual_str, regexes, message=None): # pylint: disable=g-doc-bad-indent @@ -438,7 +438,7 @@ message: The message to be printed if the test fails. """ # pylint: enable=g-doc-bad-indent - if isinstance(regexes, basestring): + if isinstance(regexes, str): self.fail('regexes is a string; use assertRegexpMatches instead.') if not regexes: self.fail('No regexes specified.') @@ -448,15 +448,15 @@ if type(regex) is not regex_type: self.fail('regexes list must all be the same type.') - if regex_type is bytes and isinstance(actual_str, unicode): + if regex_type is bytes and isinstance(actual_str, str): regexes = [regex.decode('utf-8') for regex in regexes] - regex_type = unicode - elif regex_type is unicode and isinstance(actual_str, bytes): + regex_type = str + elif regex_type is str and isinstance(actual_str, bytes): regexes = [regex.encode('utf-8') for regex in regexes] regex_type = bytes - if regex_type is unicode: - regex = u'(?:%s)' % u')|(?:'.join(regexes) + if regex_type is str: + regex = '(?:%s)' % ')|(?:'.join(regexes) elif regex_type is bytes: regex = b'(?:' + (b')|(?:'.join(regexes)) + b')' else: @@ -481,7 +481,7 @@ # Accommodate code which listed their output regexes w/o the b'' prefix by # converting them to bytes for the user. - if isinstance(regexes[0], unicode): + if isinstance(regexes[0], str): regexes = [regex.encode('utf-8') for regex in regexes] command_string = GetCommandString(command) @@ -519,7 +519,7 @@ # Accommodate code which listed their output regexes w/o the b'' prefix by # converting them to bytes for the user. - if isinstance(regexes[0], unicode): + if isinstance(regexes[0], str): regexes = [regex.encode('utf-8') for regex in regexes] command_string = GetCommandString(command) @@ -578,7 +578,7 @@ """ # pylint: enable=g-doc-args def Check(err): - self.assert_(predicate(err), + self.assertTrue(predicate(err), '%r does not match predicate %r' % (err, predicate)) context = self._AssertRaisesContext(expected_exception, self, Check) @@ -617,7 +617,7 @@ # pylint: enable=g-doc-args def Check(err): actual_exception_message = str(err) - self.assert_(expected_exception_message == actual_exception_message, + self.assertTrue(expected_exception_message == actual_exception_message, 'Exception message does not match.\n' 'Expected: %r\n' 'Actual: %r' % (expected_exception_message, @@ -653,7 +653,7 @@ """ # pylint: enable=g-doc-args # TODO(user): this is a good candidate for a global search-and-replace. - return self.assertRaisesRegexp(expected_exception, expected_regexp, + return self.assertRaisesRegex(expected_exception, expected_regexp, callable_obj, *args, **kwargs) def assertContainsInOrder(self, strings, target): @@ -823,8 +823,8 @@ if a == b: return - a_items = Sorted(list(a.iteritems())) - b_items = Sorted(list(b.iteritems())) + a_items = Sorted(list(a.items())) + b_items = Sorted(list(b.items())) unexpected = [] missing = [] @@ -837,7 +837,7 @@ # Sort the entries based on their repr, not based on their sort order, # which will be non-deterministic across executions, for many types. entries = sorted((safe_repr(k), safe_repr(v)) - for k, v in dikt.iteritems()) + for k, v in dikt.items()) return '{%s}' % (', '.join('%s: %s' % pair for pair in entries)) message = ['%s != %s%s' % (Repr(a), Repr(b), ' (%s)' % msg if msg else '')] @@ -875,8 +875,8 @@ def assertUrlEqual(self, a, b): """Asserts that urls are equal, ignoring ordering of query params.""" - parsed_a = urlparse.urlparse(a) - parsed_b = urlparse.urlparse(b) + parsed_a = urllib.parse.urlparse(a) + parsed_b = urllib.parse.urlparse(b) self.assertEqual(parsed_a.scheme, parsed_b.scheme) self.assertEqual(parsed_a.netloc, parsed_b.netloc) self.assertEqual(parsed_a.path, parsed_b.path) @@ -884,8 +884,8 @@ self.assertEqual(sorted(parsed_a.params.split(';')), sorted(parsed_b.params.split(';'))) self.assertDictEqual( - urlparse.parse_qs(parsed_a.query, keep_blank_values=True), - urlparse.parse_qs(parsed_b.query, keep_blank_values=True)) + urllib.parse.parse_qs(parsed_a.query, keep_blank_values=True), + urllib.parse.parse_qs(parsed_b.query, keep_blank_values=True)) def assertSameStructure(self, a, b, aname='a', bname='b', msg=None): """Asserts that two values contain the same structural content. @@ -1059,7 +1059,7 @@ # Open file to save stream to cap_fd = os.open(self._filename, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, - 0600) + 0o600) # Send stream to this file self._stream.flush() @@ -1074,7 +1074,7 @@ # Append stream to file cap_fd = os.open(self._filename, os.O_CREAT | os.O_APPEND | os.O_WRONLY, - 0600) + 0o600) # Send stream to this file self._stream.flush() @@ -1105,7 +1105,7 @@ stream: Should be sys.stdout or sys.stderr. filename: File where output should be stored. """ - assert not _captured_streams.has_key(stream) + assert stream not in _captured_streams _captured_streams[stream] = CapturedStream(stream, filename) @@ -1115,8 +1115,8 @@ Args: stream: Should be sys.stdout or sys.stderr. """ - assert _captured_streams.has_key(stream) - for cap_stream in _captured_streams.itervalues(): + assert stream in _captured_streams + for cap_stream in _captured_streams.values(): cap_stream.StopCapture() @@ -1136,7 +1136,7 @@ # remove the current stream del _captured_streams[stream] # restore other stream capture - for cap_stream in _captured_streams.itervalues(): + for cap_stream in _captured_streams.values(): cap_stream.RestartCapture() @@ -1257,7 +1257,7 @@ os.close(fd) -_INT_TYPES = (int, long) # Sadly there is no types.IntTypes defined for us. +_INT_TYPES = (int, int) # Sadly there is no types.IntTypes defined for us. def _WalkStructureForProblems(a, b, aname, bname, problem_list): @@ -1284,15 +1284,15 @@ problem_list.append('%s lacks [%r] but %s has it' % (aname, k, bname)) # Strings are Sequences but we'll just do those with regular != - elif isinstance(a, collections.Sequence) and not isinstance(a, basestring): + elif isinstance(a, collections.Sequence) and not isinstance(a, str): minlen = min(len(a), len(b)) - for i in xrange(minlen): + for i in range(minlen): _WalkStructureForProblems(a[i], b[i], '%s[%d]' % (aname, i), '%s[%d]' % (bname, i), problem_list) - for i in xrange(minlen, len(a)): + for i in range(minlen, len(a)): problem_list.append('%s has [%i] but %s does not' % (aname, i, bname)) - for i in xrange(minlen, len(b)): + for i in range(minlen, len(b)): problem_list.append('%s lacks [%i] but %s has it' % (aname, i, bname))RefactoringTool: No changes to python3/google/apputils/datelib.py RefactoringTool: No changes to python3/google/apputils/debug.py RefactoringTool: Refactored python3/google/apputils/file_util.py RefactoringTool: Refactored python3/google/apputils/humanize.py RefactoringTool: No changes to python3/google/apputils/resources.py RefactoringTool: Refactored python3/google/apputils/run_script_module.py RefactoringTool: Refactored python3/google/apputils/setup_command.py RefactoringTool: No changes to python3/google/apputils/shellutil.py RefactoringTool: Refactored python3/google/apputils/stopwatch.py RefactoringTool: No changes to python3/tests/app_test.py RefactoringTool: No changes to python3/tests/app_test_helper.py RefactoringTool: Refactored python3/tests/appcommands_example.py else: @@ -1380,7 +1380,7 @@ Returns: A string suitable for use as a shell command. """ - if isinstance(command, types.StringTypes): + if isinstance(command, (str,)): return command else: return shellutil.ShellEscapeList(command) @@ -1404,7 +1404,7 @@ if os.environ.get('PYTHON_RUNFILES') and not env.get('PYTHON_RUNFILES'): env['PYTHON_RUNFILES'] = os.environ['PYTHON_RUNFILES'] - use_shell = isinstance(command, types.StringTypes) + use_shell = isinstance(command, (str,)) process = subprocess.Popen( command, close_fds=close_fds, @@ -1540,7 +1540,7 @@ # Save command-line flags so the side effects of FLAGS(sys.argv) can be # undone. saved_flags = dict((f.name, SavedFlag(f)) - for f in FLAGS.FlagDict().itervalues()) + for f in FLAGS.FlagDict().values()) # Here we'd like to change the default of alsologtostderr from False to # True, so the test programs's stderr will contain all the log messages. @@ -1577,7 +1577,7 @@ # after the command-line has been parsed. So we have the for loop below # to change back flags to their old values. argv = FLAGS(sys.argv) - for saved_flag in saved_flags.itervalues(): + for saved_flag in saved_flags.values(): saved_flag.RestoreFlag() --- python3/google/apputils/file_util.py (original) +++ python3/google/apputils/file_util.py (refactored) @@ -41,7 +41,7 @@ return fp.read() -def Write(filename, contents, overwrite_existing=True, mode=0666, gid=None): +def Write(filename, contents, overwrite_existing=True, mode=0o666, gid=None): """Create a file 'filename' with 'contents', with the mode given in 'mode'. The 'mode' is modified by the umask, as in open(2). If @@ -69,7 +69,7 @@ os.chown(filename, -1, gid) -def AtomicWrite(filename, contents, mode=0666, gid=None): +def AtomicWrite(filename, contents, mode=0o666, gid=None): """Create a file 'filename' with 'contents' atomically. As in Write, 'mode' is modified by the umask. This creates and moves @@ -96,10 +96,10 @@ if gid is not None: os.chown(tmp_filename, -1, gid) os.rename(tmp_filename, filename) - except OSError, exc: + except OSError as exc: try: os.remove(tmp_filename) - except OSError, e: + except OSError as e: exc = OSError('%s. Additional errors cleaning up: %s' % (exc, e)) raise exc @@ -157,7 +157,7 @@ finally: try: shutil.rmtree(temp_dir_path) - except OSError, e: + except OSError as e: if e.message == 'Cannot call rmtree on a symbolic link': # Interesting synthetic exception made up by shutil.rmtree. # Means we received a symlink from mkdtemp. @@ -192,7 +192,7 @@ # only chmod if we created if force_mode is not None: os.chmod(path, force_mode) - except OSError, exc: + except OSError as exc: if not (exc.errno == errno.EEXIST and os.path.isdir(path)): raise @@ -208,7 +208,7 @@ """ try: shutil.rmtree(dir_name) - except OSError, err: + except OSError as err: if err.errno != errno.ENOENT: raise @@ -217,12 +217,12 @@ while parent_directory: try: os.rmdir(parent_directory) - except OSError, err: + except OSError as err: if err.errno != errno.ENOENT: raise parent_directory = os.path.dirname(parent_directory) - except OSError, err: + except OSError as err: if err.errno not in (errno.EACCES, errno.ENOTEMPTY, errno.EPERM): raise --- python3/google/apputils/humanize.py (original) +++ python3/google/apputils/humanize.py (refactored) @@ -261,7 +261,7 @@ # Prefixes and corresponding min_scale and max_scale for decimal formating. -DECIMAL_PREFIXES = ('y', 'z', 'a', 'f', 'p', 'n', u'µ', 'm', +DECIMAL_PREFIXES = ('y', 'z', 'a', 'f', 'p', 'n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') DECIMAL_MIN_SCALE = -8 DECIMAL_MAX_SCALE = 8 @@ -342,9 +342,9 @@ # Contains the fractions where the full range [1/n ... (n - 1) / n] # is defined in Unicode. FRACTIONS = { - 3: (None, u'⅓', u'⅔', None), - 5: (None, u'⅕', u'⅖', u'⅗', u'⅘', None), - 8: (None, u'⅛', u'¼', u'⅜', u'½', u'⅝', u'¾', u'⅞', None), + 3: (None, '⅓', '⅔', None), + 5: (None, '⅕', '⅖', '⅗', '⅘', None), + 8: (None, '⅛', '¼', '⅜', '½', '⅝', '¾', '⅞', None), } FRACTION_ROUND_DOWN = 1.0 / (max(FRACTIONS.keys()) * 2.0) @@ -369,25 +369,25 @@ """ # We do not want small negative numbers to display as -0. if number < -FRACTION_ROUND_DOWN: - return u'-%s' % PrettyFraction(-number) + return '-%s' % PrettyFraction(-number) number = abs(number) rounded = int(number) fract = number - rounded if fract >= FRACTION_ROUND_UP: return str(rounded + 1) errors_fractions = [] - for denominator, fraction_elements in FRACTIONS.items(): + for denominator, fraction_elements in list(FRACTIONS.items()): numerator = int(round(denominator * fract)) error = abs(fract - (float(numerator) / float(denominator))) errors_fractions.append((error, fraction_elements[numerator])) unused_error, fraction_text = min(errors_fractions) if rounded and fraction_text: - return u'%d%s%s' % (rounded, spacer, fraction_text) + return '%d%s%s' % (rounded, spacer, fraction_text) if rounded: return str(rounded) if fraction_text: return fraction_text - return u'0' + return '0' def Duration(duration, separator=' '): --- python3/google/apputils/run_script_module.py (original) +++ python3/google/apputils/run_script_module.py (refactored) @@ -118,7 +118,7 @@ def PrintOurUsage(): """Print usage for the stub script.""" - print 'Stub script %s (auto-generated). Options:' % sys.argv[0] + print('Stub script %s (auto-generated). Options:' % sys.argv[0]) print ('--helpstub ' 'Show help for stub script.') print ('--debug_binary ' @@ -203,8 +203,8 @@ args = [sys.executable] + args if show_command_and_exit: - print 'program: "%s"' % program - print 'args:', args + print('program: "%s"' % program) + print('args:', args) sys.exit(0) try: --- python3/google/apputils/setup_command.py (original) +++ python3/google/apputils/setup_command.py (refactored) @@ -125,7 +125,7 @@ sys.argv = [module.__file__] + self.test_args # Late import since this must be run with the project's sys.path. - import basetest + from . import basetest try: try: sys.stderr.write('Testing %s\n' % module_name) --- python3/google/apputils/stopwatch.py (original) +++ python3/google/apputils/stopwatch.py (refactored) @@ -45,7 +45,7 @@ all_this. """ -import StringIO +import io import time @@ -149,7 +149,7 @@ if total == 0.0: return 0.0 - all_timers = sum(self.accum.itervalues()) + all_timers = sum(self.accum.values()) return total - (all_timers - total) def results(self, verbose=False): @@ -165,7 +165,7 @@ """ now = time.time() - all_names = self.accum.keys() + all_names = list(self.accum.keys()) names = [] if 'total' in all_names: @@ -192,7 +192,7 @@ Returns: A string describing the stopwatch. """ - output = StringIO.StringIO() + output = io.StringIO() results = self.results(verbose=verbose) maxlength = max([len(result[0]) for result in results]) for result in results: --- python3/tests/appcommands_example.py (original) +++ python3/tests/appcommands_example.py (refactored) @@ -52,13 +52,13 @@ Returns: Value of flag fail1 """ - print 'Command1' + print('Command1') if FLAGS.hint: - print "Hint1:'%s'" % FLAGS.hint - print "Foo1:'%s'" % FLAGS.foo - print "Bar1:'%s'" % FLAGS.bar + print("Hint1:'%s'" % FLAGS.hint) + print("Foo1:'%s'" % FLAGS.foo) + print("Bar1:'%s'" % FLAGS.bar) if FLAGS.allhelp: - print "AllHelp:'%s'" % self._all_commands_help + print("AllHelp:'%s'" % self._all_commands_help) return FLAGS.fail1 * 1RefactoringTool: Refactored python3/tests/basetest_test.py @@ -82,22 +82,22 @@ Returns: Value of flag fail2 """ - print 'Command2' + print('Command2') if FLAGS.hint: - print "Hint2:'%s'" % FLAGS.hint - print "Foo2:'%s'" % FLAGS.foo - print "Bar2:'%s'" % FLAGS.bar + print("Hint2:'%s'" % FLAGS.hint) + print("Foo2:'%s'" % FLAGS.foo) + print("Bar2:'%s'" % FLAGS.bar) return FLAGS.fail2 * 1 def Test3(unused_argv): """Help for test3.""" - print 'Command3' + print('Command3') def Test4(unused_argv): """Help for test4.""" - print 'Command4' + print('Command4') def main(unused_argv): --- python3/tests/basetest_test.py (original) +++ python3/tests/basetest_test.py (refactored) @@ -180,8 +180,8 @@ def testFlags(self): if FLAGS.testid == 1: self.assertEqual(FLAGS.test_random_seed, 301) - self.assert_(FLAGS.test_tmpdir.startswith('/')) - self.assert_(os.access(FLAGS.test_tmpdir, os.W_OK)) + self.assertTrue(FLAGS.test_tmpdir.startswith('/')) + self.assertTrue(os.access(FLAGS.test_tmpdir, os.W_OK)) elif FLAGS.testid == 2: self.assertEqual(FLAGS.test_random_seed, 321) self.assertEqual(FLAGS.test_srcdir, 'cba') @@ -310,14 +310,14 @@ # Ensure we use equality as the sole measure of elements, not type, since # that is consistent with dict equality. self.assertDictEqual({1: 1.0, 2: 2}, {1: 1, 2: 3}) - except AssertionError, e: + except AssertionError as e: self.assertMultiLineEqual('{1: 1.0, 2: 2} != {1: 1, 2: 3}\n' 'repr() of differing entries:\n2: 2 != 3\n', str(e)) try: self.assertDictEqual({}, {'x': 1}) - except AssertionError, e: + except AssertionError as e: self.assertMultiLineEqual("{} != {'x': 1}\n" "Unexpected, but present entries:\n'x': 1\n", str(e)) @@ -326,7 +326,7 @@ try: self.assertDictEqual({}, {'x': 1}, 'a message') - except AssertionError, e: + except AssertionError as e: self.assertIn('a message', str(e)) else: self.fail('Expecting AssertionError') @@ -335,7 +335,7 @@ seen = {'a': 2, 'c': 3, 'd': 4} try: self.assertDictEqual(expected, seen) - except AssertionError, e: + except AssertionError as e: self.assertMultiLineEqual("""\ {'a': 1, 'b': 2, 'c': 3} != {'a': 2, 'c': 3, 'd': 4} Unexpected, but present entries: @@ -368,19 +368,19 @@ self.assertDictEqual( {'a': Obj('A'), Obj('b'): Obj('B'), Obj('c'): Obj('C')}, {'a': Obj('A'), Obj('d'): Obj('D'), Obj('e'): Obj('E')}) - except AssertionError, e: + except AssertionError as e: # Do as best we can not to be misleading when objects have the same repr # but aren't equal. err_str = str(e) self.assertStartsWith(err_str, "{'a': A, b: B, c: C} != {'a': A, d: D, e: E}\n") - self.assertRegexpMatches(err_str, + self.assertRegex(err_str, r'(?ms).*^Unexpected, but present entries:\s+' r'^(d: D$\s+^e: E|e: E$\s+^d: D)$') - self.assertRegexpMatches(err_str, + self.assertRegex(err_str, r'(?ms).*^repr\(\) of differing entries:\s+' r'^.a.: A != A$', err_str) - self.assertRegexpMatches(err_str, + self.assertRegex(err_str, r'(?ms).*^Missing entries:\s+' r'^(b: B$\s+^c: C|c: C$\s+^b: B)$') else: @@ -403,7 +403,7 @@ # prefix or a basetest_test prefix, so strip that for comparison. error_msg = re.sub( r'( at 0x[^>]+)|__main__\.|basetest_test\.', '', str(e)) - self.assertRegexpMatches(error_msg, """(?m)\ + self.assertRegex(error_msg, """(?m)\ {<.*RaisesOnRepr object.*>: <.*RaisesOnRepr object.*>} != \ {<.*RaisesOnRepr object.*>: <.*RaisesOnRepr object.*>} Unexpected, but present entries: @@ -547,14 +547,14 @@ self.assertNotAlmostEqual(1.0000001, 1.0) def testAssertAlmostEqualsWithDelta(self): - self.assertAlmostEquals(3.14, 3, delta=0.2) - self.assertAlmostEquals(2.81, 3.14, delta=1) - self.assertAlmostEquals(-1, 1, delta=3) - self.assertRaises(AssertionError, self.assertAlmostEquals, + self.assertAlmostEqual(3.14, 3, delta=0.2) + self.assertAlmostEqual(2.81, 3.14, delta=1) + self.assertAlmostEqual(-1, 1, delta=3) + self.assertRaises(AssertionError, self.assertAlmostEqual, 3.14, 2.81, delta=0.1) - self.assertRaises(AssertionError, self.assertAlmostEquals, + self.assertRaises(AssertionError, self.assertAlmostEqual, 1, 2, delta=0.5) - self.assertNotAlmostEquals(3.14, 2.81, delta=0.1) + self.assertNotAlmostEqual(3.14, 2.81, delta=0.1) def testGetCommandString_listOfStringArgument(self): expected = "'command' 'arg-0'" @@ -566,7 +566,7 @@ def testGetCommandString_listOfUnicodeStringArgument(self): expected = "'command' 'arg-0'" - observed = basetest.GetCommandString([u'command', u'arg-0']) + observed = basetest.GetCommandString(['command', 'arg-0']) self.assertEqual(expected, observed) @@ -580,7 +580,7 @@ def testGetCommandString_unicodeStringArgument(self): expected = 'command arg-0' - observed = basetest.GetCommandString(u'command arg-0') + observed = basetest.GetCommandString('command arg-0') self.assertEqual(expected, observed) @@ -637,11 +637,11 @@ def testAssertRegexMatch_unicodeVsBytes(self): """Ensure proper utf-8 encoding or decoding happens automatically.""" - self.assertRegexMatch(u'str', [b'str']) - self.assertRegexMatch(b'str', [u'str']) + self.assertRegexMatch('str', [b'str']) + self.assertRegexMatch(b'str', ['str']) def testAssertRegexMatch_unicode(self): - self.assertRegexMatch(u'foo str', [u'str']) + self.assertRegexMatch('foo str', ['str']) def testAssertRegexMatch_bytes(self): self.assertRegexMatch(b'foo str', [b'str']) @@ -649,7 +649,7 @@ def testAssertRegexMatch_allTheSameType(self): self.assertRaisesWithRegexpMatch( AssertionError, 'regexes .* same type', - self.assertRegexMatch, 'foo str', [b'str', u'foo']) + self.assertRegexMatch, 'foo str', [b'str', 'foo']) def testAssertCommandFailsStderr(self): # TODO(user): Gross! These should use sys.executable instead of @@ -662,13 +662,13 @@ self.assertCommandFails(['false'], ['']) def testAssertCommandFailsWithListOfUnicodeString(self): - self.assertCommandFails([u'false'], ['']) + self.assertCommandFails(['false'], ['']) def testAssertCommandFailsWithUnicodeString(self): - self.assertCommandFails(u'false', [u'']) + self.assertCommandFails('false', ['']) def testAssertCommandFailsWithUnicodeStringBytesRegex(self): - self.assertCommandFails(u'false', [b'']) + self.assertCommandFails('false', [b'']) def testAssertCommandSucceedsStderr(self): expected_re = re.compile(r'(.|\n)*FAIL at -e line 1\.', re.MULTILINE) @@ -680,7 +680,7 @@ ['/usr/bin/perl', '-e', 'die "FAIL";']) def testAssertCommandSucceedsWithMatchingUnicodeRegexes(self): - self.assertCommandSucceeds(['echo', 'SUCCESS'], regexes=[u'SUCCESS']) + self.assertCommandSucceeds(['echo', 'SUCCESS'], regexes=['SUCCESS']) def testAssertCommandSucceedsWithMatchingBytesRegexes(self): self.assertCommandSucceeds(['echo', 'SUCCESS'], regexes=[b'SUCCESS']) @@ -699,10 +699,10 @@ self.assertCommandSucceeds(['true']) def testAssertCommandSucceedsWithListOfUnicodeString(self): - self.assertCommandSucceeds([u'true']) + self.assertCommandSucceeds(['true']) def testAssertCommandSucceedsWithUnicodeString(self): - self.assertCommandSucceeds(u'true') + self.assertCommandSucceeds('true') def testInequality(self): # Try ints @@ -748,44 +748,44 @@ self.assertRaises(AssertionError, self.assertLessEqual, 'bug', 'ant') # Try Unicode - self.assertGreater(u'bug', u'ant') - self.assertGreaterEqual(u'bug', u'ant') - self.assertGreaterEqual(u'ant', u'ant') - self.assertLess(u'ant', u'bug') - self.assertLessEqual(u'ant', u'bug') - self.assertLessEqual(u'ant', u'ant') - self.assertRaises(AssertionError, self.assertGreater, u'ant', u'bug') - self.assertRaises(AssertionError, self.assertGreater, u'ant', u'ant') - self.assertRaises(AssertionError, self.assertGreaterEqual, u'ant', u'bug') - self.assertRaises(AssertionError, self.assertLess, u'bug', u'ant') - self.assertRaises(AssertionError, self.assertLess, u'ant', u'ant') - self.assertRaises(AssertionError, self.assertLessEqual, u'bug', u'ant') + self.assertGreater('bug', 'ant') + self.assertGreaterEqual('bug', 'ant') + self.assertGreaterEqual('ant', 'ant') + self.assertLess('ant', 'bug') + self.assertLessEqual('ant', 'bug') + self.assertLessEqual('ant', 'ant') + self.assertRaises(AssertionError, self.assertGreater, 'ant', 'bug') + self.assertRaises(AssertionError, self.assertGreater, 'ant', 'ant') + self.assertRaises(AssertionError, self.assertGreaterEqual, 'ant', 'bug') + self.assertRaises(AssertionError, self.assertLess, 'bug', 'ant') + self.assertRaises(AssertionError, self.assertLess, 'ant', 'ant') + self.assertRaises(AssertionError, self.assertLessEqual, 'bug', 'ant') # Try Mixed String/Unicode - self.assertGreater('bug', u'ant') - self.assertGreater(u'bug', 'ant') - self.assertGreaterEqual('bug', u'ant') - self.assertGreaterEqual(u'bug', 'ant') - self.assertGreaterEqual('ant', u'ant') - self.assertGreaterEqual(u'ant', 'ant') - self.assertLess('ant', u'bug') - self.assertLess(u'ant', 'bug') - self.assertLessEqual('ant', u'bug') - self.assertLessEqual(u'ant', 'bug') - self.assertLessEqual('ant', u'ant') - self.assertLessEqual(u'ant', 'ant') - self.assertRaises(AssertionError, self.assertGreater, 'ant', u'bug') - self.assertRaises(AssertionError, self.assertGreater, u'ant', 'bug') - self.assertRaises(AssertionError, self.assertGreater, 'ant', u'ant') - self.assertRaises(AssertionError, self.assertGreater, u'ant', 'ant') - self.assertRaises(AssertionError, self.assertGreaterEqual, 'ant', u'bug') - self.assertRaises(AssertionError, self.assertGreaterEqual, u'ant', 'bug') - self.assertRaises(AssertionError, self.assertLess, 'bug', u'ant') - self.assertRaises(AssertionError, self.assertLess, u'bug', 'ant') - self.assertRaises(AssertionError, self.assertLess, 'ant', u'ant') - self.assertRaises(AssertionError, self.assertLess, u'ant', 'ant') - self.assertRaises(AssertionError, self.assertLessEqual, 'bug', u'ant') - self.assertRaises(AssertionError, self.assertLessEqual, u'bug', 'ant') + self.assertGreater('bug', 'ant') + self.assertGreater('bug', 'ant') + self.assertGreaterEqual('bug', 'ant') + self.assertGreaterEqual('bug', 'ant') + self.assertGreaterEqual('ant', 'ant') + self.assertGreaterEqual('ant', 'ant') + self.assertLess('ant', 'bug') + self.assertLess('ant', 'bug') + self.assertLessEqual('ant', 'bug') + self.assertLessEqual('ant', 'bug') + self.assertLessEqual('ant', 'ant') + self.assertLessEqual('ant', 'ant') + self.assertRaises(AssertionError, self.assertGreater, 'ant', 'bug') + self.assertRaises(AssertionError, self.assertGreater, 'ant', 'bug') + self.assertRaises(AssertionError, self.assertGreater, 'ant', 'ant') + self.assertRaises(AssertionError, self.assertGreater, 'ant', 'ant') + self.assertRaises(AssertionError, self.assertGreaterEqual, 'ant', 'bug') + self.assertRaises(AssertionError, self.assertGreaterEqual, 'ant', 'bug') + self.assertRaises(AssertionError, self.assertLess, 'bug', 'ant') + self.assertRaises(AssertionError, self.assertLess, 'bug', 'ant') + self.assertRaises(AssertionError, self.assertLess, 'ant', 'ant') + self.assertRaises(AssertionError, self.assertLess, 'ant', 'ant') + self.assertRaises(AssertionError, self.assertLessEqual, 'bug', 'ant') + self.assertRaises(AssertionError, self.assertLessEqual, 'bug', 'ant') def testAssertMultiLineEqual(self): sample_text = """\ @@ -811,8 +811,8 @@ + own implementation that does not subclass from TestCase, of course. """ - for type1 in (str, unicode): - for type2 in (str, unicode): + for type1 in (str, str): + for type2 in (str, str): self.assertRaisesWithLiteralMatch(AssertionError, sample_text_error, self.assertMultiLineEqual, type1(sample_text), @@ -886,12 +886,12 @@ self.assertRaises(AssertionError, self.assertBetween, -1e10000, -1e10, 0) def testAssertRaisesWithPredicateMatch_noRaiseFails(self): - with self.assertRaisesRegexp(AssertionError, '^Exception not raised$'): + with self.assertRaisesRegex(AssertionError, '^Exception not raised$'): self.assertRaisesWithPredicateMatch(Exception, lambda e: True, lambda: 1) # don't raise - with self.assertRaisesRegexp(AssertionError, '^Exception not raised$'): + with self.assertRaisesRegex(AssertionError, '^Exception not raised$'): with self.assertRaisesWithPredicateMatch(Exception, lambda e: True): pass # don't raise @@ -911,12 +911,12 @@ def testAssertRaisesWithPredicateMatch_predicateFails(self): def _RaiseValueError(): raise ValueError - with self.assertRaisesRegexp(AssertionError, ' does not match predicate '): + with self.assertRaisesRegex(AssertionError, ' does not match predicate '): self.assertRaisesWithPredicateMatch(ValueError, lambda e: False, _RaiseValueError) - with self.assertRaisesRegexp(AssertionError, ' does not match predicate '): + with self.assertRaisesRegex(AssertionError, ' does not match predicate '): with self.assertRaisesWithPredicateMatch(ValueError, lambda e: False): raise ValueError @@ -940,7 +940,7 @@ self.assertRaisesWithRegexpMatch(ExceptionMock, re.compile('expect$'), Stub) self.assertRaisesWithRegexpMatch(ExceptionMock, 'expect$', Stub) - self.assertRaisesWithRegexpMatch(ExceptionMock, u'expect$', Stub) + self.assertRaisesWithRegexpMatch(ExceptionMock, 'expect$', Stub) def testAssertNotRaisesWithRegexpMatch(self): self.assertRaisesWithRegexpMatch( @@ -952,7 +952,7 @@ self.assertRaisesWithRegexpMatch, Exception, 'x', lambda: None) self.assertRaisesWithRegexpMatch( AssertionError, '^Exception not raised', - self.assertRaisesWithRegexpMatch, Exception, u'x', lambda: None) + self.assertRaisesWithRegexpMatch, Exception, 'x', lambda: None) def testAssertRaisesWithRegexpMismatch(self): def Stub(): @@ -1105,14 +1105,14 @@ self.assertRaises(AssertionError, self.assertTotallyOrdered, [1, 2]) def testShortDescriptionWithoutDocstring(self): - self.assertEquals( + self.assertEqual( self.shortDescription(), ('testShortDescriptionWithoutDocstring ' '(%s.GoogleTestBaseUnitTest)' % __name__)) def testShortDescriptionWithOneLineDocstring(self): """Tests shortDescription() for a method with a docstring.""" - self.assertEquals( + self.assertEqual( self.shortDescription(), ('testShortDescriptionWithOneLineDocstring ' '(%s.GoogleTestBaseUnitTest)\n' @@ -1125,7 +1125,7 @@ returned used in the short description, no matter how long the whole thing is. """ - self.assertEquals( + self.assertEqual( self.shortDescription(), ('testShortDescriptionWithMultiLineDocstring ' '(%s.GoogleTestBaseUnitTest)\n' @@ -1135,7 +1135,7 @@ def testRecordedProperties(self): """Tests that a test can record a property and then retrieve it.""" self.recordProperty('test_property', 'test_value') - self.assertEquals(self.getRecordedProperties(), + self.assertEqual(self.getRecordedProperties(), {'test_property': 'test_value'}) def testAssertUrlEqualSame(self):RefactoringTool: Refactored python3/tests/datelib_unittest.py RefactoringTool: Refactored python3/tests/file_util_test.py @@ -1184,7 +1184,7 @@ self.assertSameStructure({}, {}) self.assertSameStructure({'one': 1}, {'one': 1}) # int and long should always be treated as the same type. - self.assertSameStructure({3L: 3}, {3: 3L}) + self.assertSameStructure({3: 3}, {3: 3}) def testSameStructure_different(self): # Different type @@ -1404,22 +1404,22 @@ # Compare two distinct objects self.assertFalse(i1 is i2) self.assertRaises(AssertionError, self.assertEqual, i1, i2) - self.assertRaises(AssertionError, self.assertEquals, i1, i2) - self.assertRaises(AssertionError, self.failUnlessEqual, i1, i2) + self.assertRaises(AssertionError, self.assertEqual, i1, i2) + self.assertRaises(AssertionError, self.assertEqual, i1, i2) self.assertRaises(AssertionError, self.assertNotEqual, i1, i2) - self.assertRaises(AssertionError, self.assertNotEquals, i1, i2) - self.assertRaises(AssertionError, self.failIfEqual, i1, i2) + self.assertRaises(AssertionError, self.assertNotEqual, i1, i2) + self.assertRaises(AssertionError, self.assertNotEqual, i1, i2) # A NeverEqual object should not compare equal to itself either. i2 = i1 self.assertTrue(i1 is i2) self.assertFalse(i1 == i2) self.assertFalse(i1 != i2) self.assertRaises(AssertionError, self.assertEqual, i1, i2) - self.assertRaises(AssertionError, self.assertEquals, i1, i2) - self.assertRaises(AssertionError, self.failUnlessEqual, i1, i2) + self.assertRaises(AssertionError, self.assertEqual, i1, i2) + self.assertRaises(AssertionError, self.assertEqual, i1, i2) self.assertRaises(AssertionError, self.assertNotEqual, i1, i2) - self.assertRaises(AssertionError, self.assertNotEquals, i1, i2) - self.assertRaises(AssertionError, self.failIfEqual, i1, i2) + self.assertRaises(AssertionError, self.assertNotEqual, i1, i2) + self.assertRaises(AssertionError, self.assertNotEqual, i1, i2) def testAllComparisonsSucceed(self): a = self.AllSame() @@ -1428,11 +1428,11 @@ self.assertTrue(a == b) self.assertFalse(a != b) self.assertEqual(a, b) - self.assertEquals(a, b) - self.failUnlessEqual(a, b) + self.assertEqual(a, b) + self.assertEqual(a, b) self.assertRaises(AssertionError, self.assertNotEqual, a, b) - self.assertRaises(AssertionError, self.assertNotEquals, a, b) - self.assertRaises(AssertionError, self.failIfEqual, a, b) + self.assertRaises(AssertionError, self.assertNotEqual, a, b) + self.assertRaises(AssertionError, self.assertNotEqual, a, b) def _PerformAppleAppleOrangeChecks(self, same_a, same_b, different): """Perform consistency checks with two apples and an orange. @@ -1449,8 +1449,8 @@ self.assertTrue(same_a == same_b) self.assertFalse(same_a != same_b) self.assertEqual(same_a, same_b) - self.assertEquals(same_a, same_b) - self.failUnlessEqual(same_a, same_b) + self.assertEqual(same_a, same_b) + self.assertEqual(same_a, same_b) if PY_VERSION_2: # Python 3 removes the global cmp function self.assertEqual(0, cmp(same_a, same_b)) @@ -1458,16 +1458,16 @@ self.assertFalse(same_a == different) self.assertTrue(same_a != different) self.assertNotEqual(same_a, different) - self.assertNotEquals(same_a, different) - self.failIfEqual(same_a, different) + self.assertNotEqual(same_a, different) + self.assertNotEqual(same_a, different) if PY_VERSION_2: self.assertNotEqual(0, cmp(same_a, different)) self.assertFalse(same_b == different) self.assertTrue(same_b != different) self.assertNotEqual(same_b, different) - self.assertNotEquals(same_b, different) - self.failIfEqual(same_b, different) + self.assertNotEqual(same_b, different) + self.assertNotEqual(same_b, different) if PY_VERSION_2: self.assertNotEqual(0, cmp(same_b, different)) @@ -1565,7 +1565,7 @@ def __init__(self): # pylint: disable=super-init-not-called pass - Subclass().assertEquals({}, {}) + Subclass().assertEqual({}, {}) def testMultipleInheritance(self): @@ -1577,7 +1577,7 @@ class Subclass(Foo, basetest.TestCase): pass - Subclass().assertEquals({}, {}) + Subclass().assertEqual({}, {}) if __name__ == '__main__': --- python3/tests/datelib_unittest.py (original) +++ python3/tests/datelib_unittest.py (refactored) @@ -37,12 +37,12 @@ def testTzRandomConversion(self): random.seed(self.seed) - for unused_i in xrange(100): + for unused_i in range(100): stz = pytz.timezone(random.choice(pytz.all_timezones)) a = datelib.Timestamp.FromString('2008-04-12T10:00:00', stz) b = a - for unused_j in xrange(100): + for unused_j in range(100): b = b.astimezone(pytz.timezone(random.choice(pytz.all_timezones))) self.assertEqual(a, b) random.seed() @@ -58,7 +58,7 @@ IsEq(datelib.MAXIMUM_MICROSECOND_TIMESTAMP) random.seed(self.seed) - for _ in xrange(100): + for _ in range(100): IsEq(random.randint(0, datelib.MAXIMUM_MICROSECOND_TIMESTAMP)) def testMicroTimestampKnown(self): @@ -79,7 +79,7 @@ datelib.Timestamp.FromMicroTimestamp(b))) random.seed(self.seed) - for unused_i in xrange(100): + for unused_i in range(100): IsEq( random.randint(0, datelib.MAXIMUM_MICROSECOND_TIMESTAMP), random.randint(0, datelib.MAXIMUM_MICROSECOND_TIMESTAMP)) @@ -130,7 +130,7 @@ startdate = datelib.US_PACIFIC.localize( datelib.Timestamp(2009, 1, 1, 3, 0, 0, 0)) - for day in xrange(1, 366): + for day in range(1, 366): self.assertEqual( datelib.Timestamp.FromString(startdate.isoformat()), startdate, @@ -143,7 +143,7 @@ The result shall always be the same as tz.localize(naive_time). """ baseday = datelib.datetime.date(2009, 1, 1).toordinal() - for day_offset in xrange(0, 365): + for day_offset in range(0, 365): day = datelib.datetime.date.fromordinal(baseday + day_offset) naive_day = datelib.datetime.datetime.combine( day, datelib.datetime.time(0, 45, 9)) @@ -183,9 +183,9 @@ self.assertEqual( 0, datelib.DatetimeToUTCMicros(_EpochToDatetime(0))) self.assertEqual( - 1001 * long(datelib._MICROSECONDS_PER_SECOND), + 1001 * int(datelib._MICROSECONDS_PER_SECOND), datelib.DatetimeToUTCMicros(_EpochToDatetime(1001))) - self.assertEqual(long(self.now * datelib._MICROSECONDS_PER_SECOND), + self.assertEqual(int(self.now * datelib._MICROSECONDS_PER_SECOND), datelib.DatetimeToUTCMicros(_EpochToDatetime(self.now))) # tzinfo shouldn't change the result @@ -196,8 +196,8 @@ self.assertEqual( 0, datelib.DatetimeToUTCMillis(_EpochToDatetime(0))) self.assertEqual( - 1001 * 1000L, datelib.DatetimeToUTCMillis(_EpochToDatetime(1001))) - self.assertEqual(long(self.now * 1000), + 1001 * 1000, datelib.DatetimeToUTCMillis(_EpochToDatetime(1001))) + self.assertEqual(int(self.now * 1000), datelib.DatetimeToUTCMillis(_EpochToDatetime(self.now))) # tzinfo shouldn't change the result @@ -209,7 +209,7 @@ self.assertEqual(_EpochToDatetime(1.000001), datelib.UTCMicrosToDatetime(1000001)) self.assertEqual(_EpochToDatetime(self.now), datelib.UTCMicrosToDatetime( - long(self.now * datelib._MICROSECONDS_PER_SECOND))) + int(self.now * datelib._MICROSECONDS_PER_SECOND))) # Check timezone-aware comparisons self.assertEqual(_EpochToDatetime(0, self.pst), @@ -224,7 +224,7 @@ dt = _EpochToDatetime(t) # truncate sub-milli time dt -= datelib.datetime.timedelta(microseconds=dt.microsecond % 1000) - self.assertEqual(dt, datelib.UTCMillisToDatetime(long(t * 1000))) + self.assertEqual(dt, datelib.UTCMillisToDatetime(int(t * 1000))) # Check timezone-aware comparisons self.assertEqual(_EpochToDatetime(0, self.pst), --- python3/tests/file_util_test.py (original) +++ python3/tests/file_util_test.py (refactored) @@ -16,7 +16,7 @@ RefactoringTool: Refactored python3/tests/humanize_test.py RefactoringTool: No changes to python3/tests/resources_test.py RefactoringTool: No changes to python3/tests/sh_test.py RefactoringTool: No changes to python3/tests/shellutil_unittest.py RefactoringTool: No changes to python3/tests/stopwatch_unittest.py RefactoringTool: Files that were modified: RefactoringTool: python3/ez_setup.py RefactoringTool: python3/setup.py RefactoringTool: python3/google/__init__.py RefactoringTool: python3/google/apputils/__init__.py RefactoringTool: python3/google/apputils/app.py RefactoringTool: python3/google/apputils/appcommands.py RefactoringTool: python3/google/apputils/basetest.py RefactoringTool: python3/google/apputils/datelib.py RefactoringTool: python3/google/apputils/debug.py RefactoringTool: python3/google/apputils/file_util.py RefactoringTool: python3/google/apputils/humanize.py RefactoringTool: python3/google/apputils/resources.py RefactoringTool: python3/google/apputils/run_script_module.py RefactoringTool: python3/google/apputils/setup_command.py RefactoringTool: python3/google/apputils/shellutil.py RefactoringTool: python3/google/apputils/stopwatch.py RefactoringTool: python3/tests/app_test.py RefactoringTool: python3/tests/app_test_helper.py RefactoringTool: python3/tests/appcommands_example.py RefactoringTool: python3/tests/basetest_test.py RefactoringTool: python3/tests/datelib_unittest.py RefactoringTool: python3/tests/file_util_test.py RefactoringTool: python3/tests/humanize_test.py RefactoringTool: python3/tests/resources_test.py RefactoringTool: python3/tests/sh_test.py RefactoringTool: python3/tests/shellutil_unittest.py RefactoringTool: python3/tests/stopwatch_unittest.py -import __builtin__ +import builtins import errno import os import posix @@ -64,7 +64,7 @@ file_util.Write(self.file_path, 'original contents') file_util.Write(self.file_path, self.sample_contents) with open(self.file_path) as fp: - self.assertEquals(fp.read(), self.sample_contents) + self.assertEqual(fp.read(), self.sample_contents) def testWriteExclusive(self): file_util.Write(self.file_path, 'original contents') @@ -72,7 +72,7 @@ self.sample_contents, overwrite_existing=False) def testWriteMode(self): - mode = 0744 + mode = 0o744 file_util.Write(self.file_path, self.sample_contents, mode=mode) s = os.stat(self.file_path) self.assertEqual(stat.S_IMODE(s.st_mode), mode) @@ -80,10 +80,10 @@ def testAtomicWriteSuccessful(self): file_util.AtomicWrite(self.file_path, self.sample_contents) with open(self.file_path) as fp: - self.assertEquals(fp.read(), self.sample_contents) + self.assertEqual(fp.read(), self.sample_contents) def testAtomicWriteMode(self): - mode = 0745 + mode = 0o745 file_util.AtomicWrite(self.file_path, self.sample_contents, mode=mode) s = os.stat(self.file_path) self.assertEqual(stat.S_IMODE(s.st_mode), mode) @@ -125,7 +125,7 @@ self.mox.ReplayAll() try: - self.assertEquals(file_util.Read(self.file_path), self.sample_contents) + self.assertEqual(file_util.Read(self.file_path), self.sample_contents) self.mox.VerifyAll() finally: # Because we mock out the built-in open() function, which the unittest @@ -142,7 +142,7 @@ self.mox.StubOutWithMock(os, 'chown') gid = 'new gid' os.open(self.file_path, os.O_WRONLY | os.O_TRUNC | os.O_CREAT, - 0666).AndReturn(self.fd) + 0o666).AndReturn(self.fd) os.write(self.fd, self.sample_contents) os.close(self.fd) os.chown(self.file_path, -1, gid) @@ -211,7 +211,7 @@ file_util.AtomicWrite(self.file_path, self.sample_contents, mode=self.mode) except OSError as e: - self.assertEquals(str(e), + self.assertEqual(str(e), 'A problem renaming!. Additional errors cleaning up: ' 'A problem removing!') else: @@ -244,7 +244,7 @@ temp_dirs = [] self.assertRaises(Exception, Inner, temp_dirs) # Ensure that the directory is removed on exit even when exceptions happen. - self.assertEquals(len(temp_dirs), 1) + self.assertEqual(len(temp_dirs), 1) self.assertFalse(os.path.isdir(temp_dirs[0])) def testTemporaryDirectory(self): @@ -281,10 +281,10 @@ def testNoErrorsAbsoluteOneDirWithForceMode(self): # record, replay os.mkdir('/foo') - os.chmod('/foo', 0707) - self.mox.ReplayAll() - # test, verify - file_util.MkDirs('/foo', force_mode=0707) + os.chmod('/foo', 0o707) + self.mox.ReplayAll() + # test, verify + file_util.MkDirs('/foo', force_mode=0o707) self.mox.VerifyAll() def testNoErrorsExistingDirWithForceMode(self): @@ -295,7 +295,7 @@ os.path.isdir('/foo').AndReturn(True) self.mox.ReplayAll() # test, verify - file_util.MkDirs('/foo', force_mode=0707) + file_util.MkDirs('/foo', force_mode=0o707) self.mox.VerifyAll() def testNoErrorsAbsoluteSlashDot(self): @@ -331,10 +331,10 @@ os.mkdir('/foo').AndRaise(exist_error) # /foo exists os.path.isdir('/foo').AndReturn(True) os.mkdir('/foo/bar') # bar does not - os.chmod('/foo/bar', 0707) - self.mox.ReplayAll() - # test, verify - file_util.MkDirs('/foo/bar', force_mode=0707) + os.chmod('/foo/bar', 0o707) + self.mox.ReplayAll() + # test, verify + file_util.MkDirs('/foo/bar', force_mode=0o707) self.mox.VerifyAll() def testNoErrorsRelativeOneDir(self): --- python3/tests/humanize_test.py (original) +++ python3/tests/humanize_test.py (refactored) @@ -89,7 +89,7 @@ humanize.DecimalPrefix(-0.004, 'm', min_scale=None)) self.assertEqual('0 m', humanize.DecimalPrefix(0, 'm', min_scale=None)) self.assertEqual( - u'1 µs', + '1 µs', humanize.DecimalPrefix(0.0000013, 's', min_scale=None)) self.assertEqual('3 km', humanize.DecimalPrefix(3000, 'm', min_scale=None)) self.assertEqual( @@ -116,7 +116,7 @@ # Test both int and long versions of the same quantity to make sure they are # printed in the same way. self.assertEqual('10.0 QPS', humanize.BinaryPrefix(10, 'QPS', precision=3)) - self.assertEqual('10.0 QPS', humanize.BinaryPrefix(10L, 'QPS', precision=3)) + self.assertEqual('10.0 QPS', humanize.BinaryPrefix(10, 'QPS', precision=3)) def testDecimalScale(self): self.assertIsInstance(humanize.DecimalScale(0, '')[0], float) @@ -136,7 +136,7 @@ self.assertEqual((450, 'mSWE'), humanize.DecimalScale(0.45, 'SWE', min_scale=None)) self.assertEqual( - (250, u'µm'), + (250, 'µm'), humanize.DecimalScale(1.0 / (4 * 1000), 'm', min_scale=None)) self.assertEqual( (0.250, 'km'), @@ -158,31 +158,31 @@ def testPrettyFraction(self): # No rounded integer part - self.assertEqual(u'½', humanize.PrettyFraction(0.5)) + self.assertEqual('½', humanize.PrettyFraction(0.5)) # Roundeded integer + fraction - self.assertEqual(u'6⅔', humanize.PrettyFraction(20.0 / 3.0)) + self.assertEqual('6⅔', humanize.PrettyFraction(20.0 / 3.0)) # Rounded integer, no fraction - self.assertEqual(u'2', humanize.PrettyFraction(2.00001)) + self.assertEqual('2', humanize.PrettyFraction(2.00001)) # No rounded integer, no fraction - self.assertEqual(u'0', humanize.PrettyFraction(0.001)) + self.assertEqual('0', humanize.PrettyFraction(0.001)) # Round up - self.assertEqual(u'1', humanize.PrettyFraction(0.99)) + self.assertEqual('1', humanize.PrettyFraction(0.99)) # No round up, edge case - self.assertEqual(u'⅞', humanize.PrettyFraction(0.9)) + self.assertEqual('⅞', humanize.PrettyFraction(0.9)) # Negative fraction - self.assertEqual(u'-⅕', humanize.PrettyFraction(-0.2)) + self.assertEqual('-⅕', humanize.PrettyFraction(-0.2)) # Negative close to zero (should not be -0) - self.assertEqual(u'0', humanize.PrettyFraction(-0.001)) + self.assertEqual('0', humanize.PrettyFraction(-0.001)) # Smallest fraction that should round down. - self.assertEqual(u'0', humanize.PrettyFraction(1.0 / 16.0)) + self.assertEqual('0', humanize.PrettyFraction(1.0 / 16.0)) # Largest fraction should round up. - self.assertEqual(u'1', humanize.PrettyFraction(15.0 / 16.0)) + self.assertEqual('1', humanize.PrettyFraction(15.0 / 16.0)) # Integer zero. - self.assertEqual(u'0', humanize.PrettyFraction(0)) + self.assertEqual('0', humanize.PrettyFraction(0)) # Check that division yields fraction - self.assertEqual(u'⅘', humanize.PrettyFraction(4.0 / 5.0)) + self.assertEqual('⅘', humanize.PrettyFraction(4.0 / 5.0)) # Custom spacer. - self.assertEqual(u'2 ½', humanize.PrettyFraction(2.5, spacer=' ')) + self.assertEqual('2 ½', humanize.PrettyFraction(2.5, spacer=' ')) def testDuration(self): self.assertEqual('2h', humanize.Duration(7200)) + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.ESfIrc + umask 022 + cd /builddir/build/BUILD ~/build/BUILD/python-google-apputils-0.4.2/python2 ~/build/BUILD/python-google-apputils-0.4.2 ~/build/BUILD/python-google-apputils-0.4.2 ~/build/BUILD/python-google-apputils-0.4.2/python3 ~/build/BUILD/python-google-apputils-0.4.2 + cd python-google-apputils-0.4.2 + pushd python2 + popd + pushd python3 + /usr/libexec/platform-python setup.py build running build running build_py creating build creating build/lib creating build/lib/google copying google/__init__.py -> build/lib/google creating build/lib/google/apputils copying google/apputils/setup_command.py -> build/lib/google/apputils copying google/apputils/humanize.py -> build/lib/google/apputils copying google/apputils/run_script_module.py -> build/lib/google/apputils copying google/apputils/basetest.py -> build/lib/google/apputils copying google/apputils/datelib.py -> build/lib/google/apputils copying google/apputils/__init__.py -> build/lib/google/apputils copying google/apputils/file_util.py -> build/lib/google/apputils copying google/apputils/appcommands.py -> build/lib/google/apputils copying google/apputils/app.py -> build/lib/google/apputils copying google/apputils/resources.py -> build/lib/google/apputils copying google/apputils/debug.py -> build/lib/google/apputils copying google/apputils/shellutil.py -> build/lib/google/apputils copying google/apputils/stopwatch.py -> build/lib/google/apputils + popd ~/build/BUILD/python-google-apputils-0.4.2 + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.iKidfe + umask 022 + cd /builddir/build/BUILD + '[' /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64 '!=' / ']' + rm -rf /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64 ++ dirname /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64 + mkdir -p /builddir/build/BUILDROOT + mkdir /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64 + cd python-google-apputils-0.4.2 ~/build/BUILD/python-google-apputils-0.4.2/python3 ~/build/BUILD/python-google-apputils-0.4.2 + pushd python3 + /usr/libexec/platform-python setup.py install --skip-build --root /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64 running install running install_lib Skipping installation of /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/__init__.py (namespace package) copying google/apputils/stopwatch.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/shellutil.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/debug.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/resources.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/app.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/appcommands.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/file_util.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/__init__.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/datelib.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/basetest.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/run_script_module.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/humanize.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils copying google/apputils/setup_command.py -> /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/stopwatch.py to stopwatch.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/shellutil.py to shellutil.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/debug.py to debug.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/resources.py to resources.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/app.py to app.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/appcommands.py to appcommands.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/file_util.py to file_util.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/__init__.py to __init__.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/datelib.py to datelib.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/basetest.py to basetest.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/run_script_module.py to run_script_module.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/humanize.py to humanize.cpython-36.pyc byte-compiling /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google/apputils/setup_command.py to setup_command.cpython-36.pyc running install_egg_info running egg_info writing google_apputils.egg-info/PKG-INFO writing dependency_links to google_apputils.egg-info/dependency_links.txt writing entry points to google_apputils.egg-info/entry_points.txt writing namespace_packages to google_apputils.egg-info/namespace_packages.txt writing requirements to google_apputils.egg-info/requires.txt writing top-level names to google_apputils.egg-info/top_level.txt reading manifest file 'google_apputils.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'google_apputils.egg-info/SOURCES.txt' Copying google_apputils.egg-info to /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google_apputils-0.4.2-py3.6.egg-info Installing /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6/site-packages/google_apputils-0.4.2-py3.6-nspkg.pth running install_scripts + popd ~/build/BUILD/python-google-apputils-0.4.2 ~/build/BUILD/python-google-apputils-0.4.2/python2 ~/build/BUILD/python-google-apputils-0.4.2 ~/build/BUILD/python-google-apputils-0.4.2 + pushd python2 + popd + /usr/lib/rpm/find-debuginfo.sh -j10 --strict-build-id -m -i --build-id-seed 0.4.2-18.el8 --unique-debug-suffix -0.4.2-18.el8.aarch64 --unique-debug-src-base python-google-apputils-0.4.2-18.el8.aarch64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 50000000 -S debugsourcefiles.list /builddir/build/BUILD/python-google-apputils-0.4.2 find: 'debug': No such file or directory + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-ldconfig /sbin/ldconfig: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf: No such file or directory + /usr/lib/rpm/brp-compress + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/brp-python-bytecompile 1 Bytecompiling .py files below /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/lib/python3.6 using /usr/libexec/platform-python + /usr/lib/rpm/brp-python-hardlink + PYTHON3=/usr/libexec/platform-python + /usr/lib/rpm/redhat/brp-mangle-shebangs Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.prtPid + umask 022 + cd /builddir/build/BUILD ~/build/BUILD/python-google-apputils-0.4.2/python2 ~/build/BUILD/python-google-apputils-0.4.2 ~/build/BUILD/python-google-apputils-0.4.2 Processing files: python3-google-apputils-0.4.2-18.el8.noarch + cd python-google-apputils-0.4.2 + pushd python2 + popd + exit 0 Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.q9vueg + umask 022 + cd /builddir/build/BUILD + cd python-google-apputils-0.4.2 + DOCDIR=/builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/share/doc/python-google-apputils + export LC_ALL=C + LC_ALL=C + export DOCDIR + /usr/bin/mkdir -p /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/share/doc/python-google-apputils + cp -pr python3/README /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/share/doc/python-google-apputils + exit 0 Executing(%license): /bin/sh -e /var/tmp/rpm-tmp.VqN7Th + umask 022 + cd /builddir/build/BUILD + cd python-google-apputils-0.4.2 + LICENSEDIR=/builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/share/licenses/python-google-apputils + export LC_ALL=C + LC_ALL=C + export LICENSEDIR + /usr/bin/mkdir -p /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/share/licenses/python-google-apputils + cp -pr python3/LICENSE /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64/usr/share/licenses/python-google-apputils + exit 0 Provides: python3-google-apputils = 0.4.2-18.el8 python3.6dist(google-apputils) = 0.4.2 python3dist(google-apputils) = 0.4.2 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.6 Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64 Wrote: /builddir/build/RPMS/python3-google-apputils-0.4.2-18.el8.noarch.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.W8CEmd + umask 022 + cd /builddir/build/BUILD + cd python-google-apputils-0.4.2 + /usr/bin/rm -rf /builddir/build/BUILDROOT/python-google-apputils-0.4.2-18.el8.aarch64 + exit 0 Child return code was: 0