diff --git a/.gitignore b/.gitignore index f3d74a9..d554eba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.pyc *~ +src/build +src/dist diff --git a/src/scripts/ophis.nsi b/src/scripts/ophis.nsi new file mode 100644 index 0000000..5382375 --- /dev/null +++ b/src/scripts/ophis.nsi @@ -0,0 +1,158 @@ +; Script generated by the HM NIS Edit Script Wizard. + +; HM NIS Edit Wizard helper defines +!define PRODUCT_NAME "Ophis" +!define PRODUCT_VERSION "2.0 preview" +!define PRODUCT_PUBLISHER "Michael Martin" +!define PRODUCT_WEB_SITE "https://github.com/michaelcmartin/Ophis" +!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\ophis.exe" +!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" +!define PRODUCT_UNINST_ROOT_KEY "HKLM" +!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" + +; MUI 1.67 compatible ------ +!include "MUI.nsh" + +; MUI Settings +!define MUI_ABORTWARNING +!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" + +; Welcome page +!insertmacro MUI_PAGE_WELCOME +; License page +!define MUI_LICENSEPAGE_BUTTON "Install" +!define MUI_LICENSEPAGE_TEXT_BOTTOM "Press the Install button to continue." +!insertmacro MUI_PAGE_LICENSE "..\..\README" +; Directory page +!insertmacro MUI_PAGE_DIRECTORY +; Start menu page +var ICONS_GROUP +!define MUI_STARTMENUPAGE_NODISABLE +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Ophis" +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" +!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP +; Instfiles page +!insertmacro MUI_PAGE_INSTFILES +; Finish page +; !define MUI_FINISHPAGE_RUN "$INSTDIR\ophis.exe" +!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt" +!insertmacro MUI_PAGE_FINISH + +; Uninstaller pages +!insertmacro MUI_UNPAGE_INSTFILES + +; Language files +!insertmacro MUI_LANGUAGE "English" + +; MUI end ------ + +Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" +OutFile "Ophis-${PRODUCT_VERSION}-win32-installer.exe" +InstallDir "$PROGRAMFILES\Ophis" +InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" +ShowInstDetails show +ShowUnInstDetails show + +Section "Ophis" SEC01 + DetailPrint "Ensuring C++ Runtime is up to date..." + SetDetailsPrint none + InitPluginsDir + SetOutPath "$PLUGINSDIR" + File "..\..\vendor\vcredist_x86.exe" + ExecWait '"$PLUGINSDIR\vcredist_x86.exe" /q' + SetDetailsPrint both + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + File /oname=README.txt "..\..\README" + File "..\..\doc\ophismanual.pdf" + File "..\dist\ophis.exe" + File "..\dist\w9xpopen.exe" + SetOutPath "$INSTDIR\examples" + SetOverwrite try + File "..\..\doc\a2blink.map" + File "..\..\doc\a2inverse.map" + File "..\..\doc\a2normal.map" + File "..\..\doc\c64-1.oph" + File "..\..\doc\c64-2.oph" + File "..\..\doc\kernal.oph" + File "..\..\doc\petscii.map" + File "..\..\doc\tutor1.oph" + File "..\..\doc\tutor2.oph" + File "..\..\doc\tutor3.oph" + File "..\..\doc\tutor4a.oph" + File "..\..\doc\tutor4b.oph" + File "..\..\doc\tutor4c.oph" + File "..\..\doc\tutor5.oph" + File "..\..\doc\tutor6.oph" + File "..\..\doc\tutor7.oph" +SectionEnd + +Section -AdditionalIcons + SetOutPath $INSTDIR + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" + CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Manual.lnk" "$INSTDIR\ophismanual.pdf" + CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" + !insertmacro MUI_STARTMENU_WRITE_END +SectionEnd + +Section -Post + WriteUninstaller "$INSTDIR\uninst.exe" + WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\ophis.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\ophis.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" +SectionEnd + + +Function un.onUninstSuccess + HideWindow + MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." +FunctionEnd + +Function un.onInit + MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 + Abort +FunctionEnd + +Section Uninstall + !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP + Delete "$INSTDIR\uninst.exe" + Delete "$INSTDIR\examples\tutor7.oph" + Delete "$INSTDIR\examples\tutor6.oph" + Delete "$INSTDIR\examples\tutor5.oph" + Delete "$INSTDIR\examples\tutor4c.oph" + Delete "$INSTDIR\examples\tutor4b.oph" + Delete "$INSTDIR\examples\tutor4a.oph" + Delete "$INSTDIR\examples\tutor3.oph" + Delete "$INSTDIR\examples\tutor2.oph" + Delete "$INSTDIR\examples\tutor1.oph" + Delete "$INSTDIR\examples\petscii.map" + Delete "$INSTDIR\examples\kernal.oph" + Delete "$INSTDIR\examples\c64-2.oph" + Delete "$INSTDIR\examples\c64-1.oph" + Delete "$INSTDIR\examples\a2normal.map" + Delete "$INSTDIR\examples\a2inverse.map" + Delete "$INSTDIR\examples\a2blink.map" + Delete "$INSTDIR\w9xpopen.exe" + Delete "$INSTDIR\ophis.exe" + Delete "$INSTDIR\ophismanual.pdf" + Delete "$INSTDIR\README.txt" + + Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" + Delete "$STARTMENU\Manual.lnk" + + RMDir "$SMPROGRAMS\$ICONS_GROUP" + RMDir "$INSTDIR\examples" + RMDir "$INSTDIR" + + DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" + DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" + SetAutoClose true +SectionEnd \ No newline at end of file diff --git a/src/win_setup.py b/src/win_setup.py new file mode 100644 index 0000000..d5c682c --- /dev/null +++ b/src/win_setup.py @@ -0,0 +1,9 @@ +from distutils.core import setup +import py2exe, sys + +sys.argv.append('py2exe') + +setup(options = {'py2exe': {'bundle_files': 1}}, + packages = ['Ophis'], + zipfile = None, + console = [{'script': "scripts/ophis"}]) diff --git a/vendor/vcredist_x86.exe b/vendor/vcredist_x86.exe new file mode 100644 index 0000000..b8a3da8 Binary files /dev/null and b/vendor/vcredist_x86.exe differ