Skip to content

Commit

Permalink
Move python frameworks into their own Python folder
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Jul 9, 2020
1 parent 1d83014 commit ee80577
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# python
A Python 3 framework that currently installs to `/Library/ManagedFrameworks/Python3.framework`.
A Python 3 framework that currently installs to `/Library/ManagedFrameworks/Python/Python3.framework`.

Please see Apple's documentation on [file system basics](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html) for more information on the thought process here.

This is an intended replacement for when Apple removes `/usr/bin/python`

## Using interactively
After installing any of the packages, a symbolic link can be used within terminal for interactive Python sessions. At the time of this writing `/usr/local/bin/managed_python3` points to `/Library/ManagedFrameworks/Python3.framework/Versions/Current/bin/python3`
After installing any of the packages, a symbolic link can be used within terminal for interactive Python sessions. At the time of this writing `/usr/local/bin/managed_python3` points to `/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3`

## Using with scripts
It is currently recommended to point directly to symbolic link provided by the Python framework.

At the time of this writing `/Library/ManagedFrameworks/Python3.framework/Versions/Current/bin/python3` points to `/Library/ManagedFrameworks/Python3.framework/Versions/3.8/bin/python3.8`
At the time of this writing `/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3` points to `/Library/ManagedFrameworks/Python/Python3.framework/Versions/3.8/bin/python3.8`

An example script would look like the following:

```
#!/Library/ManagedFrameworks/Python3.framework/Versions/Current/bin/python3
#!/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3
print('This is an example script.')
```
Expand All @@ -25,7 +25,7 @@ print('This is an example script.')
#### zshenv global alias
If you are calling `python` within `zsh` scripts, adding a global alias to `/etc/zshenv` may be appropriate.

`alias -g python3.framework='/Library/ManagedFrameworks/Python3.framework/Versions/Current/bin/python3'`
`alias -g python3.framework='/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3'`

For more information on this method, please see Armin Briegel's "Moving to Zsh" Part [II](https://scriptingosx.com/2019/06/moving-to-zsh-part-2-configuration-files/) and [IV](https://scriptingosx.com/2019/07/moving-to-zsh-part-4-aliases-and-functions/)

Expand Down
2 changes: 1 addition & 1 deletion build_python_framework_pkgs.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
RP_SHA="8bce58e91895978da6f238c1d2e1de3559ea4643"
MP_SHA="71c57fcfdf43692adcd41fa7305be08f66bae3e5"
# Hardcoded paths
FRAMEWORKDIR="/Library/ManagedFrameworks"
FRAMEWORKDIR="/Library/ManagedFrameworks/Python"
PYTHON_BIN="$FRAMEWORKDIR/Python3.framework/Versions/Current/bin/python3"
RP_BINDIR="/tmp/relocatable-python"
MP_BINDIR="/tmp/munki-pkg"
Expand Down
2 changes: 1 addition & 1 deletion example_python_script.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/Library/ManagedFrameworks/Python3.framework/Versions/Current/bin/python3
#!/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3

print('This is an example script.')

0 comments on commit ee80577

Please sign in to comment.