I am new to this sig. I hope it is appropriate to pose the following
detailed question to its members. Let me know if I have misunderstood.
I'll provide a bit of background, specify the steps I took, then describe
the two issues I'm facing on which I would welcome advice.
=====================================================================
*Background: *
I am trying to create a self-contained Python application that a user could
download and run on MacOS that does not have Python 3 installed. I am aware
that PyInstaller and py2app are alternative paths for creating
self-contained apps and am pursuing them in parallel.
The issue I want to describe here arose as part of experiments with the
process for creating a binary for a recent version of Python (3.9.8) that
can be installed under the user's home directory.
/Users/{USER}/Library.
According to the information in the cpython repository, it seems that it
should be possible to build an installer for a full version of Python that
can be installed someplace on a Mac other than the default location:
/Library. In particular, one should be able to do this using
build-installer.py
in the
Mac/BuildScript
directory.
*=====================================================================*
*Steps I Took:*
In the cpython directory I ran:
> ./configure --enable-framework=/Users/{USER}/Library/Frameworks \
--enable-optimizations
I confirmed that the Makefile included the line:
CONFIG_ARGS= '--enable-framework=/Users/{USER}/Library/Frameworks'
'--enable-optimizations'
(I also tried replacing {USER} with the actual user on my system, 'admin'.
This yielded the same results.)
I put the external files OpenSSL, tcl/tck, ... (details below) that are
required into the
.../Universal/other-sources
directory. I deleted my install of Python3.9 and backed-up and deleted all
the files from
/usr/local/bin
Then from
/Mac/BuildScript
I ran
> python3 build-installer.py \
--universal-archs=intel-64 \
--dep-target=11
Along the way, there were several warnings, but no errors. The end result
is a dmg file:
python-3.9.8+-macos12-2021-11-10.dmg
=====================================================================
*Issues:*
1. I am not sure how to convert the dmg into a "macOS flat installer
package" and would welcome any advice on this point.
2. But in any case, I do not think that an installer based on this dmg will
allow an install in the Library of the user. When I inspect the dmg file, I
find that the post-install scripts include references to the usual file
location in /Library. For example, the script that runs after installing
the framework has the lines:
PYVER="3.9"
FWK="/Library/Frameworks/Python.framework/Versions/3.9"
The script that runs after installing the files for pip has the lines:
PYVER="3.9"
PYMAJOR="3"
FWK="/Library/Frameworks/Python.framework/Versions/${PYVER}"
RELFWKBIN="../../..${FWK}/bin"
This suggests that I have misunderstood the instructions. So I would
appreciate any advice on how to succeed on this path, or suggestions about
alternative paths that might work. In particular, the alternative that
might be feasible would be to use the work from
https://github.com/codrsquad/portable-python
This is a recent project, not the one with the same name that was abandoned
that you'll find here:
https://portablepython.com/
Thanks for reading through all this!
=====================================================================
PS: Contents of my .../Universal/other-sources directory:
-rw-r--r-- 1 admin staff 367573 Nov 10 00:53
ncurses-5.9-20120616-patch.sh.bz2
-rw-r--r-- 1 admin staff 2826473 Nov 10 00:53 ncurses-5.9.tar.gz
-rw-r--r-- 1 admin staff 9834044 Nov 9 22:19 openssl-1.1.1l.tar.gz
-rw-rw-rw-@ 1 admin staff 2956627 Nov 10 01:06
sqlite-autoconf-3350500.tar.gz
-rw-rw-rw-@ 1 admin staff 10259009 Nov 9 22:55 tcl8.6.11-src.tar.gz
-rw-rw-rw-@ 1 admin staff 4496914 Nov 10 00:37 tk8.6.11-src.tar.gz
-rw-rw-rw-@ 1 admin staff 1490665 Nov 10 00:45 xz-5.2.3.tar.gz
=====================================================================
Paul Romer
[email protected] | paulromer.net | @paulromer
<https://twitter.com/paulmromer?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor>
_______________________________________________
Pythonmac-SIG maillist - [email protected]
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG