Skip to content

Commit b6a7bf3

Browse files
Made platform-aware user base feature a switch
1 parent 8cf664a commit b6a7bf3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

EnablePython/EnablePython.psm1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ The operating system install scope (either "CurrentUser" or "AllUsers") to filte
8686
.PARAMETER PythonHome
8787
Sets a custom path on the PYTHONHOME environment variable.
8888
89-
.PARAMETER PlatformSpecificUserBase
90-
Instructs EnablePython on to set or not set a custom PYTHONUSERBASE path in a platform-specific manner. By default,
91-
Python uses the same location for both 32-bit and 64-bit installations, which causes problems for binary components.
89+
.PARAMETER NoPlatformUserBase
90+
Instructs EnablePython not to set a custom PYTHONUSERBASE path in a platform-specific manner. By default, Python uses
91+
the same location for both 32-bit and 64-bit installations, which causes problems for binary components.
9292
9393
.EXAMPLE
9494
Enable-Python
@@ -154,8 +154,7 @@ https://github.com/DavidWhittingham/ps-EnablePython
154154
[string]$PythonHome,
155155

156156
[Parameter()]
157-
[ValidateSet($true, $false)]
158-
[string]$PlatformSpecificUserBase = $true
157+
[switch]$NoPlatformUserBase
159158
)
160159

161160
process {
@@ -201,7 +200,7 @@ https://github.com/DavidWhittingham/ps-EnablePython
201200
$Env:PYTHONHOME = $PythonHome
202201

203202
# If configured to separate user base by platform, set a custom user base
204-
if ($PlatformSpecificUserBase -eq $true) {
203+
if ($NoPlatformUserBase -eq $false) {
205204
$script:OLD_ENV_PYTHONUSERBASE = $Env:PYTHONUSERBASE
206205
$Env:PYTHONUSERBASE = Join-Path -Path (Join-Path -Path $Env:APPDATA -ChildPath "EnablePython") `
207206
-ChildPath ("x86-{0}" -f $foundVersion.Platform)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ To enable a Python installation on your current shell instance, use the `Enable-
118118
There are additional options that can control how an environment gets activated:
119119

120120
- `PythonHome`: set a custom Python Home path on activating the environment, which will be automatically removed on deactivation
121-
- `PlatformSpecificUserBase`: Set to `$true` by default, this parameter *fixes* an issue with running multiple Pythons at the same version with different platforms (e.g. Python 2.7 x86-32 *and* x86-64). Python by default uses the same directory on both platforms for user installed site-package, which is a problem for any packages that are platform specific. By default, EnablePython sets an environment variable to have custom per-platform paths in the form `<RoamingAppData>\EnablePython\<PythonPlatform>`. Setting this to `$false` disables this functionality.
121+
- `NoPlatformUserBase`: EnablePython *fixes* an issue with running multiple Pythons at the same version with different platforms (e.g. Python 2.7 x86-32 *and* x86-64). Python by default uses the same directory on both platforms for user installed site-package, which is a problem for any packages that are platform specific. By default, EnablePython sets an environment variable to have custom per-platform paths in the form `<RoamingAppData>\EnablePython\<PythonPlatform>`. Setting this switch disables this functionality.
122122

123123
#### Examples
124124
Get all Python installs available, sort them, and enable the top-most install:

0 commit comments

Comments
 (0)