def build_nsis(ctx): print("Task: Build NSIS") icon = r'miniperf\ui\res\img\icon.ico' no_wheels = [ "adb", "mmgui", "SQLAlchemy", "openpyxl", "et-xmlfile", "ifaddr", "wcwidth" ] def req_wheel(x): if x.startswith('-e'): return False for nw in no_wheels: if nw in x: return False return True requirements = list( filter(req_wheel, open('requirements.txt').read().strip().split('\n'))) wheels = list( map( lambda y: os.path.join('dist', y), filter(lambda x: version in x and x.endswith('whl'), os.listdir('dist')))) name = "app" builder = nsist.InstallerBuilder( appname=name, version=version, icon=icon, shortcuts={ name: { 'entry_point': 'miniperf.app:main', 'console': False, 'icon': icon, } }, py_version='3.7.0', py_bitness=64, pypi_wheel_reqs=requirements, packages=["openpyxl", "et_xmlfile", "wcwidth"], local_wheels=wheels, extra_files=[ (get_configs_file_name(ctx), ''), ]) builder.run(makensis=False) #input("press any key to continue") builder.run_nsis() print("Task: Build NSIS done")
os.mkdir("build") shutil.copy("swood.ico", "build/swood.ico") if os.name == "nt": shutil.copy("template.nsi", "build/template.nsi") else: # NSIS for Linux doesn't recognize Unicode with open("template.nsi") as inf, open("build/template.nsi", "w") as outf: for line in inf: if "Unicode" not in line: outf.write(line.replace("\r\n", "\n")) nsist.InstallerBuilder( appname="swood", version=version, icon="swood.ico", shortcuts={}, commands={"swood": {"entry_point": "swood:run_cmd"}}, packages=[], pypi_wheel_reqs=wheels, extra_files=[], py_version=latest_python, py_bitness=bitness, py_format="bundled", build_dir="./build", nsi_template="./build/template.nsi", installer_name=os.path.abspath( "../build/swood-{}-{}bit.exe".format(latest_commit if latest_commit is not None else version, bitness)), exclude=[]).run(makensis=True) print("Cleaning up") shutil.rmtree("build") shutil.rmtree("pynsist_pkgs")
project_dir = os.path.abspath(os.path.dirname(__file__)) icon_path = os.path.abspath(os.path.join(os.path.dirname(__file__), icon)) pkg_list = [ "innstereo", "gi", "cairo", "dbus", "gnome", "pygtkcompat", "numpy", "matplotlib", "six", "dateutil", "pyparsing", "scipy", "mplstereonet", "cycler" ] inst_name = "InnStereo {}.exe".format(version + " {}") installer64 = nsist.InstallerBuilder(appname.format(version, "64bit"), version, shortcuts, icon=icon_path, packages=pkg_list, extra_files=None, py_version="3.4.3", py_bitness=64, py_format="installer", build_dir="build/nsis", installer_name=inst_name.format("64bit"), nsi_template=None, exclude=None) # FIXME check for conflicting folder before move command = "mv {} {}".format(join(project_dir, "pynsist_pkgs64"), join(project_dir, "pynsist_pkgs")) call(command, shell=True) installer64.run() command = "mv {} {}".format(join(project_dir, "pynsist_pkgs"), join(project_dir, "pynsist_pkgs64")) call(command, shell=True)