From e5db85e6da66c08fa38e3d2a4bd092272e8ae93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Wed, 3 Apr 2013 21:50:13 +0200 Subject: [PATCH] remove zip dependency by replacing it with the zipfile module which is included in python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- README.md | 2 -- dependency-test.sh | 1 - manuals/ponysay.texinfo | 6 ------ setup.py | 8 +++++--- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b3863c55..d3320efb 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,6 @@ Dependencies ### Package building dependencies -`zip`: used to create one executable with all sources - `gzip`: used for compressing manuals (suppressable with `./configure --without-info-compression --without-man-compression`) `texinfo`: used for building info manual (suppressable with `./configure --without-info`) diff --git a/dependency-test.sh b/dependency-test.sh index 05f3020d..a74463ca 100755 --- a/dependency-test.sh +++ b/dependency-test.sh @@ -14,7 +14,6 @@ pv=0 # python version (hash chmod 2>/dev/null) || (br=1 ; ro=1 ; echo 'Missing chmod, install coreutils [build+runtime required]') -(hash zip 2>/dev/null) || (br=1 ; echo 'Missing zip, install zip [build required]') (hash gzip 2>/dev/null) || (bo=1 ; echo 'Missing gzip, install gzip [build optional]') (hash makeinfo 2>/dev/null) || (bo=1 ; echo 'Missing makeinfo, install texinfo [build optional]') diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 20ed087e..811b6509 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -1667,12 +1667,6 @@ the file name) in addition to .pony-files or pony names. @pindex @command{python3} Required to run the @file{./setup.py} file, which is also invoked from the make script. -@item zip -@pindex @command{zip} -Required to create an executable containing all Pythons files. This is done by -creating an (uncompressed) zip-file with all source files and prepended with -a shebang telling the operating system to run Python 3, and naming the mane -file @file{__main__.py}. @item gzip @pindex @command{gzip} Used for compressing manuals. (Optional, standard) diff --git a/setup.py b/setup.py index 8cfaa6d3..d33bfd86 100755 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ import os import shutil import sys +from zipfile import ZipFile from subprocess import Popen, PIPE @@ -430,9 +431,10 @@ class Setup(): if filein is not None: filein .close() try: os.chdir('src') - cmd = 'zip -0 ../ponysay.zip ' + ' '.join(ponysaysrc) # use not compress, prefer speed - print(cmd) - os.system(cmd) + print('Creating uncompressed zip file ponysay.zip with files from src: ' + ' '.join(ponysaysrc)) + with ZipFile('../ponysay.zip', 'w') as myzip: + for src in ponysaysrc: + myzip.write(src) finally: os.chdir('..') os.chmod('ponysay.zip', 0o755)