From 29fbc7553d2fe302c33e74edec29da36d5c61894 Mon Sep 17 00:00:00 2001 From: Andrew Senetar Date: Mon, 7 Aug 2017 21:48:40 -0500 Subject: [PATCH] Update packaging for windows - Update package.py to integrate NSIS for windows - Update makefile to deal with a few additional windows issues - Add Windows.md to contain specific windows instructions, if we want this can be merged with README.md - Minor formatting update to setup.nsi Ref #393 --- Makefile | 12 +++++++++--- Windows.md | 37 +++++++++++++++++++++++++++++++++++++ package.py | 9 +++++++++ setup.nsi | 2 +- 4 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 Windows.md diff --git a/Makefile b/Makefile index 914b740b..e73b15a5 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,23 @@ PYTHON ?= python3 +PYRCC5 ?= pyrcc5 REQ_MINOR_VERSION = 4 PREFIX ?= /usr/local # Window compatability via Msys2 # - venv creates Scripts instead of bin # - compile generates .pyd instead of .so +# - venv with --sytem-site-packages has issues on windows as well... ifeq ($(shell uname -o), Msys) BIN = Scripts SO = pyd + VENV_OPTIONS = + PIP_OPTIONS = else BIN = bin SO = so + VENV_OPTIONS = --system-site-packages + PIP_OPTIONS = --user endif # Set this variable if all dependencies are already met on the system. We will then avoid the @@ -69,15 +75,15 @@ $(submodules_target) : env : | $(submodules_target) reqs ifndef NO_VENV @echo "Creating our virtualenv" - ${PYTHON} -m venv env --system-site-packages - $(VENV_PYTHON) -m pip install --user -r requirements.txt + ${PYTHON} -m venv env ${VENV_OPTIONS} + $(VENV_PYTHON) -m pip install ${PIP_OPTIONS} -r requirements.txt endif build/help : | env $(VENV_PYTHON) build.py --doc qt/dg_rc.py : qt/dg.qrc - pyrcc5 qt/dg.qrc > qt/dg_rc.py + $(PYRCC5) qt/dg.qrc > qt/dg_rc.py i18n: $(mofiles) diff --git a/Windows.md b/Windows.md new file mode 100644 index 00000000..71a284dc --- /dev/null +++ b/Windows.md @@ -0,0 +1,37 @@ +## How to build dupeGuru for Windows + +### Prerequisites + +- [Python 3.4+][python] +- [nsis](http://nsis.sourceforge.net/Main_Page) (for installer creation) + +### With build.py (preferred) + + $ cd + $ git submodule init + $ git submodule update + $ py -3.5 -m venv .\env + $ .\env\Scripts\activate + $ pip install -r requirements.txt -r requirements-windows.txt + $ python build.py + $ python run.py + +### With makefile +It is possible to build dupeGuru with the makefile on windows using msys2. There are a few additional considerations: +1. Install PyQt5 globally +2. pass the correct value for PYTHON to the makefile if not on the path as python3 +3. Install PyQt5 & cx-Freeze with requirements-windows.txt into the venv + +Then the following should work + + $ make PYTHON='py -3.5' + $ make run + +### Generate Windows Installer Packages +You need to use the respective x86 or x64 version of python to build the 32 bit and 64 bit versions. The build scripts will automatically detect the python architecture for you. When using build.py make sure the resulting python works before continuing to package.py. + + $ python package.py + $ python package.py --installer_windows + +### Running tests +The complete test suite can be run with tox just like on linux. diff --git a/package.py b/package.py index 1f899d4f..cca98b12 100644 --- a/package.py +++ b/package.py @@ -12,6 +12,7 @@ import shutil import json from argparse import ArgumentParser import platform +import re from hscommon.build import ( print_and_do, copy_packages, build_debian_changelog, @@ -168,6 +169,14 @@ def package_windows(): executables=executables, script_args=['build'] ) + # Information to pass to NSIS + version_array = app_version.split('.') + match = re.search('[0-9]+', arch) + bits = match.group(0) + # Call NSIS (TODO update to not use hardcoded path) + cmd = ('"C:\\Program Files (x86)\\NSIS\\Bin\\makensis.exe" ' + '/DVERSIONMAJOR={0} /DVERSIONMINOR={1} /DVERSIONPATCH={2} /DBITS={3} setup.nsi') + print_and_do(cmd.format(version_array[0], version_array[1], version_array[2], bits)) def main(): args = parse_args() diff --git a/setup.nsi b/setup.nsi index 90d0b959..ce2f3d84 100644 --- a/setup.nsi +++ b/setup.nsi @@ -85,7 +85,7 @@ var InstallSize !include MultiUser.nsh ; Modern UI 2 -!include "MUI2.nsh" +!include MUI2.nsh !define MUI_ICON "${APPICON}" !define MUI_ABORTWARNING !define MUI_UNABORTWARNING