From b8fa7fdc4915df172d64bfc42646c60427740ba6 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Tue, 30 Apr 2019 22:02:17 +0800 Subject: [PATCH] Python: Use install script instead of original installer (#6) --- bucket/python.json | 48 ++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/bucket/python.json b/bucket/python.json index f10b0ef588..a03f4864a6 100644 --- a/bucket/python.json +++ b/bucket/python.json @@ -1,34 +1,40 @@ { "homepage": "https://www.python.org/", - "license": "https://docs.python.org/3/license.html", + "description": "A programming language that lets you work quickly and integrate systems more effectively.", + "license": "Python-2.0", "version": "3.7.3", + "depends": "dark", "architecture": { "64bit": { - "url": "https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64.exe#/py3.exe", + "url": "https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64.exe", "hash": "md5:a2b79563476e9aa47f11899a53349383" }, "32bit": { - "url": "https://www.python.org/ftp/python/3.7.3/python-3.7.3.exe#/py3.exe", + "url": "https://www.python.org/ftp/python/3.7.3/python-3.7.3.exe", "hash": "md5:ebf1644cdc1eeeebacc92afa949cfc01" } }, "installer": { - "args": [ - "/quiet", - "InstallAllUsers=$(@{$true=1;$false=0}[$global])", - "TargetDir=\"$dir\"", - "AssociateFiles=0", - "Shortcuts=0", - "InstallLauncherAllUsers=$(@{$true=1;$false=0}[$global])" - ], - "keep": true + "script": [ + "&(file_path dark dark.exe) -nologo -x \"$dir\\_tmp\" \"$dir\\$fname\" | Out-Null", + "@('launcher.msi', 'path.msi', 'pip.msi') | ForEach-Object {", + " Remove-Item \"$dir\\_tmp\\AttachedContainer\\$_\"", + "}", + "(Get-ChildItem \"$dir\\_tmp\\AttachedContainer\\*.msi\").FullName | ForEach-Object { Expand-MSIArchive $_ \"$dir\" }", + "Remove-Item \"$dir\\_tmp\", \"$dir\\$fname\" -Force -Recurse", + "& \"$dir\\python.exe\" -E -s -m ensurepip -U --default-pip | Out-Null", + "if ($global) {", + " $pathext = (env 'PATHEXT' $true) -replace ';.PYW?', ''", + " env 'PATHEXT' $true \"$pathext;.PY;.PYW\"", + "}" + ] }, "uninstaller": { - "file": "py3.exe", - "args": [ - "/uninstall", - "/quiet", - "InstallAllUsers=0" + "script": [ + "if ($global) {", + " $pathext = (env 'PATHEXT' $true) -replace ';.PYW?', ''", + " env 'PATHEXT' $true \"$pathext\"", + "}" ] }, "bin": [ @@ -44,7 +50,7 @@ "idle3" ] ], - "env_add_path": "scripts", + "env_add_path": "Scripts", "checkver": { "url": "https://www.python.org/downloads/windows/", "re": "Latest Python 3 Release - Python ([\\d\\.]+)" @@ -52,15 +58,15 @@ "autoupdate": { "architecture": { "64bit": { - "url": "https://www.python.org/ftp/python/$version/python-$version-amd64.exe#/py3.exe" + "url": "https://www.python.org/ftp/python/$version/python-$version-amd64.exe" }, "32bit": { - "url": "https://www.python.org/ftp/python/$version/python-$version.exe#/py3.exe" + "url": "https://www.python.org/ftp/python/$version/python-$version.exe" } }, "hash": { "url": "https://www.python.org/downloads/release/python-$cleanVersion/", - "find": "\\s+Windows\\s+.*\\s+([A-Fa-f\\d]{32})" + "find": "$basename[\\S\\s]+?$md5" } } }