Updated Windows packaging scripts to work with PyInstaller

This commit is contained in:
Micah Lee 2016-04-12 17:53:33 -07:00
parent f2c4591c1e
commit e37ce32fcd
4 changed files with 75 additions and 26 deletions

View File

@ -110,7 +110,7 @@ If you want to sign binaries with Authenticode:
### To make a .exe:
* Open a command prompt, cd into the onionshare directory, and type: `python setup.py py2exe`. `onionshare.exe` and all of its supporting files will get created inside the `dist` folder.
* Open a command prompt, cd into the onionshare directory, and type: `pyinstaller install\pyinstaller.spec -y`. `onionshare.exe` and all of its supporting files will get created inside the `dist\onionshare` folder.
### To build the installer:

View File

@ -1,8 +1,8 @@
REM use PyInstaller to builder a folder with onionshare.exe
pyinstaller install/pyinstaller.spec
pyinstaller install\pyinstaller.spec -y
REM sign onionshare.exe
signtool.exe sign /v /d "OnionShare" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll /fd sha256 dist\onionshare.exe
signtool.exe sign /v /d "OnionShare" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll /fd sha256 dist\onionshare\onionshare.exe
REM build an installer, dist\OnionShare_Setup.exe
makensis.exe install\onionshare.nsi

View File

@ -1,9 +1,9 @@
!define APPNAME "OnionShare"
!define BINPATH "..\dist"
!define BINPATH "..\dist\onionshare"
!define ABOUTURL "https:\\onionshare.org\"
# change these with each release
!define INSTALLSIZE 60104
!define INSTALLSIZE 60866
!define VERSIONMAJOR 0
!define VERSIONMINOR 8
!define VERSIONSTRING "0.8.1"
@ -59,14 +59,11 @@ Function .onInit
FunctionEnd
Section "install"
# application
SetOutPath "$INSTDIR"
File "${BINPATH}\onionshare.exe"
File "${BINPATH}\license.txt"
File "${BINPATH}\version"
File "${BINPATH}\onionshare.ico"
File "onionshare.ico"
SetOutPath "$INSTDIR\html"
File "${BINPATH}\html\404.html"
File "${BINPATH}\html\denied.html"
File "${BINPATH}\html\index.html"
SetOutPath "$INSTDIR\images"
File "${BINPATH}\images\logo.png"
@ -74,6 +71,8 @@ Section "install"
File "${BINPATH}\images\server_stopped.png"
File "${BINPATH}\images\server_started.png"
File "${BINPATH}\images\server_working.png"
SetOutPath "$INSTDIR\Include"
File "${BINPATH}\include\pyconfig.h"
SetOutPath "$INSTDIR\locale"
File "${BINPATH}\locale\de.json"
File "${BINPATH}\locale\en.json"
@ -87,11 +86,26 @@ Section "install"
File "${BINPATH}\locale\pt.json"
File "${BINPATH}\locale\ru.json"
File "${BINPATH}\locale\tr.json"
# dependencies
SetOutPath "$INSTDIR\platforms"
File "${BINPATH}\platforms\qwindows.dll"
SetOutPath $INSTDIR
SetOutPath "$INSTDIR\qt5_plugins\iconengines"
File "${BINPATH}\qt5_plugins\iconengines\qsvgicon.dll"
SetOutPath "$INSTDIR\qt5_plugins\imageformats"
File "${BINPATH}\qt5_plugins\imageformats\qdds.dll"
File "${BINPATH}\qt5_plugins\imageformats\qgif.dll"
File "${BINPATH}\qt5_plugins\imageformats\qicns.dll"
File "${BINPATH}\qt5_plugins\imageformats\qico.dll"
File "${BINPATH}\qt5_plugins\imageformats\qjp2.dll"
File "${BINPATH}\qt5_plugins\imageformats\qjpeg.dll"
File "${BINPATH}\qt5_plugins\imageformats\qmng.dll"
File "${BINPATH}\qt5_plugins\imageformats\qsvg.dll"
File "${BINPATH}\qt5_plugins\imageformats\qtga.dll"
File "${BINPATH}\qt5_plugins\imageformats\qtiff.dll"
File "${BINPATH}\qt5_plugins\imageformats\qwbmp.dll"
File "${BINPATH}\qt5_plugins\imageformats\qwebp.dll"
SetOutPath "$INSTDIR\qt5_plugins\platforms"
File "${BINPATH}\qt5_plugins\platforms\qminimal.dll"
File "${BINPATH}\qt5_plugins\platforms\qoffscreen.dll"
File "${BINPATH}\qt5_plugins\platforms\qwindows.dll"
SetOutPath "$INSTDIR"
File "${BINPATH}\_bz2.pyd"
File "${BINPATH}\_ctypes.pyd"
File "${BINPATH}\_decimal.pyd"
@ -100,24 +114,33 @@ Section "install"
File "${BINPATH}\_multiprocessing.pyd"
File "${BINPATH}\_socket.pyd"
File "${BINPATH}\_ssl.pyd"
File "${BINPATH}\base_library.zip"
File "${BINPATH}\icudt53.dll"
File "${BINPATH}\icuin53.dll"
File "${BINPATH}\icuuc53.dll"
File "${BINPATH}\library.zip"
File "${BINPATH}\license.txt"
File "${BINPATH}\MSVCP100.dll"
File "${BINPATH}\MSVCR100.dll"
File "${BINPATH}\onionshare.exe"
File "${BINPATH}\onionshare.exe.manifest"
File "${BINPATH}\pyexpat.pyd"
File "${BINPATH}\PyQt5.Qt.pyd"
File "${BINPATH}\PyQt5.QtCore.pyd"
File "${BINPATH}\PyQt5.QtGui.pyd"
File "${BINPATH}\PyQt5.QtPrintSupport.pyd"
File "${BINPATH}\PyQt5.QtWidgets.pyd"
File "${BINPATH}\python34.dll"
File "${BINPATH}\pywintypes34.dll"
File "${BINPATH}\Qt5Core.dll"
File "${BINPATH}\Qt5Gui.dll"
File "${BINPATH}\Qt5PrintSupport.dll"
File "${BINPATH}\Qt5Svg.dll"
File "${BINPATH}\Qt5Widgets.dll"
File "${BINPATH}\select.pyd"
File "${BINPATH}\sip.pyd"
File "${BINPATH}\unicodedata.pyd"
File "${BINPATH}\version.txt"
File "${BINPATH}\win32wnet.pyd"
File "${BINPATH}\wordlist.txt"
# uninstaller
!ifndef INNER
@ -161,17 +184,15 @@ FunctionEnd
Delete "$SMPROGRAMS\${APPNAME}.lnk"
# remove files
Delete "$INSTDIR\onionshare.exe"
Delete "$INSTDIR\license.txt"
Delete "$INSTDIR\version"
Delete "$INSTDIR\onionshare.ico"
Delete "$INSTDIR\html\404.html"
Delete "$INSTDIR\html\denied.html"
Delete "$INSTDIR\html\index.html"
Delete "$INSTDIR\images\logo.png"
Delete "$INSTDIR\images\drop_files.png"
Delete "$INSTDIR\images\server_stopped.png"
Delete "$INSTDIR\images\server_started.png"
Delete "$INSTDIR\images\server_working.png"
Delete "$INSTDIR\include\pyconfig.h"
Delete "$INSTDIR\locale\de.json"
Delete "$INSTDIR\locale\en.json"
Delete "$INSTDIR\locale\eo.json"
@ -184,7 +205,22 @@ FunctionEnd
Delete "$INSTDIR\locale\pt.json"
Delete "$INSTDIR\locale\ru.json"
Delete "$INSTDIR\locale\tr.json"
Delete "$INSTDIR\platforms\qwindows.dll"
Delete "$INSTDIR\qt5_plugins\iconengines\qsvgicon.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qdds.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qgif.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qicns.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qico.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qjp2.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qjpeg.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qmng.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qsvg.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qtga.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qtiff.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qwbmp.dll"
Delete "$INSTDIR\qt5_plugins\imageformats\qwebp.dll"
Delete "$INSTDIR\qt5_plugins\platforms\qminimal.dll"
Delete "$INSTDIR\qt5_plugins\platforms\qoffscreen.dll"
Delete "$INSTDIR\qt5_plugins\platforms\qwindows.dll"
Delete "$INSTDIR\_bz2.pyd"
Delete "$INSTDIR\_ctypes.pyd"
Delete "$INSTDIR\_decimal.pyd"
@ -193,31 +229,44 @@ FunctionEnd
Delete "$INSTDIR\_multiprocessing.pyd"
Delete "$INSTDIR\_socket.pyd"
Delete "$INSTDIR\_ssl.pyd"
Delete "$INSTDIR\base_library.zip"
Delete "$INSTDIR\icudt53.dll"
Delete "$INSTDIR\icuin53.dll"
Delete "$INSTDIR\icuuc53.dll"
Delete "$INSTDIR\library.zip"
Delete "$INSTDIR\license.txt"
Delete "$INSTDIR\MSVCP100.dll"
Delete "$INSTDIR\MSVCR100.dll"
Delete "$INSTDIR\onionshare.exe"
Delete "$INSTDIR\onionshare.exe.manifest"
Delete "$INSTDIR\pyexpat.pyd"
Delete "$INSTDIR\PyQt5.Qt.pyd"
Delete "$INSTDIR\PyQt5.QtCore.pyd"
Delete "$INSTDIR\PyQt5.QtGui.pyd"
Delete "$INSTDIR\PyQt5.QtPrintSupport.pyd"
Delete "$INSTDIR\PyQt5.QtWidgets.pyd"
Delete "$INSTDIR\python34.dll"
Delete "$INSTDIR\pywintypes34.dll"
Delete "$INSTDIR\Qt5Core.dll"
Delete "$INSTDIR\Qt5Gui.dll"
Delete "$INSTDIR\Qt5PrintSupport.dll"
Delete "$INSTDIR\Qt5Svg.dll"
Delete "$INSTDIR\Qt5Widgets.dll"
Delete "$INSTDIR\select.pyd"
Delete "$INSTDIR\sip.pyd"
Delete "$INSTDIR\unicodedata.pyd"
Delete "$INSTDIR\version.txt"
Delete "$INSTDIR\win32wnet.pyd"
Delete "$INSTDIR\wordlist.txt"
Delete "$INSTDIR\uninstall.exe"
rmDir "$INSTDIR\html"
rmDir "$INSTDIR\images"
rmDir "$INSTDIR\Include"
rmDir "$INSTDIR\locale"
rmDir "$INSTDIR\platforms"
rmDir "$INSTDIR\qt5_plugins\iconengines"
rmDir "$INSTDIR\qt5_plugins\imageformats"
rmDir "$INSTDIR\qt5_plugins\platforms"
rmDir "$INSTDIR\qt5_plugins"
rmDir "$INSTDIR"
# remove uninstaller information from the registry

View File

@ -36,7 +36,7 @@ exe = EXE(
debug=False,
strip=False,
upx=True,
console=True)
console=False)
coll = COLLECT(
exe,