Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
755d5ea1
Commit
755d5ea1
authored
Dec 15, 2013
by
R David Murray
Browse files
Options
Browse Files
Download
Plain Diff
Merge: #19532: make compileall with no file/dir args respect -f and -q.
parents
575596e1
8a1d1e64
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
Lib/compileall.py
Lib/compileall.py
+2
-1
Lib/test/test_compileall.py
Lib/test/test_compileall.py
+23
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/compileall.py
View file @
755d5ea1
...
...
@@ -229,7 +229,8 @@ def main():
success
=
False
return
success
else
:
return
compile_path
(
legacy
=
args
.
legacy
)
return
compile_path
(
legacy
=
args
.
legacy
,
force
=
args
.
force
,
quiet
=
args
.
quiet
)
except
KeyboardInterrupt
:
print
(
"
\
n
[interrupted]"
)
return
False
...
...
Lib/test/test_compileall.py
View file @
755d5ea1
...
...
@@ -5,8 +5,6 @@ import os
import
py_compile
import
shutil
import
struct
import
subprocess
import
sys
import
tempfile
import
time
import
unittest
...
...
@@ -181,6 +179,29 @@ class CommandLineTests(unittest.TestCase):
self
.
assertNotCompiled
(
self
.
initfn
)
self
.
assertNotCompiled
(
self
.
barfn
)
def
test_no_args_respects_force_flag
(
self
):
bazfn
=
script_helper
.
make_script
(
self
.
directory
,
'baz'
,
''
)
self
.
assertRunOK
(
PYTHONPATH
=
self
.
directory
)
pycpath
=
importlib
.
util
.
cache_from_source
(
bazfn
)
# Set atime/mtime backward to avoid file timestamp resolution issues
os
.
utime
(
pycpath
,
(
time
.
time
()
-
60
,)
*
2
)
mtime
=
os
.
stat
(
pycpath
).
st_mtime
# Without force, no recompilation
self
.
assertRunOK
(
PYTHONPATH
=
self
.
directory
)
mtime2
=
os
.
stat
(
pycpath
).
st_mtime
self
.
assertEqual
(
mtime
,
mtime2
)
# Now force it.
self
.
assertRunOK
(
'-f'
,
PYTHONPATH
=
self
.
directory
)
mtime2
=
os
.
stat
(
pycpath
).
st_mtime
self
.
assertNotEqual
(
mtime
,
mtime2
)
def
test_no_args_respects_quiet_flag
(
self
):
script_helper
.
make_script
(
self
.
directory
,
'baz'
,
''
)
noisy
=
self
.
assertRunOK
(
PYTHONPATH
=
self
.
directory
)
self
.
assertIn
(
b'Listing '
,
noisy
)
quiet
=
self
.
assertRunOK
(
'-q'
,
PYTHONPATH
=
self
.
directory
)
self
.
assertNotIn
(
b'Listing '
,
quiet
)
# Ensure that the default behavior of compileall's CLI is to create
# PEP 3147 pyc/pyo files.
for
name
,
ext
,
switch
in
[
...
...
Misc/NEWS
View file @
755d5ea1
...
...
@@ -44,6 +44,9 @@ Core and Builtins
Library
-------
- Issue #19532: python -m compileall with no filename/directory arguments now
respects the -f and -q flags instead of ignoring them.
- Issue #19623: Fixed writing to unseekable files in the aifc module.
- Issue #19946: multiprocessing.spawn now raises ImportError when the module to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment