def create_bundle(spec_path, working_dir): pyinstaller_args = [ "-y", "--debug=all", spec_path, "--distpath", os.path.join(working_dir, "dist"), "--workpath", os.path.join(working_dir, "build"), ] logger.info("run PyInstaller" + " ".join(pyinstaller_args)) pyinstaller_run(pyinstaller_args)
#'--exclude-module=numpy', '--exclude-module=scipy' ] executables = [ 'train_and_align', 'align', 'generate_dictionary', 'train_g2p', 'validate_dataset' ] executable_template = os.path.join(root_dir, 'aligner', 'command_line', '{}.py') for e in executables: script_name = executable_template.format(e) print(script_name) com = common_options + [script_name] pyinstaller_run(pyi_args=com) mfa_root = os.path.join(dist_dir, 'montreal-forced-aligner') os.makedirs(mfa_root) bin_dir = os.path.join(mfa_root, 'bin') if sys.platform == 'win32': for i, e in enumerate(executables): orig_dir = os.path.join(dist_dir, e) if i == 0: shutil.move(orig_dir, bin_dir) os.rename(os.path.join(bin_dir, e + exe_ext), os.path.join(bin_dir, 'mfa_' + e + exe_ext)) else: shutil.move(os.path.join(orig_dir, e + exe_ext), os.path.join(bin_dir, 'mfa_' + e + exe_ext))
'--exclude-module=matplotlib', '--exclude-module=pytz', '--exclude-module=sphinx', #'--exclude-module=numpy', '--exclude-module=scipy'] executables = ['train_and_align', 'align', 'generate_dictionary', 'train_g2p', 'validate_dataset'] executable_template = os.path.join(root_dir, 'aligner', 'command_line', '{}.py') for e in executables: script_name = executable_template.format(e) print(script_name) com = common_options + [script_name] pyinstaller_run(pyi_args=com) mfa_root = os.path.join(dist_dir, 'montreal-forced-aligner') os.makedirs(mfa_root) bin_dir = os.path.join(mfa_root, 'bin') if sys.platform == 'win32': for i, e in enumerate(executables): orig_dir = os.path.join(dist_dir, e) if i == 0: shutil.move(orig_dir, bin_dir) os.rename(os.path.join(bin_dir, e + exe_ext), os.path.join(bin_dir, 'mfa_' + e + exe_ext)) else: shutil.move(os.path.join(orig_dir, e + exe_ext), os.path.join(bin_dir, 'mfa_' + e + exe_ext)) else: lib_dir = os.path.join(mfa_root, 'lib')
Created on Fri Mar 27 16:16:28 2015 @author: winkler """ import os import shutil from PyInstaller.__main__ import run as pyinstaller_run # Specifacations for PyInstaller spec_file = 'PyPlane.spec' # Directories where to build into script_dir = os.getcwd() build_dir = os.path.join(script_dir, 'build') temp_dir = os.path.join(script_dir, 'temp') # Build the command string cmd = [ '--clean', '--distpath=%s' % build_dir, '--workpath=%s' % temp_dir, spec_file ] # Clean-up environment if os.path.exists(build_dir): shutil.rmtree(build_dir, ignore_errors=True) # Call pyinstaller print('Executing pyinstaller %s' % ' '.join(cmd)) pyinstaller_run(cmd)
'--paths=%s' % a_core_dir, '--paths=%s' % qt_bin_path, '--paths=%s' % libzmq_path, '--hidden-import=scipy.special._ufuncs_cxx', '--hidden-import=mpl_toolkits', '--hidden-import=scipy.linalg.cython_blas', '--hidden-import=scipy.linalg.cython_lapack', '--hidden-import=scipy._lib.messagestream', '--hidden-import=tkinter.filedialog', '--icon=%s' % a_icon_file, '--name=%s' % (exename), a_input_file] print(cmd) # Clean-up environment if os.path.exists(a_build_dir): shutil.rmtree(a_build_dir, ignore_errors=True) # Call pyinstaller print('Executing command pyinstaller %s' % cmd) pyinstaller_run(cmd) # Copy the config directory to the build directory shutil.copytree(a_config_dir, os.path.join(a_exe_dir, config_dir)) shutil.copytree(a_lib_dir, os.path.join(exe_dir, lib_dir)) os.mkdir(os.path.dirname(os.path.join(a_exe_dir, descrfile))) print(os.path.dirname(os.path.join(a_exe_dir, descrfile))) print(a_descr_file) shutil.copyfile(a_descr_file, os.path.join(a_exe_dir, descrfile))
import platform import re import sys import tarfile import zipfile from PyInstaller.__main__ import run as pyinstaller_run if len(sys.argv) == 2: base_path = os.path.abspath(sys.argv[1]) else: base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.chdir(base_path) pyinstaller_run(["-y", "--debug=all", "launcher.spec"]) def read(*parts): with codecs.open(os.path.join(base_path, *parts), "r") as fp: return fp.read() def find_version(*file_paths): version_file = read(*file_paths) version_match = re.search(r"^version = ['\"]([^'\"]*)['\"]", version_file, re.M) if version_match: return version_match.group(1) raise RuntimeError("Unable to find version string.")