diff --git a/pyste/dist/create_build.py b/pyste/dist/create_build.py index 2d6fab53..506426f0 100644 --- a/pyste/dist/create_build.py +++ b/pyste/dist/create_build.py @@ -1,11 +1,28 @@ 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 >& build.log') + status = os.system('python setup.py py2exe %s >& build.log' % pyxml) if status != 0: raise RuntimeError, 'Error creating EXE' @@ -16,7 +33,12 @@ def main(): # include the base files dist_dir = 'dist/pyste' for basefile in os.listdir(dist_dir): - zip.write(os.path.join(dist_dir, basefile), basefile) + 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')