Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
2781713c
Commit
2781713c
authored
Jul 24, 2003
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move compilezpy and decompilezpy from Zope.Startup into utilities.
parent
f3333839
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
0 deletions
+106
-0
utilities/README.txt
utilities/README.txt
+9
-0
utilities/compilezpy.py
utilities/compilezpy.py
+69
-0
utilities/decompilezpy.py
utilities/decompilezpy.py
+28
-0
No files found.
utilities/README.txt
View file @
2781713c
...
...
@@ -18,8 +18,17 @@ To get detailed usage information, run any of these scripts without arguments:
mkzopeinstance.py -- create a Zope instance home
copyzopeskel.py -- copy a Zope instance home skeleton directory to target
mkzeoinstance.py -- create a ZEO instance home
requestprofiler.py -- parse and analyze the Zope "detailed" log file
zpasswd.py -- generate "access" or "inituser" files for use with Zope
compilezpy.py -- compile all .py files to .pyc files in the current
directory and below
decompilezpy.py -- remove all .py[co] files in the current directory
and below
utilities/compilezpy.py
0 → 100755
View file @
2781713c
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import
compileall
,
os
,
sys
class
Shutup
:
def
write
(
*
args
):
pass
# :)
class
NoteErr
:
wrote
=
0
def
write
(
self
,
*
args
):
self
.
wrote
=
1
apply
(
stderr
.
write
,
args
)
def
compile_non_test
(
dir
):
"""Byte-compile all modules except those in test directories."""
success
=
compileall
.
compile_dir
(
dir
,
maxlevels
=
0
)
try
:
names
=
os
.
listdir
(
dir
)
except
os
.
error
:
print
"Can't list"
,
dir
names
=
[]
names
.
sort
()
for
name
in
names
:
fullname
=
os
.
path
.
join
(
dir
,
name
)
if
(
name
!=
os
.
curdir
and
name
!=
os
.
pardir
and
os
.
path
.
isdir
(
fullname
)
and
not
os
.
path
.
islink
(
fullname
)
and
name
!=
'test'
and
name
!=
'tests'
and
name
!=
'skins'
):
success
=
success
and
compile_non_test
(
fullname
)
return
success
print
print
'-'
*
78
print
'Compiling python modules'
stdout
=
sys
.
stdout
stderr
=
sys
.
stderr
try
:
try
:
success
=
0
sys
.
stdout
=
Shutup
()
sys
.
stderr
=
NoteErr
()
success
=
compile_non_test
(
os
.
getcwd
())
finally
:
success
=
success
and
not
sys
.
stderr
.
wrote
sys
.
stdout
=
stdout
sys
.
stderr
=
stderr
except
:
success
=
0
import
traceback
traceback
.
print_exc
()
if
not
success
:
print
print
'!'
*
78
print
'There were errors during Python module compilation.'
print
'!'
*
78
print
sys
.
exit
(
1
)
utilities/decompilezpy.py
0 → 100755
View file @
2781713c
#!/usr/bin/env python
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import
os
import
sys
def
main
(
dirname
):
os
.
path
.
walk
(
dirname
,
rmpycs
,
None
)
def
rmpycs
(
arg
,
dirname
,
names
):
for
name
in
names
:
path
=
os
.
path
.
join
(
dirname
,
name
)
if
(
name
.
endswith
(
'.pyc'
)
or
name
.
endswith
(
'.pyo'
)
and
os
.
path
.
isfile
(
path
)
):
os
.
unlink
(
path
)
if
__name__
==
'__main__'
:
main
(
sys
.
argv
[
1
])
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