asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
656 stars 56 forks source link

[macOS] install framework Python to custom Applications directory #86

Open DilumAluthge opened 3 years ago

DilumAluthge commented 3 years ago

I want to build a framework Python, but I do not want to write to /Applications.

I tried setting PYTHON_CONFIGURE_OPTS="--enable-framework=/Users/dilum/Desktop", but it still tries to write to /Applications

Is there a way to build a framework Python without writing to /Applications?

For example, here is the log:

$ export PYTHON_CONFIGURE_OPTS="--enable-framework=/Users/dilum/Desktop"
$ asdf install python 3.9.1
python-build 3.9.1 /Users/dilum/.asdf/installs/python/3.9.1
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.1.tar.xz...
-> https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tar.xz
Installing Python-3.9.1...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 11.1 using python-build 1.2.21-6-g2bf6111f)

Inspect or clean up the working tree at /var/folders/jy/7hh5zyw95cg2lh66lfpthqq80000gn/T/python-build.20210108043524.65081
Results logged to /var/folders/jy/7hh5zyw95cg2lh66lfpthqq80000gn/T/python-build.20210108043524.65081.log

Last 10 log lines:
cp ./../Icons/PythonLauncher.icns  "Python Launcher.app/Contents/Resources"
cp ./../Icons/PythonSource.icns  "Python Launcher.app/Contents/Resources"
cp ./../Icons/PythonCompiled.icns  "Python Launcher.app/Contents/Resources"
cp ./factorySettings.plist  "Python Launcher.app/Contents/Resources"
cp -R ./English.lproj "Python Launcher.app/Contents/Resources"
test -d "/Applications/Python 3.9" || mkdir -p "/Applications/Python 3.9"
mkdir: /Applications/Python 3.9: Permission denied
make[2]: *** [install] Error 1
make[1]: *** [install_PythonLauncher] Error 2
make: *** [frameworkinstallapps] Error 2

In contrast, a regular (non-framework) build works just fine. In a brand-new Bash session:

$ asdf install python 3.9.1
python-build 3.9.1 /Users/dilum/.asdf/installs/python/3.9.1
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.1.tar.xz...
-> https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tar.xz
Installing Python-3.9.1...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.9.1 to /Users/dilum/.asdf/installs/python/3.9.1

$ asdf shell python 3.9.1
$ python --version
Python 3.9.1
$ asdf list
python
  3.9.1