From a758d36a08befc36af35d1b4126f54b613eef753 Mon Sep 17 00:00:00 2001 From: Jordan ERNST Date: Thu, 7 Feb 2019 15:17:56 +0100 Subject: [PATCH] Created required files for distribution --- IF.ico | Bin 0 -> 1954 bytes Installer_Template.nsi | 189 +++++++++++++++++++++++++++++++++++++++++ installer-x64.cfg | 46 ++++++++++ installer-x86.cfg | 46 ++++++++++ installer.cfg | 14 --- 5 files changed, 281 insertions(+), 14 deletions(-) create mode 100644 IF.ico create mode 100644 Installer_Template.nsi create mode 100644 installer-x64.cfg create mode 100644 installer-x86.cfg delete mode 100644 installer.cfg diff --git a/IF.ico b/IF.ico new file mode 100644 index 0000000000000000000000000000000000000000..e745637f28a1ad451374782dd03f9fcd77b10c3e GIT binary patch literal 1954 zcmZQzU<5)CU}WH6=wWAI5CgJ11N_{1xum#&OkPh9mmr|*QV`}~1Bygldby5)fj!vM z#WAE}&f6OsyF$Yy+8&yoD@>cxqiop3Atz3Vx?QulPscc2 zICf2~g+)g#Q-@8&ByY7z(@{;n*H6!UjyZTdZbST!@@c7&Yz!=OX4^6_{8RU0Na+w_ zkX*##(5AsSL2)E-*QD{UsQmYS_Q%`t%QvUzoasIM`SJ7h{b}cK?3lj%{jv4>acAc- zX74Qjyt(jqck@l-WkO5)ZLBM8<^KIU|3*^!^W(4G=}KPp^Y`6-Ri0uUyL*S#=fI+U z%nHs^7)}VNG8nmVHt+;84Owo)SviK;1y2*o|CH2NRI{yl`fTav&FVhtUO7wG>%H$) zFW*1MmN{bbXW8MDYBtWYWiWgA*XY>n|M$)VWB=xTTl2E=wDmK*r`+)J_mAtBm-}xC z3XF?$UqAk5K0W>Xj8i}PhIBlmB~@^=fB1W~`Qvf@?P=#5w#MvzF#QephN<7m%a47$ zc<+tmfmw6j4~rCz=JVmn4cp9qrKUQy-sZ=<&o_t8&$I~^gOI# jcjy=?MLtp$_mNR`x6ylPe#hCsT9(1n)z4*}Q$iB}7^^0` literal 0 HcmV?d00001 diff --git a/Installer_Template.nsi b/Installer_Template.nsi new file mode 100644 index 0000000..3feb9df --- /dev/null +++ b/Installer_Template.nsi @@ -0,0 +1,189 @@ +!define PRODUCT_NAME "[[ib.appname]]" +!define PRODUCT_VERSION "[[ib.version]]" +!define PY_VERSION "[[ib.py_version]]" +!define PY_MAJOR_VERSION "[[ib.py_major_version]]" +!define BITNESS "[[ib.py_bitness]]" +!define ARCH_TAG "[[arch_tag]]" +!define INSTALLER_NAME "[[ib.installer_name]]" +!define PRODUCT_ICON "[[icon]]" + +; Marker file to tell the uninstaller that it's a user installation +!define USER_INSTALL_MARKER _user_install_marker + +Unicode true +InstallDir "C:\IFPass" + +SetCompressor lzma + +[% block modernui %] +; Modern UI installer stuff +!include "MUI2.nsh" +!define MUI_ABORTWARNING +!define MUI_ICON "[[icon]]" +!define MUI_UNICON "[[icon]]" + +; UI pages +[% block ui_pages %] +!insertmacro MUI_PAGE_WELCOME +[% if license_file %] +!insertmacro MUI_PAGE_LICENSE [[license_file]] +[% endif %] +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH +[% endblock ui_pages %] +!insertmacro MUI_LANGUAGE "French" +[% endblock modernui %] + +Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" +OutFile "${INSTALLER_NAME}" +ShowInstDetails show + +Section -SETTINGS + SetOutPath "$INSTDIR" + SetOverwrite ifnewer +SectionEnd + +[% block sections %] + +Section "!${PRODUCT_NAME}" sec_app + SetRegView [[ib.py_bitness]] + SetShellVarContext all + SectionIn RO + File ${PRODUCT_ICON} + SetOutPath "$INSTDIR\pkgs" + File /r "pkgs\*.*" + SetOutPath "$INSTDIR" + + [% block install_files %] + ; Install files + [% for destination, group in grouped_files %] + SetOutPath "[[destination]]" + [% for file in group %] + File "[[ file ]]" + [% endfor %] + [% endfor %] + + ; Install directories + [% for dir, destination in ib.install_dirs %] + SetOutPath "[[ pjoin(destination, dir) ]]" + File /r "[[dir]]\*.*" + [% endfor %] + [% endblock install_files %] + + [% block install_shortcuts %] + ; Install shortcuts + ; The output path becomes the working directory for shortcuts + SetOutPath "$INSTDIR" + [% if single_shortcut %] + [% for scname, sc in ib.shortcuts.items() %] + CreateShortCut "$SMPROGRAMS\[[scname]].lnk" "[[sc['target'] ]]" \ + '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]" + CreateShortCut "$DESKTOP\[[scname]].lnk" "[[sc['target'] ]]" \ + '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]" + [% endfor %] + [% else %] + [# Multiple shortcuts: create a directory for them #] + CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" + [% for scname, sc in ib.shortcuts.items() %] + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\[[scname]].lnk" "[[sc['target'] ]]" \ + '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]" + [% endfor %] + [% endif %] + SetOutPath "$INSTDIR" + [% endblock install_shortcuts %] + + [% block install_commands %] + [% if has_commands %] + DetailPrint "Setting up command-line launchers..." + nsExec::ExecToLog '[[ python ]] -Es "$INSTDIR\_assemble_launchers.py" "$INSTDIR\bin"' + [% endif %] + [% endblock install_commands %] + + ; Byte-compile Python files. + DetailPrint "Byte-compiling Python modules..." + nsExec::ExecToLog '[[ python ]] -m compileall -q "$INSTDIR\pkgs"' + WriteUninstaller $INSTDIR\uninstall.exe + ; Add ourselves to Add/remove programs + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "DisplayName" "${PRODUCT_NAME}" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "InstallLocation" "$INSTDIR" + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}" + [% if ib.publisher is not none %] + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "Publisher" "[[ib.publisher]]" + [% endif %] + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "DisplayVersion" "${PRODUCT_VERSION}" + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "NoModify" 1 + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ + "NoRepair" 1 + + ; Check if we need to reboot + IfRebootFlag 0 noreboot + MessageBox MB_YESNO "A reboot is required to finish the installation. Do you wish to reboot now?" \ + /SD IDNO IDNO noreboot + Reboot + noreboot: +SectionEnd + +Section "Uninstall" + SetRegView [[ib.py_bitness]] + SetShellVarContext all + + Delete $INSTDIR\uninstall.exe + Delete "$INSTDIR\${PRODUCT_ICON}" + RMDir /r "$INSTDIR\pkgs" + + ; Remove ourselves from %PATH% + [% block uninstall_commands %] + [% if has_commands %] + nsExec::ExecToLog '[[ python ]] -Es "$INSTDIR\_system_path.py" remove "$INSTDIR\bin"' + [% endif %] + [% endblock uninstall_commands %] + + [% block uninstall_files %] + ; Uninstall files + [% for file, destination in ib.install_files %] + Delete "[[pjoin(destination, file)]]" + [% endfor %] + ; Uninstall directories + [% for dir, destination in ib.install_dirs %] + RMDir /r "[[pjoin(destination, dir)]]" + [% endfor %] + [% endblock uninstall_files %] + + [% block uninstall_shortcuts %] + ; Uninstall shortcuts + [% if single_shortcut %] + [% for scname in ib.shortcuts %] + Delete "$SMPROGRAMS\[[scname]].lnk" + Delete "$DESKTOP\[[scname]].lnk" + [% endfor %] + [% else %] + RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}" + [% endif %] + [% endblock uninstall_shortcuts %] + RMDir $INSTDIR + DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" +SectionEnd + +[% endblock sections %] + +; Functions + +Function .onMouseOverSection + ; Find which section the mouse is over, and set the corresponding description. + FindWindow $R0 "#32770" "" $HWNDPARENT + GetDlgItem $R0 $R0 1043 ; description item (must be added to the UI) + + [% block mouseover_messages %] + StrCmp $0 ${sec_app} "" +2 + SendMessage $R0 ${WM_SETTEXT} 0 "STR:${PRODUCT_NAME}" + + [% endblock mouseover_messages %] +FunctionEnd diff --git a/installer-x64.cfg b/installer-x64.cfg new file mode 100644 index 0000000..a7f18dd --- /dev/null +++ b/installer-x64.cfg @@ -0,0 +1,46 @@ +[Application] +name=IFPass +version=2.2 +entry_point=IFPass:main +icon=IF.ico +console=true +license_file=LICENSE + +[Python] +version=3.7.1 +bitness=64 + +[Include] +# Packages from PyPI that your application requires, one per line +# These must have wheels on PyPI: +pypi_wheels=code128==0.3 + colorama==0.4.1 + pyfiglet==0.8.post1 + numpy==1.16.1 + opencv-python==4.0.0.21 + Pillow==5.4.1 + pywin32==224 + six==1.12.0 + setuptools==40.7.3 +# Must check if future updates of the following packages provide .whl files +# pywinauto needs to be downloaded manually and edit setup to match platform=win32 +# Packages without wheels (Must be installed locally): +packages=PyPDF2 + pywinauto + termcolor + +# Other files and folders that should be installed +files = LICENSE + Templates + +# This optional section adds a command which can be run from the Windows +# command prompt. +[Command IFPass] +entry_point=IFPass:main + +[Build] +directory=build/x64 +installer_name=${PRODUCT_NAME}_${PRODUCT_VERSION}-x64.exe +# Custom Installer : +# Added Desktop shortcut, modified working directory, modified default install and utf-8... +nsi_template=Installer_Template.nsi diff --git a/installer-x86.cfg b/installer-x86.cfg new file mode 100644 index 0000000..8a1ffff --- /dev/null +++ b/installer-x86.cfg @@ -0,0 +1,46 @@ +[Application] +name=IFPass +version=2.2 +entry_point=IFPass:main +icon=IF.ico +console=true +license_file=LICENSE + +[Python] +version=3.7.1 +bitness=32 + +[Include] +# Packages from PyPI that your application requires, one per line +# These must have wheels on PyPI: +pypi_wheels=code128==0.3 + colorama==0.4.1 + pyfiglet==0.8.post1 + numpy==1.16.1 + opencv-python==4.0.0.21 + Pillow==5.4.1 + pywin32==224 + six==1.12.0 + setuptools==40.7.3 +# Must check if future updates of the following packages provide .whl files +# pywinauto needs to be downloaded manually and edit setup to match platform=win32 +# Packages without wheels (Must be installed locally): +packages=PyPDF2 + pywinauto + termcolor + +# Other files and folders that should be installed +files = LICENSE + Templates + +# This optional section adds a command which can be run from the Windows +# command prompt. +[Command IFPass] +entry_point=IFPass:main + +[Build] +directory=build/x86 +installer_name=${PRODUCT_NAME}_${PRODUCT_VERSION}-x86.exe +# Custom Installer : +# Added Desktop shortcut, modified working directory, modified default install and utf-8... +nsi_template=Installer_Template.nsi diff --git a/installer.cfg b/installer.cfg deleted file mode 100644 index 633f2ef..0000000 --- a/installer.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[Application] -name=IFPass -version=2.2 -entry_point=IFPass:main - -[Python] -version=3.7.1 - -[Include] -# Packages from PyPI that your application requires, one per line -# These must have wheels on PyPI: - -# Other files and folders that should be installed -files = LICENSE