diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-06-25 22:59:01 +0000 |
---|---|---|
committer | <> | 2013-09-27 11:49:28 +0000 |
commit | 8c4528713d907ee2cfd3bfcbbad272c749867f84 (patch) | |
tree | c09e2ce80f47b90c85cc720f5139089ad9c8cfff /libs/python/pyste/dist/create_build.py | |
download | boost-tarball-baserock/morph.tar.gz |
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_54_0.tar.bz2.boost_1_54_0baserock/morph
Diffstat (limited to 'libs/python/pyste/dist/create_build.py')
-rw-r--r-- | libs/python/pyste/dist/create_build.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/libs/python/pyste/dist/create_build.py b/libs/python/pyste/dist/create_build.py new file mode 100644 index 000000000..a68369951 --- /dev/null +++ b/libs/python/pyste/dist/create_build.py @@ -0,0 +1,55 @@ +# Copyright Bruno da Silva de Oliveira 2006. Distributed under the Boost +# Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +import os +import sys +import shutil +import fnmatch +from zipfile import ZipFile, ZIP_DEFLATED + +def findfiles(directory, mask): + def visit(files, dir, names): + for name in names: + if fnmatch.fnmatch(name, mask): + files.append(os.path.join(dir, name)) + files = [] + os.path.walk(directory, visit, files) + return files + + +def main(): + # test if PyXML is installed + try: + import _xmlplus.parsers.expat + pyxml = '--includes _xmlplus.parsers.expat' + except ImportError: + pyxml = '' + # create exe + status = os.system('python setup.py py2exe %s >& build.log' % pyxml) + if status != 0: + raise RuntimeError, 'Error creating EXE' + + # create distribution + import pyste + version = pyste.__VERSION__ + zip = ZipFile('pyste-%s.zip' % version, 'w', ZIP_DEFLATED) + # include the base files + dist_dir = 'dist/pyste' + for basefile in os.listdir(dist_dir): + zip.write(os.path.join(dist_dir, basefile), os.path.join('pyste', basefile)) + # include documentation + for doc_file in findfiles('../doc', '*.*'): + dest_name = os.path.join('pyste/doc', doc_file[3:]) + zip.write(doc_file, dest_name) + zip.write('../index.html', 'pyste/doc/index.html') + zip.close() + # cleanup + os.remove('build.log') + shutil.rmtree('build') + shutil.rmtree('dist') + + +if __name__ == '__main__': + sys.path.append('../src') + main() |