diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-04-20 17:03:01 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2013-04-20 17:03:01 (GMT) |
commit | 8a1a4804a56a469c32aaa1c3b1310383b3befa54 (patch) | |
tree | d431ed534dade001ab1f057275130bbdd45e7c9d /src | |
parent | 1411faab72ab26f640bdaa145ffc3510669941bd (diff) | |
download | SCons-8a1a4804a56a469c32aaa1c3b1310383b3befa54.zip SCons-8a1a4804a56a469c32aaa1c3b1310383b3befa54.tar.gz SCons-8a1a4804a56a469c32aaa1c3b1310383b3befa54.tar.bz2 |
Added tests for ZIPROOT, and tweaked the ZIPROOT doc a bit.
Also cleaned up the ZIP tests by assuming that python
has the zipfile module, which has been true since python 1.6.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Tool/zip.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/zip.xml | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/engine/SCons/Tool/zip.py b/src/engine/SCons/Tool/zip.py index 1cfe541..2613bfc 100644 --- a/src/engine/SCons/Tool/zip.py +++ b/src/engine/SCons/Tool/zip.py @@ -57,9 +57,9 @@ if internal_zip: for fname in filenames: path = os.path.join(dirpath, fname) if os.path.isfile(path): - zf.write(path, os.path.relpath(path, env.get('ZIPROOT', ''))) + zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', '')))) else: - zf.write(str(s), os.path.relpath(str(s), env.get('ZIPROOT', ''))) + zf.write(str(s), os.path.relpath(str(s), str(env.get('ZIPROOT', '')))) zf.close() else: zipcompression = 0 diff --git a/src/engine/SCons/Tool/zip.xml b/src/engine/SCons/Tool/zip.xml index 85b3d52..c2b8026 100644 --- a/src/engine/SCons/Tool/zip.xml +++ b/src/engine/SCons/Tool/zip.xml @@ -110,6 +110,18 @@ The suffix used for zip file names. <cvar name="ZIPROOT"> <summary> -An optional zip root directory (default empty). +An optional zip root directory (default empty). The filenames stored +in the zip file will be relative to this directory, if given. +Otherwise the filenames are relative to the current directory of the +command. +For instance: +<example> +env = Environment() +env.Zip('foo.zip', 'subdir1/subdir2/file1', ZIPROOT='subdir1') +</example> +will produce a zip file <literal>foo.zip</literal> +containing a file with the name +<literal>subdir2/file1</literal> rather than +<literal>subdir1/subdir2/file1</literal>. </summary> </cvar> |