diff options
author | Greg Ward <gward@python.net> | 2000-10-01 23:49:30 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-10-01 23:49:30 (GMT) |
commit | f217e2124a9b57dc13513ea4f9e430413135269e (patch) | |
tree | 7aab609d99c14c0239193249521235d40557554c /Lib/distutils | |
parent | 4b6ea798cbb6ef6058d97794c652e4acfd2ac165 (diff) | |
download | cpython-f217e2124a9b57dc13513ea4f9e430413135269e.zip cpython-f217e2124a9b57dc13513ea4f9e430413135269e.tar.gz cpython-f217e2124a9b57dc13513ea4f9e430413135269e.tar.bz2 |
Tweaked 'byte_compile()' so it silently skips non-Python files, rather than
blowing up.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/util.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 0323484..563e47c 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -297,9 +297,10 @@ def byte_compile (py_files, prefix=None, base_dir=None, verbose=1, dry_run=0, direct=None): - """Byte-compile a collection of Python source files to either - .pyc or .pyo files in the same directory. 'optimize' must be - one of the following: + """Byte-compile a collection of Python source files to either .pyc + or .pyo files in the same directory. 'py_files' is a list of files + to compile; any files that don't end in ".py" are silently skipped. + 'optimize' must be one of the following: 0 - don't optimize (generate .pyc) 1 - normal optimization (like "python -O") 2 - extra optimization (like "python -OO") @@ -378,8 +379,9 @@ byte_compile(files, optimize=%s, force=%s, for file in py_files: if file[-3:] != ".py": - raise ValueError, \ - "invalid filename: %s doesn't end with '.py'" % `file` + # This lets us be lazy and not filter filenames in + # the "install_lib" command. + continue # Terminology from the py_compile module: # cfile - byte-compiled file |