From ced699b4c7e79e0a53e3ca7f2d789b761d4a9e76 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Fri, 4 Dec 2015 22:54:38 -0500 Subject: #24903: Remove misleading error message to fix regression. Before the argparse conversion, compileall would (sometimes) accept multiple paths when -d was specified. Afterward, it does not. The corresponding check in the original code claimed to prevent multiple *directories* from being specified...but it didn't really work even to do that. So this patch fixes the regression by invoking the consenting adults rule: if you specify a combination of arguments to compileall that produces files with inconsistent destdirs (which you could do before), it is on you. Patch by Jake Garver. --- Lib/compileall.py | 3 --- Lib/test/test_compileall.py | 8 -------- Misc/ACKS | 1 + Misc/NEWS | 4 ++++ 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Lib/compileall.py b/Lib/compileall.py index d957ee5..8e1569c 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -196,9 +196,6 @@ def main(): compile_dests = args.compile_dest - if (args.ddir and (len(compile_dests) != 1 - or not os.path.isdir(compile_dests[0]))): - parser.exit('-d destdir requires exactly one directory argument') if args.rx: import re args.rx = re.compile(args.rx) diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py index 7b307ed..7c61fa3 100644 --- a/Lib/test/test_compileall.py +++ b/Lib/test/test_compileall.py @@ -323,14 +323,6 @@ class CommandLineTests(unittest.TestCase): self.assertCompiled(init2fn) self.assertCompiled(bar2fn) - def test_d_takes_exactly_one_dir(self): - rc, out, err = self.assertRunNotOK('-d', 'foo') - self.assertEqual(out, b'') - self.assertRegex(err, b'-d') - rc, out, err = self.assertRunNotOK('-d', 'foo', 'bar') - self.assertEqual(out, b'') - self.assertRegex(err, b'-d') - def test_d_compile_error(self): script_helper.make_script(self.pkgdir, 'crunchyfrog', 'bad(syntax') rc, out, err = self.assertRunNotOK('-q', '-d', 'dinsdale', self.pkgdir) diff --git a/Misc/ACKS b/Misc/ACKS index 0f64ef0..6130568 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -470,6 +470,7 @@ Raymund Galvin Nitin Ganatra Fred Gansevles Lars Marius Garshol +Jake Garver Dan Gass Andrew Gaul Matthieu Gautier diff --git a/Misc/NEWS b/Misc/NEWS index 0d4977f..8c727ff 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -115,6 +115,10 @@ Core and Builtins Library ------- +- Issue #24903: Fix regression in number of arguments compileall accepts when + '-d' is specified. The check on the number of arguments has been dropped + completely as it never worked correctly anyway. + - Issue #25764: In the subprocess module, preserve any exception caused by fork() failure when preexec_fn is used. -- cgit v0.12