summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2016-04-02 05:46:13 -0500
committerDwayne Litzenberger <dlitz@dlitz.net>2016-04-02 05:46:13 -0500
commit5c0824bdceafb2df0fb9c5c07260a654345dac0d (patch)
tree69e7b00d1e31371547fa945cdcf32d47fa3bf66f
parent15a270e80851932b83f29114502bee67823c4b5f (diff)
downloadpycrypto-5c0824bdceafb2df0fb9c5c07260a654345dac0d.tar.gz
AutoIt3 script for installing python <= 2.3 on Windows
-rw-r--r--tools/PythonInstall.au385
-rw-r--r--tools/PythonInstall.exebin0 -> 860160 bytes
-rw-r--r--tools/win-create-pythons.sh10
3 files changed, 91 insertions, 4 deletions
diff --git a/tools/PythonInstall.au3 b/tools/PythonInstall.au3
new file mode 100644
index 0000000..704de7d
--- /dev/null
+++ b/tools/PythonInstall.au3
@@ -0,0 +1,85 @@
+#RequireAdmin
+#pragma compile(ExecLevel, requireAdministrator)
+#pragma compile(Out, PythonInstall.exe)
+#pragma compile(Console, true)
+
+Const $iTimeout = 10
+Const $iInstallTimeout = 900
+
+
+;Const $sProcName = "Python-2.1.2.exe"
+Const $sProcName = $CmdLine[2]
+Local $pid = ProcessExists($sProcName)
+If Not $pid Then
+ $pid = Run($sProcName)
+ If @error Then
+ ; TODO
+ EndIf
+EndIf
+
+Const $sWinTitle = "[REGEXPTITLE:Python 2.[123].[0-9]+ Installation]"
+;Const $sDestDir = "C:\Python21"
+Const $sDestDir = $CmdLine[1]
+
+; Wait for the wizard window to open
+Local $hWnd = WinWait($sWinTitle, "&Next >", $iTimeout)
+If Not IsHWnd($hWnd) Then
+ ; TODO
+EndIf
+
+; Activate the window for good measure.
+If Not IsHWnd(WinActivate($hWnd, "")) Then
+ ; TODO
+EndIf
+
+Local $stepDestDir = False
+Local $stepDestDirSet = False
+Local $stepAlreadyExists = False
+Local $stepReplacedFiles = False
+Local $stepSelectComponents = False
+Local $stepSelectStartMenuGroup = False
+Local $stepReadyToInstall = False
+Local $stepFinish = False
+Local $timeout = False
+
+Local $hTimer = TimerInit()
+While IsHWnd(WinGetHandle($hWnd)) Or Not $stepFinish
+ Select
+ Case Not $stepDestDirSet And ControlSetText($sWinTitle, "Select Destination Directory", "[CLASS:Edit; INSTANCE:1]", $sDestDir)
+ $stepDestDirSet = True
+ Case Not $stepDestDir And $stepDestDirSet And ControlSend($sWinTitle, "Select Destination Directory", "&Next >", "!n")
+ $stepDestDir = True
+ Case Not $stepAlreadyExists And ControlClick("Install", "The directory " & $sDestDir & " already exists", "Yes")
+ $stepAlreadyExists = True
+ Case Not $stepReplacedFiles And ControlSend($sWinTitle, "Backup Replaced Files", "&Next >", "!o!n") ; "o" -- No, don't do backups
+ $stepReplacedFiles = True
+ Case Not $stepSelectComponents And ControlSend($sWinTitle, "Select Components", "&Next >", "!n")
+ $stepSelectComponents = True
+ Case Not $stepSelectStartMenuGroup And ControlSend($sWinTitle, "Select Start Menu Group", "&Next >", "!n")
+ $stepSelectStartMenuGroup = True
+ Case Not $stepReadyToInstall And ControlSend($sWinTitle, "Ready to Install!", "&Next >", "!n") ; DEBUG FIXME
+ $stepReadyToInstall = True
+ Case Not $stepFinish And ControlSend($sWinTitle, "Installation Completed!", "&Finish", "!f")
+ $stepFinish = True
+ Case Not ProcessExists($pid)
+ ExitLoop
+ Case TimerDiff($hTimer) >= $iInstallTimeout * 1000
+ $timeout = True
+ ExitLoop
+ EndSelect
+ Sleep(250)
+ ; TODO - Timeout
+WEnd
+
+If $timeout Then
+ ; TODO
+EndIf
+
+If Not $stepFinish Then
+ ; TODO
+EndIf
+
+Local $success = ProcessWaitClose($pid, $iTimeout)
+If Not $success Then
+ ; TODO
+EndIf
diff --git a/tools/PythonInstall.exe b/tools/PythonInstall.exe
new file mode 100644
index 0000000..b3dd737
--- /dev/null
+++ b/tools/PythonInstall.exe
Binary files differ
diff --git a/tools/win-create-pythons.sh b/tools/win-create-pythons.sh
index 90cf920..eff6d6b 100644
--- a/tools/win-create-pythons.sh
+++ b/tools/win-create-pythons.sh
@@ -23,7 +23,8 @@
# Designed to run under "Git Bash" (mingw bash) on Windows
set -e
-PREFIX=${PREFIX:-$(perl -e 'use Cwd; use File::Basename; print dirname(Cwd::abs_path($ARGV[0]));' "$0")/py}
+toolsdir=$(perl -e 'use Cwd; use File::Basename; print dirname(Cwd::abs_path($ARGV[0]));' "$0")
+PREFIX=${PREFIX:-$toolsdir/py}
# Unexport vars
export -n PREFIX
@@ -90,9 +91,10 @@ EOF
# Install
#
set -x
-cmd //c Python-2.1.2.exe
-cmd //c Python-2.2.3.exe
-cmd //c Python-2.3.5.exe
+cp -f "$toolsdir"/PythonInstall.exe .
+cmd //c PythonInstall.exe C:\\Python21 Python-2.1.2.exe
+cmd //c PythonInstall.exe C:\\Python22 Python-2.2.3.exe
+cmd //c PythonInstall.exe C:\\Python23 Python-2.3.5.exe
msiexec //passive //i python-2.4.4.msi ALLUSERS=1
msiexec //passive //i python-2.5.4.msi ALLUSERS=1
msiexec //passive //i python-2.5.4.amd64.msi ALLUSERS=1 TARGETDIR=C:\\Python25-64\\