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
a38c8ff0
Commit
a38c8ff0
authored
Apr 12, 2001
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding walkandscrub to delete pyc and pyo files recursively during installation.
parent
cfe7d281
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
inst/walkandscrub.py
inst/walkandscrub.py
+34
-0
No files found.
inst/walkandscrub.py
0 → 100644
View file @
a38c8ff0
import
os
,
sys
DEBUG
=
0
if
os
.
name
in
(
'posix'
,
'nt'
,
'dos'
):
EXCLUDED_NAMES
=
[
'..'
,
'.'
]
else
:
EXCLUDED_NAMES
=
[]
# extend EXCLUDED_NAMES here manually with filenames ala "asyncore.pyc" for
# files that are only distributed in compiled format (.pyc, .pyo)
# if necessary (not currently necessary in 2.3.1 AFAIK) - chrism
def
walkandscrub
(
path
):
path
=
os
.
path
.
expandvars
(
os
.
path
.
expanduser
(
path
))
print
print
'-'
*
78
sys
.
stdout
.
write
(
"Deleting '.pyc' and '.pyo' files recursively under %s... "
%
path
)
os
.
path
.
walk
(
path
,
scrub
,
[])
sys
.
stdout
.
write
(
'done.
\
n
'
)
def
scrub
(
list
,
dirname
,
filelist
):
for
name
in
filelist
:
if
name
in
EXCLUDED_NAMES
:
continue
prefix
,
ext
=
os
.
path
.
splitext
(
name
)
if
ext
==
'.pyo'
or
ext
==
'.pyc'
:
full
=
os
.
path
.
join
(
dirname
,
name
)
os
.
unlink
(
full
)
if
DEBUG
:
print
full
if
__name__
==
'__main__'
:
DEBUG
=
1
walkandscrub
(
os
.
getcwd
())
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