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
fa540649
Commit
fa540649
authored
Apr 07, 1991
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support packing whole trees.
parent
fc61383f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
Lib/lib-old/packmail.py
Lib/lib-old/packmail.py
+26
-0
Lib/packmail.py
Lib/packmail.py
+26
-0
No files found.
Lib/lib-old/packmail.py
View file @
fa540649
...
...
@@ -3,6 +3,7 @@
import
mac
import
macpath
from
stat
import
ST_MTIME
import
string
# Pack one file
def
pack
(
outfp
,
file
,
name
):
...
...
@@ -46,3 +47,28 @@ def packnotolder(outfp, dirname, oldest):
print
'No.'
todo
.
sort
()
packsome
(
outfp
,
dirname
,
todo
)
# Pack a whole tree (no exceptions)
def
packtree
(
outfp
,
dirname
):
print
'packtree'
,
dirname
outfp
.
write
(
'mkdir '
+
unixfix
(
dirname
)
+
'
\
n
'
)
names
=
mac
.
listdir
(
dirname
)
subdirs
=
[]
for
name
in
names
:
fullname
=
macpath
.
cat
(
dirname
,
name
)
if
macpath
.
isdir
(
fullname
):
subdirs
.
append
(
fullname
)
else
:
print
'pack'
,
fullname
pack
(
outfp
,
fullname
,
unixfix
(
fullname
))
for
subdirname
in
subdirs
:
packtree
(
outfp
,
subdirname
)
def
unixfix
(
name
):
comps
=
string
.
splitfields
(
name
,
':'
)
res
=
''
for
comp
in
comps
:
if
comp
:
if
res
:
res
=
res
+
'/'
res
=
res
+
comp
return
res
Lib/packmail.py
View file @
fa540649
...
...
@@ -3,6 +3,7 @@
import
mac
import
macpath
from
stat
import
ST_MTIME
import
string
# Pack one file
def
pack
(
outfp
,
file
,
name
):
...
...
@@ -46,3 +47,28 @@ def packnotolder(outfp, dirname, oldest):
print
'No.'
todo
.
sort
()
packsome
(
outfp
,
dirname
,
todo
)
# Pack a whole tree (no exceptions)
def
packtree
(
outfp
,
dirname
):
print
'packtree'
,
dirname
outfp
.
write
(
'mkdir '
+
unixfix
(
dirname
)
+
'
\
n
'
)
names
=
mac
.
listdir
(
dirname
)
subdirs
=
[]
for
name
in
names
:
fullname
=
macpath
.
cat
(
dirname
,
name
)
if
macpath
.
isdir
(
fullname
):
subdirs
.
append
(
fullname
)
else
:
print
'pack'
,
fullname
pack
(
outfp
,
fullname
,
unixfix
(
fullname
))
for
subdirname
in
subdirs
:
packtree
(
outfp
,
subdirname
)
def
unixfix
(
name
):
comps
=
string
.
splitfields
(
name
,
':'
)
res
=
''
for
comp
in
comps
:
if
comp
:
if
res
:
res
=
res
+
'/'
res
=
res
+
comp
return
res
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