Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python-defaults
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
python-defaults
Commits
3a332fb8
Commit
3a332fb8
authored
14 years ago
by
Piotr Ożarowski
Browse files
Options
Downloads
Patches
Plain Diff
remove --lazy (option and feature), fix -O
parent
93d7bf2a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
debian/changelog
+1
-1
1 addition, 1 deletion
debian/changelog
pycompile
+7
-15
7 additions, 15 deletions
pycompile
pycompile.1
+0
-4
0 additions, 4 deletions
pycompile.1
with
8 additions
and
20 deletions
debian/changelog
+
1
−
1
View file @
3a332fb8
...
...
@@ -4,7 +4,7 @@ python-defaults (2.6.6-7) experimental; urgency=high
- Don't over-optimize, check the timestamps of byte-code files.
- Use the correct name for byte-code files.
- Use the correct python interpreter when called with -O.
- Add options -f/--force,
-l/--lazy,
-O.
- Add options -f/--force, -O.
- Copy stdout/stderr of py_compile processes in case of error.
- Propagate the exit value of the py_compile processes.
- Update manual page.
...
...
This diff is collapsed.
Click to expand it.
pycompile
+
7
−
15
View file @
3a332fb8
...
...
@@ -170,7 +170,7 @@ def py_compile(version, optimize, workers):
if
not
isinstance
(
version
,
basestring
):
version
=
vrepr
(
version
)
cmd
=
"
python%s%s -m py_compile -
"
\
%
(
version
,
(
__debug__
or
optimize
)
and
''
or
'
-O
'
)
%
(
version
,
''
if
(
__debug__
or
not
optimize
)
else
'
-O
'
)
process
=
Popen
(
cmd
,
bufsize
=
1
,
shell
=
True
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
STDOUT
,
close_fds
=
True
)
workers
[
version
]
=
process
# keep the reference for .communicate()
...
...
@@ -180,7 +180,7 @@ def py_compile(version, optimize, workers):
stdin
.
write
(
filename
+
'
\n
'
)
def
compile
(
files
,
versions
,
force
,
lazy
,
optimize
,
e_patterns
=
None
):
def
compile
(
files
,
versions
,
force
,
optimize
,
e_patterns
=
None
):
global
STDINS
,
WORKERS
# start Python interpreters that will handle byte compilation
for
version
in
versions
:
...
...
@@ -191,10 +191,8 @@ def compile(files, versions, force, lazy, optimize, e_patterns=None):
# byte compile files
for
fn
,
versions_to_compile
in
filter_files
(
files
,
e_patterns
,
versions
):
cfn
=
fn
+
((
__debug__
or
optimize
)
and
'
c
'
or
'
o
'
)
if
lazy
and
exists
(
cfn
):
continue
if
not
force
:
cfn
=
fn
+
'
c
'
if
(
__debug__
or
not
optimize
)
else
'
o
'
if
exists
(
cfn
)
and
not
force
:
ftime
=
os
.
stat
(
fn
).
st_mtime
try
:
ctime
=
os
.
stat
(
cfn
).
st_mtime
...
...
@@ -225,8 +223,6 @@ def main():
default
=
False
,
help
=
'
be quiet
'
)
parser
.
add_option
(
'
-f
'
,
'
--force
'
,
action
=
'
store_true
'
,
dest
=
'
force
'
,
default
=
False
,
help
=
'
force rebuild even if timestamps are up-to-date
'
)
parser
.
add_option
(
'
-l
'
,
'
--lazy
'
,
action
=
'
store_true
'
,
dest
=
'
lazy
'
,
default
=
False
,
help
=
"
don
'
t check if byte-code files are up-to-date
"
)
parser
.
add_option
(
'
-O
'
,
action
=
'
store_true
'
,
dest
=
'
optimize
'
,
default
=
False
,
help
=
"
byte-compile to .pyo files
"
)
parser
.
add_option
(
'
-p
'
,
'
--package
'
,
...
...
@@ -254,10 +250,6 @@ multiple times to build up a list of things to exclude.')
else
:
log
.
setLevel
(
logging
.
WARN
)
if
options
.
force
and
options
.
lazy
:
options
.
lazy
=
False
log
.
warn
(
'
--force is in effect, ignore --lazy
'
)
if
options
.
regexpr
and
not
args
:
parser
.
error
(
'
--exclude option works with private directories
'
'
only, please use /usr/share/python/bcep to specify
'
...
...
@@ -289,7 +281,7 @@ multiple times to build up a list of things to exclude.')
log
.
debug
(
'
byte compiling %s using Python %s
'
,
item
,
compile_versions
)
files
=
get_private_files
(
pkg_files
,
item
)
compile
(
files
,
compile_versions
,
options
.
force
,
options
.
lazy
,
compile
(
files
,
compile_versions
,
options
.
force
,
options
.
optimize
,
e_patterns
)
elif
options
.
package
:
# package's public modules
# no need to limit versions here, it's either pyr mode or version is
...
...
@@ -298,14 +290,14 @@ multiple times to build up a list of things to exclude.')
files
=
get_package_files
(
options
.
package
)
files
=
get_public_files
(
files
,
versions
)
compile
(
files
,
versions
,
options
.
force
,
options
.
lazy
,
options
.
optimize
,
e_patterns
)
options
.
force
,
options
.
optimize
,
e_patterns
)
elif
args
:
# other directories/files (public ones mostly)
versions
=
debsorted
(
versions
)[:
1
]
for
item
in
args
:
e_patterns
=
get_exclude_patterns
(
item
,
options
.
regexpr
,
versions
)
files
=
get_directory_files
(
item
)
compile
(
files
,
versions
,
options
.
force
,
options
.
lazy
,
options
.
optimize
,
e_patterns
)
options
.
force
,
options
.
optimize
,
e_patterns
)
else
:
parser
.
print_usage
()
exit
(
1
)
...
...
This diff is collapsed.
Click to expand it.
pycompile.1
+
0
−
4
View file @
3a332fb8
...
...
@@ -22,10 +22,6 @@ Show this help message and exit
\fB\-f\fR, \fB\-\-force\fR
Force rebuild of byte-code files even if timestamps are up-to-date.
.TP
\fB\-l\fR, \fB\-\-lazy\fR
Do not rebuild byte-code files even if timestamps are out-of-date (ignored when
\fB\-\-force\fR is in effect).
.TP
\fB\-O\fR
Byte-compile to .pyo files.
.TP
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment