summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/man/scons.121
-rw-r--r--src/CHANGES.txt5
-rw-r--r--src/RELEASE.txt25
-rw-r--r--src/engine/SCons/Tool/zip.py18
-rw-r--r--test/ZIP.py21
5 files changed, 66 insertions, 24 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index a657565..4dcf3b9 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -5168,7 +5168,26 @@ or a .hpp file
The zip compression and file packaging utility.
.IP ZIPCOM
-The command line used to call the zip utility.
+The command line used to call the zip utility,
+or the internal Python function used to create a
+zip archive.
+
+.IP ZIPCOMPRESSION
+The
+.I compression
+flag
+from the Python
+.B zipfile
+module used by the internal Python function
+to control whether the zip archive
+is compressed or not.
+The default value is
+.BR zipfile.ZIP_DEFLATED ,
+which creates a compressed zip archive.
+This value has no effect when using Python 1.5.2
+or if the
+.B zipfile
+module is otherwise unavailable.
.IP ZIPFLAGS
General options passed to the zip utility.
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index bbeac15..1043b50 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -92,6 +92,11 @@ RELEASE 0.95 - XXX
- When scanning for libraries to link with, don't append $LIBPREFIXES
or $LIBSUFFIXES values to the $LIBS values if they're already present.
+ - Add a ZIPCOMPRESSION construction variable to control whether the
+ internal Python action for the Zip Builder compresses the file or
+ not. The default value is zipfile.ZIP_DEFLATED, which generates
+ a compressed file.
+
From Vincent Risi:
- Add support for the bcc32, ilink32 and tlib Borland tools.
diff --git a/src/RELEASE.txt b/src/RELEASE.txt
index 0651dca..4bb0a8f 100644
--- a/src/RELEASE.txt
+++ b/src/RELEASE.txt
@@ -20,26 +20,19 @@ more effectively, please sign up for the scons-users mailing list at:
-RELEASE 0.94 - Fri, 07 Nov 2003 05:29:48 -0600
+RELEASE 0.95 - XXX
- This is the fifth beta release of SCons. Please consult the
+ This is the sixth beta release of SCons. Please consult the
CHANGES.txt file for a list of specific changes since last release.
- Please note the following important changes since release 0.92:
+ Please note the following important changes since release 0.94:
- - Construction variables are now expanded anywhere within a
- target or source name, as well as in the arguments to the following
- Environment methods: AlwaysBuild(), Depends(), Ignore(), Install(),
- InstallAs(), Precious(), SideEffect() and SourceCode().
-
- If you have any files or directories that actually contain one or
- more dollar signs ($), you must now precede the dollar sign with
- another dollar sign ($$) when referring to the file or directory
- as part of calling a Builder, or any of the above methods.
-
- - The ParseConfig() global function has now been deprecated in favor
- of using the env.ParseConfig() method. The global function will be
- removed in some future release of SCons.
+ - The internal Python function used by the Zip Builder in Python
+ releases 1.6 or later now compresses the resulting .zip file
+ by default. The old behavior of creating an uncompressed file
+ may be preserved by setting the new ZIPCOMPRESSION construction
+ variable to 0 (or zipfile.ZIP_STORED, if you import the
+ underlying zipfile module).
SCons is developed with an extensive regression test suite, and a
rigorous development methodology for continually improving that suite.
diff --git a/src/engine/SCons/Tool/zip.py b/src/engine/SCons/Tool/zip.py
index 510aa6e..18f0caa 100644
--- a/src/engine/SCons/Tool/zip.py
+++ b/src/engine/SCons/Tool/zip.py
@@ -41,29 +41,32 @@ 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):
def visit(arg, dirname, names):
for name in names:
path = os.path.join(dirname, name)
if os.path.isfile(path):
arg.write(path)
- zf = zipfile.ZipFile(str(target[0]), 'w')
+ compression = env.get('ZIPCOMPRESSION', 0)
+ zf = zipfile.ZipFile(str(target[0]), 'w', compression)
for s in source:
if os.path.isdir(str(s)):
os.path.walk(str(s), visit, zf)
else:
zf.write(str(s))
zf.close()
-
- internal_zip = 1
-
-except ImportError:
+else:
+ zipcompression = 0
zip = "$ZIP $ZIPFLAGS ${TARGET.abspath} $SOURCES"
- internal_zip = 0
-zipAction = SCons.Action.Action(zip)
+zipAction = SCons.Action.Action(zip, varlist=['ZIPCOMPRESSION'])
ZipBuilder = SCons.Builder.Builder(action = '$ZIPCOM',
source_factory = SCons.Node.FS.default_fs.Entry,
@@ -82,6 +85,7 @@ def generate(env):
env['ZIP'] = 'zip'
env['ZIPFLAGS'] = ''
env['ZIPCOM'] = zipAction
+ env['ZIPCOMPRESSION'] = zipcompression
env['ZIPSUFFIX'] = '.zip'
def exists(env):
diff --git a/test/ZIP.py b/test/ZIP.py
index 1924ab4..b2041e6 100644
--- a/test/ZIP.py
+++ b/test/ZIP.py
@@ -26,6 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import os.path
+import stat
import string
import sys
import TestSCons
@@ -82,6 +83,7 @@ test.fail_test(test.read('bbb.zip') != "sub1/file5\nsub1/file6\nfile4\n")
try:
import zipfile
+ internal_zip = 1
zip = 1
def files(fname):
@@ -89,6 +91,7 @@ try:
return map(lambda x: x.filename, zf.infolist())
except ImportError:
+ internal_zip = 0
zip = test.detect('ZIP', 'zip')
unzip = test.where_is('unzip')
@@ -119,6 +122,16 @@ f2.Zip(target = 'f2.zip', source = ['file13', 'file14'])
f2.Zip(target = 'f2.zip', source = 'file15')
f3.Zip(target = 'f3', source = 'file16')
f3.Zip(target = 'f3', source = ['file17', 'file18'])
+try:
+ import zipfile
+ sources = ['file10', 'file11', 'file12', 'file13', 'file14', 'file15']
+ f1.Zip(target = 'f4.zip', source = sources)
+ f1.Zip(target = 'f4stored.zip', source = sources,
+ ZIPCOMPRESSION = zipfile.ZIP_STORED)
+ f1.Zip(target = 'f4deflated.zip', source = sources,
+ ZIPCOMPRESSION = zipfile.ZIP_DEFLATED)
+except ImportError:
+ pass
""" % marker_out)
for f in ['file10', 'file11', 'file12',
@@ -149,4 +162,12 @@ f3.Zip(target = 'f3', source = ['file17', 'file18'])
test.fail_test(files("f3.xyzzy") != ['file16', 'file17', 'file18'])
+ if internal_zip:
+ f4_size = os.stat('f4.zip')[stat.ST_SIZE]
+ f4stored_size = os.stat('f4stored.zip')[stat.ST_SIZE]
+ f4deflated_size = os.stat('f4deflated.zip')[stat.ST_SIZE]
+
+ test.fail_test(f4_size != f4deflated_size)
+ test.fail_test(f4stored_size == f4deflated_size)
+
test.pass_test()