mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
mac -> os
This commit is contained in:
parent
25d7cafd8a
commit
d9596e3a79
2 changed files with 20 additions and 22 deletions
|
@ -1,7 +1,6 @@
|
||||||
# Module 'packmail' -- create a shell script out of some files.
|
# Module 'packmail' -- create a shell script out of some files.
|
||||||
|
|
||||||
import mac
|
import os
|
||||||
import macpath
|
|
||||||
from stat import ST_MTIME
|
from stat import ST_MTIME
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
@ -21,25 +20,25 @@ def pack(outfp, file, name):
|
||||||
def packsome(outfp, dirname, names):
|
def packsome(outfp, dirname, names):
|
||||||
for name in names:
|
for name in names:
|
||||||
print name
|
print name
|
||||||
file = macpath.join(dirname, name)
|
file = os.path.join(dirname, name)
|
||||||
pack(outfp, file, name)
|
pack(outfp, file, name)
|
||||||
|
|
||||||
# Pack all files from a directory
|
# Pack all files from a directory
|
||||||
def packall(outfp, dirname):
|
def packall(outfp, dirname):
|
||||||
names = mac.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
names.sort()
|
names.sort()
|
||||||
packsome(outfp, dirname, names)
|
packsome(outfp, dirname, names)
|
||||||
|
|
||||||
# Pack all files from a directory that are not older than a give one
|
# Pack all files from a directory that are not older than a give one
|
||||||
def packnotolder(outfp, dirname, oldest):
|
def packnotolder(outfp, dirname, oldest):
|
||||||
names = mac.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
oldest = macpath.join(dirname, oldest)
|
oldest = os.path.join(dirname, oldest)
|
||||||
st = mac.stat(oldest)
|
st = os.stat(oldest)
|
||||||
mtime = st[ST_MTIME]
|
mtime = st[ST_MTIME]
|
||||||
todo = []
|
todo = []
|
||||||
for name in names:
|
for name in names:
|
||||||
print name, '...',
|
print name, '...',
|
||||||
st = mac.stat(macpath.join(dirname, name))
|
st = os.stat(os.path.join(dirname, name))
|
||||||
if st[ST_MTIME] >= mtime:
|
if st[ST_MTIME] >= mtime:
|
||||||
print 'Yes.'
|
print 'Yes.'
|
||||||
todo.append(name)
|
todo.append(name)
|
||||||
|
@ -52,11 +51,11 @@ def packnotolder(outfp, dirname, oldest):
|
||||||
def packtree(outfp, dirname):
|
def packtree(outfp, dirname):
|
||||||
print 'packtree', dirname
|
print 'packtree', dirname
|
||||||
outfp.write('mkdir ' + unixfix(dirname) + '\n')
|
outfp.write('mkdir ' + unixfix(dirname) + '\n')
|
||||||
names = mac.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
subdirs = []
|
subdirs = []
|
||||||
for name in names:
|
for name in names:
|
||||||
fullname = macpath.join(dirname, name)
|
fullname = os.path.join(dirname, name)
|
||||||
if macpath.isdir(fullname):
|
if os.path.isdir(fullname):
|
||||||
subdirs.append(fullname)
|
subdirs.append(fullname)
|
||||||
else:
|
else:
|
||||||
print 'pack', fullname
|
print 'pack', fullname
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Module 'packmail' -- create a shell script out of some files.
|
# Module 'packmail' -- create a shell script out of some files.
|
||||||
|
|
||||||
import mac
|
import os
|
||||||
import macpath
|
|
||||||
from stat import ST_MTIME
|
from stat import ST_MTIME
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
@ -21,25 +20,25 @@ def pack(outfp, file, name):
|
||||||
def packsome(outfp, dirname, names):
|
def packsome(outfp, dirname, names):
|
||||||
for name in names:
|
for name in names:
|
||||||
print name
|
print name
|
||||||
file = macpath.join(dirname, name)
|
file = os.path.join(dirname, name)
|
||||||
pack(outfp, file, name)
|
pack(outfp, file, name)
|
||||||
|
|
||||||
# Pack all files from a directory
|
# Pack all files from a directory
|
||||||
def packall(outfp, dirname):
|
def packall(outfp, dirname):
|
||||||
names = mac.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
names.sort()
|
names.sort()
|
||||||
packsome(outfp, dirname, names)
|
packsome(outfp, dirname, names)
|
||||||
|
|
||||||
# Pack all files from a directory that are not older than a give one
|
# Pack all files from a directory that are not older than a give one
|
||||||
def packnotolder(outfp, dirname, oldest):
|
def packnotolder(outfp, dirname, oldest):
|
||||||
names = mac.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
oldest = macpath.join(dirname, oldest)
|
oldest = os.path.join(dirname, oldest)
|
||||||
st = mac.stat(oldest)
|
st = os.stat(oldest)
|
||||||
mtime = st[ST_MTIME]
|
mtime = st[ST_MTIME]
|
||||||
todo = []
|
todo = []
|
||||||
for name in names:
|
for name in names:
|
||||||
print name, '...',
|
print name, '...',
|
||||||
st = mac.stat(macpath.join(dirname, name))
|
st = os.stat(os.path.join(dirname, name))
|
||||||
if st[ST_MTIME] >= mtime:
|
if st[ST_MTIME] >= mtime:
|
||||||
print 'Yes.'
|
print 'Yes.'
|
||||||
todo.append(name)
|
todo.append(name)
|
||||||
|
@ -52,11 +51,11 @@ def packnotolder(outfp, dirname, oldest):
|
||||||
def packtree(outfp, dirname):
|
def packtree(outfp, dirname):
|
||||||
print 'packtree', dirname
|
print 'packtree', dirname
|
||||||
outfp.write('mkdir ' + unixfix(dirname) + '\n')
|
outfp.write('mkdir ' + unixfix(dirname) + '\n')
|
||||||
names = mac.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
subdirs = []
|
subdirs = []
|
||||||
for name in names:
|
for name in names:
|
||||||
fullname = macpath.join(dirname, name)
|
fullname = os.path.join(dirname, name)
|
||||||
if macpath.isdir(fullname):
|
if os.path.isdir(fullname):
|
||||||
subdirs.append(fullname)
|
subdirs.append(fullname)
|
||||||
else:
|
else:
|
||||||
print 'pack', fullname
|
print 'pack', fullname
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue