initial commit

This commit is contained in:
Kevin Dorner 2021-03-04 17:14:03 +01:00 committed by root
parent f54872f205
commit 8fe373ffe2
6 changed files with 186 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.exe
/data/

31
Makefile Normal file
View File

@ -0,0 +1,31 @@
#Config
UPSTREAM_VERSION = 3.9.2
PKG_SUB_RELEASE = 1.0
PKG_FULL_VERSION = ${UPSTREAM_VERSION}-${PKG_SUB_RELEASE}
SOURCE = https://www.python.org/ftp/python/${UPSTREAM_VERSION}/python-${UPSTREAM_VERSION}-amd64.exe
CHECKSUM = efb20aa1b648a2baddd949c142d6eb06
## Download Link and Checksums can be found on https://www.python.org/downloads/windows/
all: clean install
install: setversion
@[ -d "./data/" ] || mkdir ./data/
@echo "INFO: Downloading the Git for Windows executable..."
@wget -O ./data/python-${UPSTREAM_VERSION}-amd64.exe ${SOURCE}
@echo "${CHECKSUM} ./data/python-${UPSTREAM_VERSION}-amd64.exe" | md5sum -c && echo "SUCCESS: Checksums match" || { ec=$$?; echo "ERROR: Checksum mismatch" >&2; rm -rf ./data/ >&2; exit $$ec; }
@echo "SUCCESS: Installed Successfully"
clean:
@echo "INFO: Cleaning ./data/"
@rm -rf ./data/
@[ ! -d "./data/" ] && echo "SUCCESS: Cleaned"
setversion:
@echo "INFO: Writing version ${PKG_FULL_VERSION} to control file"
@sed -i "s/^version: [0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$$/version: ${UPSTREAM_VERSION}/" ./control
@sed -i "s/^packageVersion: [0-9]\{1,3\}\.[0-9]\{1,3\}$$/packageVersion: ${PKG_SUB_RELEASE}/" ./control
package:
@echo "MEEP!"
.PHONY: all install clean setversion package

37
control Normal file
View File

@ -0,0 +1,37 @@
[Product]
type: localboot
id: mdg-python
name: MDG Python
description: Python für Microsoft Windows mit pip-Unterstützung
advice: Vereinfachtes Paket mit neuer Python-Version und funktionsfähiger pip-Unterstützung
version: 3.9.2
packageVersion: 1.0
setupScript: install.ins
uninstallScript: remove.ins
[ProductProperty]
name: shortcut
type: bool
description: Startmenü Verknüpfungen erstellen
default: True
[ProductProperty]
name: associatefiles
type: bool
description: Assoziere Python-Dateiendungen
helptext: Zu den Python-Dateiendungen gehören u. a. ".py", ".pyw", ".pyc". Doppelklick auf Python-Dateien im Windows-Explorer nutzt dann den Python-Launcher.
default: True
[ProductProperty]
name: prependpath
type: bool
description: Python zum PATH hinzufügen
helptext: Fügt Python selbst und zugehörige Skripte zum systemweiten PATH hinzu. Dies erlaubt das direkte Verwenden von Python-Werkzeugen in der Kommandozeile.
default: True
[ProductProperty]
name: pippackages
type: unicode
description: Installiere pip Pakete
helptext: Die Pakete werden mit jeder Installation des Programms installiert oder aktualisiert. Zum Hinzufügen von neuen Pakten kann einfach eine Neuinstallation vorgenommen werden. Die Pakete werden mit einem Leerzeichen getrennt und können auf https://pypi.org/ gefunden werden. Diese Pakete werden systemweit installiert. Durch Nutzer installierte Pakete werden im jeweiligen Appdata Verzeichnis installiert.
pattern: numpy scikit-learn rsa

85
install.ins Normal file
View File

@ -0,0 +1,85 @@
[Initial]
Message=Installiere Python...
DefVar $Version$
DefVar $ExitCode$
DefVar $AssociateFiles$
DefVar $AssociateFilesArguments$
DefVar $CreateShortcut$
DefVar $ShortcutArgument$
DefVar $PrependPath$
DefVar $PrependPathArgument$
DefVar $PackageList$
[Aktionen]
ShowBitmap "%ScriptPath%\logo.png" "MDG Python"
Sub_GetProperties
Sub_ConfigureProperties
WinBatch_Uninstall
Files_Cleanup
WinBatch_Setup
WinBatch_UpdatePip
Sub_CheckPackages
Sub_HandleExitCode
[Sub_GetProperties]
Set $Version$ = GetValue("productversion", GetProductMap)
Set $AssociateFiles$ = GetProductProperty("associatefiles", "true")
Set $CreateShortcut$ = GetProductProperty("shortcut", "true")
Set $PrependPath$ = GetProductProperty("prependpath", "true")
Set $PackageList$ = GetProductProperty("pippackages", "")
[Sub_ConfigureProperties]
if ($AssociateFiles$ = "true")
Set $AssociateFilesArguments$ = "AssociateFiles=1"
else
Set $AssociateFilesArguments$ = "AssociateFiles=0"
endif
if ($CreateShortcut$ = "true")
Set $ShortcutArgument$ = "Shortcuts=1"
else
Set $ShortcutArgument$ = "Shortcuts=0"
endif
if ($PrependPath$ = "true")
Set $PrependPathArgument$ = "PrependPath=1"
else
Set $PrependPathArgument$ = "PrependPath=0"
endif
[WinBatch_Uninstall]
; First uninstall Python due to an upstream issue with the installer on existing installations: https://bugs.python.org/issue41800
"%ScriptPath%\data\python-$Version$-amd64.exe" /quiet /uninstall
[Files_Cleanup]
; This ensures all data has been removed
delete -sf "%ProgramFiles64Dir%\python39\"
[WinBatch_Setup]
; https://docs.python.org/3/using/windows.html#installing-without-ui
"%ScriptPath%\data\python-$Version$-amd64.exe" /passive InstallAllUsers=1 InstallLauncherAllUsers=1 $AssociateFilesArguments$ $ShortcutArgument$ $PrependPathArgument$ /log "%opsiLogDir%\python-install.log"
[WinBatch_UpdatePip]
"%ProgramFiles64Dir%\python39\python.exe" -m pip install --upgrade pip
[Sub_CheckPackages]
if not($PackageList$ = "")
WinBatch_Packages
endif
[WinBatch_Packages]
"%ProgramFiles64Dir%\python39\Scripts\pip.exe" install -U $PackageList$
[Sub_HandleExitCode]
; check return code
Set $ExitCode$ = GetLastExitCode
comment "GetLastExitCode: " + $ExitCode$
if not($ExitCode$ = "0" or $ExitCode$ = "3010" or $ExitCode$ = "2359302" or $ExitCode$ = "2359297")
; 0 ERROR_SUCCESS
; 3010 ERROR_SUCCESS_REBOOT_REQUIRED
; List of WUSA ExitCodes: https://support.microsoft.com/en-us/kb/938205
; 2359297 (WUSA ExitCode, Hex: 0x240001) WU_S_SERVICE_STOP
; 2359302 (WUSA ExitCode, Hex: 0x00240006) WU_S_ALREADY_INSTALLED
LogError "Fatal: setup returned exit code " + $ExitCode$
IsFatalError
endif

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

31
remove.ins Normal file
View File

@ -0,0 +1,31 @@
[Initial]
Message=Deinstalliere Python...
DefVar $ExitCode$
DefVar $Version$
[Aktionen]
ShowBitmap "%ScriptPath%\logo.png" "MDG Python"
Sub_PrepareSetup
WinBatch_Setup
Files_Cleanup
[Sub_PrepareSetup]
Set $Version$ = GetValue("productversion", GetProductMap)
[WinBatch_Setup]
"%ScriptPath%\data\python-$Version$-amd64.exe" /quiet /uninstall
[Files_Cleanup]
delete -sf "%ProgramFiles64Dir%\Python39\"
[Sub_HandleExitCode]
; check return code
Set $ExitCode$ = GetLastExitCode
comment "GetLastExitCode: " + $ExitCode$
if not($ExitCode$ = "0" or $ExitCode$ = "1605" or $ExitCode$ = "3010")
; 0 ERROR_SUCCESS
; 1605 ERROR_UNKNOWN_PRODUCT
; 3010 ERROR_SUCCESS_REBOOT_REQUIRED
LogError "Fatal: setup returned exit code " + $ExitCode$
IsFatalError
endif