diff options
| author | Benjamin Peterson <benjamin@python.org> | 2008-05-08 22:09:54 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2008-05-08 22:09:54 (GMT) |
| commit | 9ec4aa01f9e1b5f0d8ed94005ac5b14d6ff94ebc (patch) | |
| tree | 7e9150ba04727525bc05ba3652cc22de5518775c /Lib/distutils/archive_util.py | |
| parent | e3b1940eb9eedb752e23310a2b846cb91a970675 (diff) | |
| download | cpython-9ec4aa01f9e1b5f0d8ed94005ac5b14d6ff94ebc.zip cpython-9ec4aa01f9e1b5f0d8ed94005ac5b14d6ff94ebc.tar.gz cpython-9ec4aa01f9e1b5f0d8ed94005ac5b14d6ff94ebc.tar.bz2 | |
Replace instances of os.path.walk with os.walk
Diffstat (limited to 'Lib/distutils/archive_util.py')
| -rw-r--r-- | Lib/distutils/archive_util.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/distutils/archive_util.py b/Lib/distutils/archive_util.py index a9c6a5b..264e66f 100644 --- a/Lib/distutils/archive_util.py +++ b/Lib/distutils/archive_util.py @@ -95,18 +95,16 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) - def visit (z, dirname, names): - for name in names: - path = os.path.normpath(os.path.join(dirname, name)) - if os.path.isfile(path): - z.write(path, path) - log.info("adding '%s'" % path) - if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) - os.path.walk(base_dir, visit, z) + for dirpath, dirnames, filenames in os.walk(base_dir): + for name in filenames: + path = os.path.normpath(os.path.join(dirpath, name)) + if os.path.isfile(path): + z.write(path, path) + log.info("adding '%s'" % path) z.close() return zip_filename |
