diff options
author | Daniel Holth <dholth@fastmail.fm> | 2017-06-27 03:01:39 (GMT) |
---|---|---|
committer | Daniel Holth <dholth@fastmail.fm> | 2017-06-27 03:01:39 (GMT) |
commit | 0acdff80303263a4825e708846c345452324b115 (patch) | |
tree | 91d74086fd0caa66dabc15a40667828811f1042d /src/engine/SCons | |
parent | dac36853a206edc24bbaf2ee8e706f4bd3fd77a8 (diff) | |
download | SCons-0acdff80303263a4825e708846c345452324b115.zip SCons-0acdff80303263a4825e708846c345452324b115.tar.gz SCons-0acdff80303263a4825e708846c345452324b115.tar.bz2 |
remove external zip tool, always use stdlib to zip
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/Tool/zip.py | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/src/engine/SCons/Tool/zip.py b/src/engine/SCons/Tool/zip.py index 2613bfc..23d540f 100644 --- a/src/engine/SCons/Tool/zip.py +++ b/src/engine/SCons/Tool/zip.py @@ -40,31 +40,23 @@ import SCons.Defaults import SCons.Node.FS import SCons.Util -try: - import zipfile - internal_zip = 1 -except ImportError: - internal_zip = 0 - -if internal_zip: - zipcompression = zipfile.ZIP_DEFLATED - def zip(target, source, env): - compression = env.get('ZIPCOMPRESSION', 0) - zf = zipfile.ZipFile(str(target[0]), 'w', compression) - for s in source: - if s.isdir(): - for dirpath, dirnames, filenames in os.walk(str(s)): - for fname in filenames: - path = os.path.join(dirpath, fname) - if os.path.isfile(path): - zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', '')))) - else: - zf.write(str(s), os.path.relpath(str(s), str(env.get('ZIPROOT', '')))) - zf.close() -else: - zipcompression = 0 - zip = "$ZIP $ZIPFLAGS ${TARGET.abspath} $SOURCES" - +import zipfile + +zipcompression = zipfile.ZIP_DEFLATED +def zip(target, source, env): + compression = env.get('ZIPCOMPRESSION', 0) + zf = zipfile.ZipFile(str(target[0]), 'w', compression) + for s in source: + if s.isdir(): + for dirpath, dirnames, filenames in os.walk(str(s)): + for fname in filenames: + path = os.path.join(dirpath, fname) + if os.path.isfile(path): + + zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', '')))) + else: + zf.write(str(s), os.path.relpath(str(s), str(env.get('ZIPROOT', '')))) + zf.close() zipAction = SCons.Action.Action(zip, varlist=['ZIPCOMPRESSION']) @@ -91,7 +83,7 @@ def generate(env): env['ZIPROOT'] = SCons.Util.CLVar('') def exists(env): - return internal_zip or env.Detect('zip') + return True # Local Variables: # tab-width:4 |