diff options
| author | Oskari Timperi <oswjk@users.noreply.github.com> | 2019-08-19 23:19:52 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-19 23:19:52 +0300 |
| commit | 9780b1fcb0a124d8ae01e424649fc8fddc50b1b8 (patch) | |
| tree | f03e7877fc3ebe0bea31c193b43843252315576d | |
| parent | 82d748d7a5f508c349817b407fc39e2d897d24df (diff) | |
| download | portablepython-9780b1fcb0a124d8ae01e424649fc8fddc50b1b8.tar.gz portablepython-9780b1fcb0a124d8ae01e424649fc8fddc50b1b8.zip | |
Fixesrelease-3
* Remove Scripts directory
The Scripts directory contains executables that won't work on user system. The user needs to run ensurepip to make recreate the scripts.
* Update README.md
* Check if Scripts directory exists
* Add logging to download.ps1
* Add /fa argument to msiexec command line
Try to force installation even if there is a previous installation
* Uninstall previous 2.x python
| -rw-r--r-- | README.md | 22 | ||||
| -rw-r--r-- | download.ps1 | 14 |
2 files changed, 36 insertions, 0 deletions
@@ -11,3 +11,25 @@ If you answered yes at least once, then this project will have you covered! This project contains a bunch of Python releases packaged in zip archives. The archives are created from files installed by the official Python installer, nothing else. Each version will have a 32-bit and 64-bit version available. Check out [releases](https://github.com/oswjk/portablepython/releases) for downloads! + +# Recreating scripts + +A normal Python installation can be configured to have a Scripts directory that contains `pip` and `easy_install` scripts that you can invoke directly. + +The portable zip file does not contain this directory. If you need it, it is easy to recreate with the `ensurepip` package. + +First, you need to uninstall pip and setuptools: + +``` +python -m pip uninstall setuptools pip +``` + +Now you can run the `ensurepip` package to install `pip` and `setuptools` and to create the scripts: + +``` +python -m ensurepip --default-pip +``` + +Make sure that the Python you are invoking, is the correct one! You can do this for example by specifying the full path to the Python executable when entering the commands above. + +That should be all! diff --git a/download.ps1 b/download.ps1 index df06a92..181edb2 100644 --- a/download.ps1 +++ b/download.ps1 @@ -22,6 +22,7 @@ Write-Output "Target: $target" Write-Output "Target dir: $targetdir" Write-Output "Log file: $logfile" +Write-Output "Downloading $url" $client = New-Object System.Net.WebClient $client.DownloadFile($url, $target) @@ -29,11 +30,24 @@ if ($env:PYVERSION -like "3.*") { # Replace TARGET_DIR in unattend.xml.in with our target directory ((Get-Content -path unattend.xml.in -raw) -replace 'TARGET_DIR',$targetdir) | Set-Content -path unattend.xml + Write-Output "Installing Python to $targetdir" Start-Process -FilePath "$target" -ArgumentList "/quiet","/log","$logfile" -Wait # Remove all __pycache__ directories + Write-Output "Removing __pycache__ directories" Get-ChildItem -Include __pycache__ -Recurse -Force | Remove-Item -Force -Recurse } else { + Write-Output "Removing existing Python installation if there is one" + Start-Process -FilePath msiexec -ArgumentList "/qn","/x","$target" -Wait + + Write-Output "Installing Python to $targetdir" Start-Process -FilePath msiexec -ArgumentList "/qn","/i","$target","/L*V","$logfile","TARGETDIR=$targetdir","ADDLOCAL=DefaultFeature,TclTk,Documentation,Tools","REMOVE=Extensions,Testsuite" -Wait + + Write-Output "Removing .pyc files" Get-ChildItem -Include "*.pyc" -Recurse -Force | Remove-Item -Force } + +if (Test-Path $targetdir\Scripts) { + Write-Output "Removing $targetdir\Scripts" + Remove-Item -Recurse -Force $targetdir\Scripts +} |
