Index: dev/install_python_gtk.ps1 ================================================================== --- dev/install_python_gtk.ps1 +++ dev/install_python_gtk.ps1 @@ -15,10 +15,11 @@ [CmdletBinding()] Param( [string]$reinstall = "ask", [string]$TEMP = $env:TEMP, [string]$PYTHON = "C:\Python27", + [string]$PythonGUID = "{4A656C6C-D24A-473F-9747-3A8D00907A03}", #Python 2.7.13 [string]$StartMenu = "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs", #[string]$UsrFolder = $MyInvocation.MyCommand.Path -replace ("([\\/][^\\/]+){4}$",""), [string]$ProgramFiles = "%ProgramFiles(x86)%", [string]$AboutLink = "http://freshcode.club/projects/streamtuner2", [string]$VERSION = "2.2.0" @@ -43,15 +44,15 @@ New-Variable -Name STREAMRIPPER -Option AllScope -Value "$ProgramFiles\Streamripper" #can be changed in Check-Prerequisites #-- what and how to install (hash list as used by Run-Task and Check-Prerequisites) $tasks = @( @{ - title = "Python 2.7.12" - url = "https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi" + title = "Python 2.7.13" + url = "https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi" cmd = "" iargs = 'TARGETDIR="{PYTHON}" /qb-!' - regkey = "$regPathLM\{9DA28CE5-0AA5-429E-86D8-686ED898C665}" + regkey = "$regPathLM\$PythonGUID" testpth= "{PYTHON}\pythonw.exe" is_opt = '' prescn = '' }, @{ @@ -93,47 +94,85 @@ cmd = "" iargs = "/S /D={STREAMRIPPER}" #NSIS does not use double quotes in /D parm regkey = "$regPathLM\Streamripper" testpth= "{STREAMRIPPER}\streamripper.exe" is_opt = '($optionalInstall)' # ← could use '((Ask "Install streamripper too [y/N]") -match N)' instead - prescn = 'if ($optionalInstall) {if ($t.found = (Get-ITPV "Streamripper")) {$STREAMRIPPER = $_found}} else {$STREAMRIPPER=""; continue;}' + prescn = 'if ($optionalInstall) {if ($t.found = (Get-ITPV "Streamripper")) {$STREAMRIPPER = $t.found}} else {$STREAMRIPPER=""; continue;}' + }, + @{ + title = "Mutagen (ID3-Support)" + url = "mutagen" # no download url + cmd = "pip" + iargs = "--disable-pip-version-check" + testpth= "{PYTHON}\Lib\site-packages\mutagen-1*py2.7.egg-info" + is_opt = '($optionalInstall)' + prescn = 'if ($optionalInstall) {if ($t.found = (test-path -path $t.testpth)) {$t.found = $t.testpth}} else {continue}' }, @{ title = "Uninstall script" cmd = 'Create-Uninstallscript' }, @{ title = "Desktop shortcut" - cmd = 'Make-Shortcut -dir $Home\Desktop -name Streamtuner2.lnk -target $PYTHON\pythonw.exe -arg $UsrFolder\bin\streamtuner2' + cmd = 'Make-Shortcut @task' + dir = "$Home\Desktop" + name = "Streamtuner2.lnk" + target = "$PYTHON\pythonw.exe" + arg = "$UsrFolder\bin\streamtuner2" }, @{ title = "Startmenu shortcut" - cmd = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name Streamtuner2.lnk -target $PYTHON\pythonw.exe -arg $UsrFolder\bin\streamtuner2' + cmd = 'Make-Shortcut @task' + dir = "$StartMenu\Streamtuner2" + name = "Streamtuner2.lnk" + target = "$PYTHON\pythonw.exe" + arg = "$UsrFolder\bin\streamtuner2" }, @{ title = "Startmenu help.chm" - cmd = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name Help.lnk -target $UsrFolder\share\streamtuner2\help\help.chm' + cmd = 'Make-Shortcut @task' + dir = "$StartMenu\Streamtuner2" + name = "Help.lnk" + target = "$UsrFolder\share\streamtuner2\help\help.chm" }, @{ title = "Startmenu uninstall" - cmd = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name Uninstall.lnk -target $UninstallPath' + cmd = 'Make-Shortcut @task' + dir = "$StartMenu\Streamtuner2" + name = "Uninstall.lnk" + target = "$UninstallPath" }, @{ title = "Startmenu Internet" - cmd = 'Make-Shortcut -dir "$StartMenu\Streamtuner2" -name "Streamtuner2 on the Web.lnk" -target "$AboutLink"' + cmd = 'Make-Shortcut @task' + dir = "$StartMenu\Streamtuner2" + name = "Streamtuner2 on the Web.lnk" + target = "$AboutLink" }, @{ title = "Startmenu Reconfigure" - cmd = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Extra" -name "Reconfigure.lnk" -target $ModifyPath' + cmd = 'Make-Shortcut @task' + dir = "$StartMenu\Streamtuner2\Extra" + name = "Reconfigure.lnk" + target = "$ModifyPath" }, @{ title = "Startmenu RunDebug" - cmd = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Extra" -name "Run in debug mode (-D).lnk" -target $PYTHON\python.exe -arg "$UsrFolder\bin\streamtuner2" -parm "-D"' + cmd = 'Make-Shortcut @task' + dir = "$StartMenu\Streamtuner2\Extra" + name = "Run in debug mode (-D).lnk" + target = "$PYTHON\python.exe" + arg = "$UsrFolder\bin\streamtuner2" + parm = "-D" }, @{ title = "Startmenu RunConsole" - cmd = 'Make-Shortcut -dir "$StartMenu\Streamtuner2\Extra" -name "Run with console.lnk" -target $PYTHON\python.exe -arg "$UsrFolder\bin\streamtuner2"' + cmd = 'Make-Shortcut @task' + dir = "$StartMenu\Streamtuner2\Extra" + name = "Run with console.lnk" + target = "$PYTHON\python.exe" + arg = "$UsrFolder\bin\streamtuner2" }, @{ title = "Startmenu ResetPrefs" cmd = 'Make-Shortcut @task' dir = "$StartMenu\Streamtuner2\Extra" @@ -163,11 +202,11 @@ | ___\///////////___________\///________\///////////////__ | | | | | | Streamtuner2 for Windows Version $VERSION | | | -| Installer for Python 2.7.12 & Gtk 2.24.2 | +| Installer for Python 2.7.13 & Gtk 2.24.2 | ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– "@ } function Ask-First { Write-Host "" @@ -222,11 +261,10 @@ # update uninstall.cmd with current values $installFolder = $usrFolder.substring(0,$usrFolder.LastIndexOf('\')) $UninstallScript = Get-Content -Path $UninstallPath Out-File -FilePath $UninstallPath -Encoding ascii -InputObject @" @set installFolder=$installFolder -@set usrFolder=$usrFolder @set Python=$PYTHON @set StreamripperFolder=$STREAMRIPPER "@ $UninstallScript | %{if ($_ -notmatch "@set") {Out-File -FilePath $UninstallPath -Encoding ascii -Append -InputObject $_}} # registry entry for ST2 @@ -287,12 +325,12 @@ #-- Check if previous Python 2.7 installation exists function Check-PythonInstall { $PythonInstalledPath = Get-ITPV('Python\PythonCore\2.7\InstallPath\') - #-- if Python 2.7.12 installed, reuse installation folder - if (Get-Item -path "$regPathLM\{9DA28CE5-0AA5-429E-86D8-686ED898C665}" 2> $null ) { + #-- if Python 2.7.13 installed, reuse installation folder + if (Get-Item -path "$regPathLM\$PythonGUID" 2> $null ) { $PYTHON = $pythonInstalledPath -replace "\\$", "" } #-- older 2.7 version found else { @@ -375,10 +413,12 @@ filter Run-Task { # extract flags/vars from $tasks pipe $title=""; $cmd=""; $url=""; $iargs=""; $testpth=""; $regkey=""; $is_opt=""; $prescn=""; $found="" ($task = $_).GetEnumerator() | % { Set-Variable -Scope Local -Name $_.key -Value ([regex]::Replace($_.value, "[#{](\w+)[}#]", { param($m) Invoke-Expression ("$"+$m.Groups[1].Value) })) } +# $iargs = $iargs -replace "{PYTHON}","$PYTHON" + # skip optionals if ($is_opt -AND !(Invoke-Expression $is_opt)) { return } # print step if ($title -match "\d+\.\d+") { $title = "Installing $title" } @@ -409,18 +449,23 @@ # run shorthand or custom command if ($cmd) { if (Test-Path $PYTHON) { chdir($PYTHON) } if ($cmd -eq "pip") { - $cmd = "& `"$PYTHON\Scripts\pip.exe`" install $TEMP\$file", $iargs #" + if (!($file)) { + $cmd = "& `"$PYTHON\Scripts\pip.exe`" install $url", $iargs + } + else { + $cmd = "& `"$PYTHON\Scripts\pip.exe`" install $TEMP\$file", $iargs + } } elseif ($cmd -match "^(easy|easy_install|silent)$") { if (!($file)) { - $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $url" #" + $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $url", $iargs } else { - $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $TEMP\$file" #" + $cmd = "& `"$PYTHON\Scripts\easy_install.exe`" $TEMP\$file", $iargs } } Write-Host -f DarkGray " → $cmd" Invoke-Expression "$cmd" } Index: dev/resetprefs.cmd ================================================================== --- dev/resetprefs.cmd +++ dev/resetprefs.cmd @@ -57,11 +57,11 @@ :NotRunning echo Your personal files are in %PrefsFolder% echo. echo This will delete all settings of %ST2%, all cached files... -echo ...and the downloaded plug-ins. +echo ...the downloaded plug-ins and Gtk themes. echo If you want to save your bookmarks before, then quit now and come back later! echo. echo. echo | set /p=Do you want to clear all settings of %ST2% now? [y/N] set /P INPUT=%=% Index: dev/uninstall.cmd ================================================================== --- dev/uninstall.cmd +++ dev/uninstall.cmd @@ -1,7 +1,6 @@ @set installFolder=Do_not_Change -@set usrFolder=Do_not_Change @set Python=Do_not_Change @set StreamripperFolder=Do_not_Change @echo off set ST2=Streamtuner2 @@ -44,11 +43,11 @@ setlocal enableextensions cd /d "%~dp0" if NOT "%cd%" == "%TEMP%" ( - copy "%UsrFolder%\share\streamtuner2\dev\uninstall.cmd" "%temp%\STuninst.cmd" + copy "%installFolder%\usr\share\streamtuner2\dev\uninstall.cmd" "%temp%\STuninst.cmd" "%temp%\STuninst.cmd" ) tasklist /fi "Imagename eq python.exe" /fi "Windowtitle eq %ST2%*" /v | find "%ST2%" >nul if %errorlevel% EQU 0 goto ST2isRunning @@ -108,16 +107,20 @@ :uninstallPython if '%Pythonrun%' EQU 'Y' ( echo Skipping uninstall of Python goto uninstallST2 ) -echo | set /p=Do you want to keep your Python 2.7.12 installation? [Y/n] +echo | set /p=Do you want to keep your Python 2.7.13 installation? [Y/n] set /P INPUT=%=% If /I '%INPUT%' == 'N' ( echo Uninstalling Python... echo Removing PIL 1.1.7 "%Python%\RemovePIL.exe" -u "%Python%\PIL-wininst.log" + if exist "%Python%\Lib\site-packages\mutagen-1*py2.7.egg-info" ( + echo Removing Mutagen + "%Python%\scripts\pip.exe" uninstall mutagen -y -q + ) echo Removing pyquery 1.2.17 "%Python%\scripts\pip.exe" uninstall pyquery -y -q echo Removing LXML 2.3 "%Python%\scripts\pip.exe" uninstall lxml -y -q echo Removing requests @@ -124,16 +127,18 @@ "%Python%\scripts\pip.exe" uninstall requests -y -q echo Removing cssselect "%Python%\scripts\pip.exe" uninstall cssselect -y -q echo Removing PyGtk 2.24.2 MsiExec.exe /x{09F82967-D26B-48AC-830E-33191EC177C8} /qb-! - echo Removing Python 2.7.12 reg delete %RegUninstallBase%\{09F82967-D26B-48AC-830E-33191EC177C8} /f 1>nul 2>&1 - MsiExec.exe /x{9DA28CE5-0AA5-429E-86D8-686ED898C665} /qb-! + echo Removing Python 2.7.13 + MsiExec.exe /x{4A656C6C-D24A-473F-9747-3A8D00907A03} /qb-! reg delete HKCU\SOFTWARE\Python\PythonCore\2.7 /f 1>nul 2>&1 - reg delete %RegUninstallBase%\{9DA28CE5-0AA5-429E-86D8-686ED898C665} /f 1>nul 2>&1 + reg delete %RegUninstallBase%\{4A656C6C-D24A-473F-9747-3A8D00907A03} /f 1>nul 2>&1 rd "%Python%" /S /Q + echo Removing installed Gtk2-Themes + rd "%APPDATA%\streamtuner2\themes" /S /Q ) :uninstallST2 echo Removing %ST2%... rd "%installFolder%" /S /Q