Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-autopep8 for openSUSE:Factory checked in at 2021-05-12 19:31:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-autopep8 (Old) and /work/SRC/openSUSE:Factory/.python-autopep8.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-autopep8" Wed May 12 19:31:50 2021 rev:22 rq:892298 version:1.5.7 Changes: -------- --- /work/SRC/openSUSE:Factory/python-autopep8/python-autopep8.changes 2021-04-10 15:28:06.994430633 +0200 +++ /work/SRC/openSUSE:Factory/.python-autopep8.new.2988/python-autopep8.changes 2021-05-12 19:32:18.603018945 +0200 @@ -1,0 +2,9 @@ +Tue May 11 21:16:05 UTC 2021 - Dirk M??ller <dmuel...@suse.com> + +- update to 1.5.7: + * python 3.9 + * disallow 0 for indent-size option + * exit code is 99 when error occured cli option parsing + * exit code correctly on permission denied failure + +------------------------------------------------------------------- Old: ---- autopep8-1.5.6.tar.gz New: ---- autopep8-1.5.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-autopep8.spec ++++++ --- /var/tmp/diff_new_pack.4OtDS7/_old 2021-05-12 19:32:19.051017156 +0200 +++ /var/tmp/diff_new_pack.4OtDS7/_new 2021-05-12 19:32:19.055017140 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-autopep8 -Version: 1.5.6 +Version: 1.5.7 Release: 0 Summary: Automatic generated to pep8 checked code License: MIT ++++++ autopep8-1.5.6.tar.gz -> autopep8-1.5.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.6/PKG-INFO new/autopep8-1.5.7/PKG-INFO --- old/autopep8-1.5.6/PKG-INFO 2021-03-16 16:01:32.000000000 +0100 +++ new/autopep8-1.5.7/PKG-INFO 2021-04-30 08:04:38.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: autopep8 -Version: 1.5.6 +Version: 1.5.7 Summary: A tool that automatically formats Python code to conform to the PEP 8 style guide Home-page: https://github.com/hhatto/autopep8 Author: Hideo Hattori @@ -376,7 +376,7 @@ -------------- autopep8 can also use ``pyproject.toml``. - section must use ``[tool.autopep8]``, and ``pyproject.toml`` takes precedence + The section must be ``[tool.autopep8]``, and ``pyproject.toml`` takes precedence over any other configuration files. configuration file example:: @@ -384,6 +384,9 @@ [tool.autopep8] max_line_length = 120 ignore = "E501,W6" # or ["E501", "W6"] + in-place = true + recursive = true + aggressive = 3 Testing @@ -445,5 +448,6 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.6/README.rst new/autopep8-1.5.7/README.rst --- old/autopep8-1.5.6/README.rst 2021-02-22 13:49:43.000000000 +0100 +++ new/autopep8-1.5.7/README.rst 2021-03-31 16:31:43.000000000 +0200 @@ -368,7 +368,7 @@ -------------- autopep8 can also use ``pyproject.toml``. -section must use ``[tool.autopep8]``, and ``pyproject.toml`` takes precedence +The section must be ``[tool.autopep8]``, and ``pyproject.toml`` takes precedence over any other configuration files. configuration file example:: @@ -376,6 +376,9 @@ [tool.autopep8] max_line_length = 120 ignore = "E501,W6" # or ["E501", "W6"] + in-place = true + recursive = true + aggressive = 3 Testing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.6/autopep8.egg-info/PKG-INFO new/autopep8-1.5.7/autopep8.egg-info/PKG-INFO --- old/autopep8-1.5.6/autopep8.egg-info/PKG-INFO 2021-03-16 16:01:32.000000000 +0100 +++ new/autopep8-1.5.7/autopep8.egg-info/PKG-INFO 2021-04-30 08:04:38.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: autopep8 -Version: 1.5.6 +Version: 1.5.7 Summary: A tool that automatically formats Python code to conform to the PEP 8 style guide Home-page: https://github.com/hhatto/autopep8 Author: Hideo Hattori @@ -376,7 +376,7 @@ -------------- autopep8 can also use ``pyproject.toml``. - section must use ``[tool.autopep8]``, and ``pyproject.toml`` takes precedence + The section must be ``[tool.autopep8]``, and ``pyproject.toml`` takes precedence over any other configuration files. configuration file example:: @@ -384,6 +384,9 @@ [tool.autopep8] max_line_length = 120 ignore = "E501,W6" # or ["E501", "W6"] + in-place = true + recursive = true + aggressive = 3 Testing @@ -445,5 +448,6 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Software Development :: Quality Assurance diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.6/autopep8.py new/autopep8-1.5.7/autopep8.py --- old/autopep8-1.5.6/autopep8.py 2021-03-16 15:50:28.000000000 +0100 +++ new/autopep8-1.5.7/autopep8.py 2021-04-30 08:04:15.000000000 +0200 @@ -100,7 +100,7 @@ unicode = str -__version__ = '1.5.6' +__version__ = '1.5.7' CR = '\r' @@ -109,7 +109,7 @@ PYTHON_SHEBANG_REGEX = re.compile(r'^#!.*\bpython[23]?\b\s*$') -LAMBDA_REGEX = re.compile(r'([\w.]+)\s=\slambda\s*([\(\)=\w,\s.]*):') +LAMBDA_REGEX = re.compile(r'([\w.]+)\s=\slambda\s*([)(=\w,\s.]*):') COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+([^][)(}{]+?)\s+(in|is)\s') COMPARE_NEGATIVE_REGEX_THROUGH = re.compile(r'\b(not\s+in|is\s+not)\s') BARE_EXCEPT_REGEX = re.compile(r'except\s*:') @@ -121,6 +121,7 @@ EXIT_CODE_OK = 0 EXIT_CODE_ERROR = 1 EXIT_CODE_EXISTS_DIFF = 2 +EXIT_CODE_ARGPARSE_ERROR = 99 # For generating line shortening candidates. SHORTEN_OPERATOR_GROUPS = frozenset([ @@ -3817,7 +3818,7 @@ args = parser.parse_args(arguments) if not args.files and not args.list_fixes: - parser.error('incorrect number of arguments') + parser.exit(EXIT_CODE_ARGPARSE_ERROR, 'incorrect number of arguments') args.files = [decode_filename(name) for name in args.files] @@ -3835,30 +3836,59 @@ if '-' in args.files: if len(args.files) > 1: - parser.error('cannot mix stdin and regular files') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + 'cannot mix stdin and regular files', + ) if args.diff: - parser.error('--diff cannot be used with standard input') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--diff cannot be used with standard input', + ) if args.in_place: - parser.error('--in-place cannot be used with standard input') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--in-place cannot be used with standard input', + ) if args.recursive: - parser.error('--recursive cannot be used with standard input') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--recursive cannot be used with standard input', + ) if len(args.files) > 1 and not (args.in_place or args.diff): - parser.error('autopep8 only takes one filename as argument ' - 'unless the "--in-place" or "--diff" args are ' - 'used') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + 'autopep8 only takes one filename as argument ' + 'unless the "--in-place" or "--diff" args are used', + ) if args.recursive and not (args.in_place or args.diff): - parser.error('--recursive must be used with --in-place or --diff') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--recursive must be used with --in-place or --diff', + ) if args.in_place and args.diff: - parser.error('--in-place and --diff are mutually exclusive') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--in-place and --diff are mutually exclusive', + ) if args.max_line_length <= 0: - parser.error('--max-line-length must be greater than 0') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--max-line-length must be greater than 0', + ) + + if args.indent_size <= 0: + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--indent-size must be greater than 0', + ) if args.select: args.select = _expand_codes( @@ -3895,14 +3925,23 @@ args.jobs = multiprocessing.cpu_count() if args.jobs > 1 and not (args.in_place or args.diff): - parser.error('parallel jobs requires --in-place') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + 'parallel jobs requires --in-place', + ) if args.line_range: if args.line_range[0] <= 0: - parser.error('--range must be positive numbers') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + '--range must be positive numbers', + ) if args.line_range[0] > args.line_range[1]: - parser.error('First value of --range should be less than or equal ' - 'to the second') + parser.exit( + EXIT_CODE_ARGPARSE_ERROR, + 'First value of --range should be less than or equal ' + 'to the second', + ) return args @@ -4324,6 +4363,7 @@ return fix_file(*parameters) except IOError as error: print(unicode(error), file=sys.stderr) + raise error def fix_multiple_files(filenames, options, output=None): @@ -4337,12 +4377,17 @@ if options.jobs > 1: import multiprocessing pool = multiprocessing.Pool(options.jobs) - ret = pool.map(_fix_file, [(name, options) for name in filenames]) + rets = [] + for name in filenames: + ret = pool.apply_async(_fix_file, ((name, options),)) + rets.append(ret) + pool.close() + pool.join() if options.diff: - for r in ret: - sys.stdout.write(r.decode()) + for r in rets: + sys.stdout.write(r.get().decode()) sys.stdout.flush() - results.extend([x for x in ret if x is not None]) + results.extend([x.get() for x in rets if x is not None]) else: for name in filenames: ret = _fix_file((name, options, output)) @@ -4458,6 +4503,8 @@ ret = any([ret is not None for ret in results]) if args.exit_code and ret: return EXIT_CODE_EXISTS_DIFF + except IOError: + return EXIT_CODE_ERROR except KeyboardInterrupt: return EXIT_CODE_ERROR # pragma: no cover diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.6/setup.py new/autopep8-1.5.7/setup.py --- old/autopep8-1.5.6/setup.py 2021-03-16 15:46:16.000000000 +0100 +++ new/autopep8-1.5.7/setup.py 2021-03-22 09:27:11.000000000 +0100 @@ -46,6 +46,7 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Quality Assurance', ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.6/test/test_autopep8.py new/autopep8-1.5.7/test/test_autopep8.py --- old/autopep8-1.5.6/test/test_autopep8.py 2021-03-16 15:48:24.000000000 +0100 +++ new/autopep8-1.5.7/test/test_autopep8.py 2021-03-31 16:50:32.000000000 +0200 @@ -19,6 +19,7 @@ import contextlib import io import shutil +import stat from subprocess import Popen, PIPE from tempfile import mkstemp, mkdtemp import tokenize @@ -874,15 +875,6 @@ with autopep8_context(line) as result: self.assertEqual(fixed, result) - def test_e101_with_indent_size_0(self): - line = """\ -while True: - if True: - \t1 -""" - with autopep8_context(line, options=['--indent-size=0']) as result: - self.assertEqual(line, result) - def test_e101_with_indent_size_1(self): line = """\ while True: @@ -5503,6 +5495,20 @@ error = p.communicate()[1].decode('utf-8') self.assertIn('cannot', error) + def test_indent_size_is_zero(self): + line = "'abc'\n" + with autopep8_subprocess(line, ['--indent-size=0']) as (result, retcode): + self.assertEqual(retcode, autopep8.EXIT_CODE_ARGPARSE_ERROR) + + def test_exit_code_with_io_error(self): + line = "import sys\ndef a():\n print(1)\n" + with readonly_temporary_file_context(line) as filename: + print(filename) + p = Popen(list(AUTOPEP8_CMD_TUPLE) + ['--in-place', filename], + stdout=PIPE, stderr=PIPE) + p.communicate() + self.assertEqual(p.returncode, autopep8.EXIT_CODE_ERROR) + def test_pep8_passes(self): line = "'abc' \n" fixed = "'abc'\n" @@ -5648,7 +5654,6 @@ def test_parallel_jobs_with_diff_option(self): line = "'abc' \n" - fixed = "'abc'\n" with temporary_file_context(line) as filename_a: with temporary_file_context(line) as filename_b: @@ -5667,10 +5672,32 @@ -'abc' +'abc' """.format(filename=filename)) - self.assertEqual(0, p.returncode) + self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK) for actual_diff in actual_diffs: self.assertIn(actual_diff, output) + def test_parallel_jobs_with_inplace_option_and_io_error(self): + temp_directory = mkdtemp(dir='.') + try: + file_a = os.path.join(temp_directory, 'a.py') + with open(file_a, 'w') as output: + output.write("'abc' \n") + os.chmod(file_a, stat.S_IRUSR) # readonly + + os.mkdir(os.path.join(temp_directory, 'd')) + file_b = os.path.join(temp_directory, 'd', 'b.py') + with open(file_b, 'w') as output: + output.write('123 \n') + os.chmod(file_b, stat.S_IRUSR) + + p = Popen(list(AUTOPEP8_CMD_TUPLE) + + [temp_directory, '--recursive', '--in-place'], + stdout=PIPE, stderr=PIPE) + p.communicate()[0].decode('utf-8') + self.assertEqual(p.returncode, autopep8.EXIT_CODE_ERROR) + finally: + shutil.rmtree(temp_directory) + def test_parallel_jobs_with_automatic_cpu_count(self): line = "'abc' \n" fixed = "'abc'\n" @@ -5851,7 +5878,7 @@ except SystemExit as e: exception = e self.assertTrue(exception) - self.assertEqual(exception.code, 2) + self.assertEqual(exception.code, autopep8.EXIT_CODE_ARGPARSE_ERROR) def test_standard_out_should_use_native_line_ending(self): line = '1\r\n2\r\n3\r\n' @@ -6020,7 +6047,7 @@ fp.write(line) p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename], stdout=PIPE) self.assertEqual(p.communicate()[0].decode("utf-8"), line) - self.assertEqual(p.returncode, 0) + self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK) def test_pyproject_toml_with_verbose_option(self): """override to flake8 config""" @@ -6037,7 +6064,7 @@ output = p.communicate()[0].decode("utf-8") self.assertTrue(line in output) self.assertTrue(verbose_line in output) - self.assertEqual(p.returncode, 0) + self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK) def test_pyproject_toml_with_iterable_value(self): line = "a = 1\n" @@ -6051,7 +6078,7 @@ p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename, ], stdout=PIPE) output = p.communicate()[0].decode("utf-8") self.assertTrue(line in output) - self.assertEqual(p.returncode, 0) + self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK) class ExperimentalSystemTests(unittest.TestCase): @@ -7362,6 +7389,19 @@ yield temporary[1] os.remove(temporary[1]) + +@contextlib.contextmanager +def readonly_temporary_file_context(text, suffix='', prefix=''): + temporary = mkstemp(suffix=suffix, prefix=prefix) + os.close(temporary[0]) + with autopep8.open_with_encoding(temporary[1], + encoding='utf-8', + mode='w') as temp_file: + temp_file.write(text) + os.chmod(temporary[1], stat.S_IRUSR) + yield temporary[1] + os.remove(temporary[1]) + @contextlib.contextmanager def temporary_project_directory(prefix="autopep8test"):