From 349ade60a7eeb66d8ae94dd5a512571bf84bf87d Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Sun, 31 Jan 2016 17:31:07 +0100 Subject: [PATCH] Configure pyinstaller build Squashed commit of the following: commit 18cfe73a85670ff1dc0c1028140458c9064503af Author: Inso <insomniak.fr@gmail.com> Date: Sun Jan 31 17:14:35 2016 +0100 Try with .spec file commit 8db8d1b5f0f2aa38be9592ce4636095e0a725bd6 Author: Inso <insomniak.fr@gmail.com> Date: Sun Jan 31 16:01:45 2016 +0100 Show macos spec file commit 3c92873fb1eee2e46b496bdea31770f524fc3be2 Author: Inso <insomniak.fr@gmail.com> Date: Sat Jan 23 19:06:47 2016 +0100 Try with develop version commit 2dfa08fcd2107c04fe5772f57df572bad0306d7a Merge: d0f9a90 37581ea Author: Inso <insomniak.fr@gmail.com> Date: Wed Jan 20 08:08:49 2016 +0100 Merge branch 'dev' into pyinstaller commit d0f9a90a7fbf1f7ede8254c05aba9890ac86acc2 Author: Inso <insomniak.fr@gmail.com> Date: Tue Jan 19 07:57:21 2016 +0100 Debug logs commit e215db50baf9e4c6b5faa342bd124c07defad52a Author: Inso <insomniak.fr@gmail.com> Date: Fri Jan 15 20:48:14 2016 +0100 Test pyinstaller as build system --- appveyor.yml | 2 +- ci/appveyor/build.cmd | 5 +++-- ci/travis/before_deploy.sh | 4 ++-- ci/travis/build.sh | 6 +++--- hooks/hook-lib2to3.py | 15 ++++++++++++++ sakia.spec | 41 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 hooks/hook-lib2to3.py create mode 100644 sakia.spec diff --git a/appveyor.yml b/appveyor.yml index 652647b2..83fc9cd6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,7 +57,7 @@ build_script: - echo %errorlevel% artifacts: - - path: build + - path: dist name: sakia-win$(PYTHON_ARCH) # upload to releases deploy: diff --git a/ci/appveyor/build.cmd b/ci/appveyor/build.cmd index a1b9b313..d5b374fb 100644 --- a/ci/appveyor/build.cmd +++ b/ci/appveyor/build.cmd @@ -12,6 +12,7 @@ pyrcc5 -version lrelease -version pip install -r requirements.txt +pip install pyinstaller python gen_resources.py if %errorlevel% neq 0 exit /b 1s @@ -19,5 +20,5 @@ if %errorlevel% neq 0 exit /b 1s python gen_translations.py if %errorlevel% neq 0 exit /b 1 -@REM python setup.py build -@REM if %errorlevel% neq 0 exit /b 1 +pyinstaller sakia.spec +if %errorlevel% neq 0 exit /b 1 diff --git a/ci/travis/before_deploy.sh b/ci/travis/before_deploy.sh index f80fb656..1cb92cf7 100755 --- a/ci/travis/before_deploy.sh +++ b/ci/travis/before_deploy.sh @@ -2,8 +2,8 @@ if [ $TRAVIS_OS_NAME == "osx" ] then - zip -r sakia-${TRAVIS_OS_NAME}.zip build/*.dmg + zip -r sakia-${TRAVIS_OS_NAME}.zip dist/* elif [ $TRAVIS_OS_NAME == "linux" ] then - zip -r sakia-${TRAVIS_OS_NAME}.zip build/exe* + zip -r sakia-${TRAVIS_OS_NAME}.zip dist/ fi diff --git a/ci/travis/build.sh b/ci/travis/build.sh index b044d976..bd31a385 100755 --- a/ci/travis/build.sh +++ b/ci/travis/build.sh @@ -6,7 +6,7 @@ eval "$(pyenv virtualenv-init -)" cd $HOME/build/ucoin-io/sakia pyenv activate sakia-env pip install coveralls -pip install cx_Freeze +pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip pip install -r requirements.txt if [ $TRAVIS_OS_NAME == "linux" ] then @@ -19,9 +19,9 @@ python gen_translations.py if [ $TRAVIS_OS_NAME == "osx" ] then - python setup.py bdist_dmg + pyinstaller sakia.spec elif [ $TRAVIS_OS_NAME == "linux" ] then - python setup.py build + pyinstaller sakia.spec fi diff --git a/hooks/hook-lib2to3.py b/hooks/hook-lib2to3.py new file mode 100644 index 00000000..ae3b3514 --- /dev/null +++ b/hooks/hook-lib2to3.py @@ -0,0 +1,15 @@ +#----------------------------------------------------------------------------- +# Copyright (c) 2005-2016, PyInstaller Development Team. +# +# Distributed under the terms of the GNU General Public License with exception +# for distributing bootloader. +# +# The full license is in the file COPYING.txt, distributed with this software. +#----------------------------------------------------------------------------- + +# This is needed to bundle draft3.json and draft4.json files that come +# with jsonschema module + +from PyInstaller.utils.hooks import collect_data_files + +datas = collect_data_files('lib2to3') diff --git a/sakia.spec b/sakia.spec new file mode 100644 index 00000000..9ab862da --- /dev/null +++ b/sakia.spec @@ -0,0 +1,41 @@ +# -*- mode: python -*- +from PyInstaller.compat import is_darwin + +block_cipher = None + +a = Analysis(['src/sakia/main.py'], + pathex=['.'], + binaries=None, + datas=None, + hiddenimports=[], + hookspath=['hooks'], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher) + +if is_darwin: + a.binaries = a.binaries - TOC([ + ('/usr/local/lib/libsodium.so', None, None),]) + +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) + +exe = EXE(pyz, + a.scripts, + exclude_binaries=True, + name='sakia', + debug=True, + strip=False, + upx=True, + console=True ) + +coll = COLLECT(exe, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + name='sakia') + -- GitLab