I would very highly recommend that you not reinvent the wheel here.

But if you really don't like the way Py2App or PyInstaller does it, then I
wouldn't try to build the entire "normal" mac distribution anyway, and
start at a lower level. Maybe look at homebrew for ideas?

BTW -- there's a third option: conda and "conda constructor" -- might be
worth a look.

-CHB




On Sun, Nov 14, 2021 at 7:57 AM Barry Scott <ba...@barrys-emacs.org> wrote:

>
>
> On 10 Nov 2021, at 20:28, Paul Romer <p...@paulromer.net> wrote:
>
> 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
>
>
> Why do you think you need to build CPYTHON at all?
>
> I use py3app with the python.org downloaded versions of python.
>
>
> 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.
>
>
>
> You do not need to. All the user needs to do it drag the <yourapp>.app
> folder into (typically) /Applications.
>
>
> 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"
>
>
>  What post-install script? That's not something that py2app does.
>
>
> 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/
>
>
> For Barry's Emacs I do 2 steps.
>
> 1. Build the .app bundle.
> 2. Build .dmg that has a bunch of files including the .app bundle.
>
> There may be a bit too much complexity but have look at how I build the
> .app bundle in
>
> https://github.com/barry-scott/BarrysEmacs/blob/master/Editor/PyQtBEmacs/build-macosx.sh
> <https://github.com/barry-scott/BarrysEmacs/blob/master/Editor/PyQtBEmacs/macosx.mak>
> and
>
> https://github.com/barry-scott/BarrysEmacs/blob/master/Editor/PyQtBEmacs/brand.setup-macosx.py
>
> I'm using PyQt not Tk.
>
> Barry
>
>
>
>
> 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
> p...@paulromer.net | paulromer.net | @paulromer
> <https://twitter.com/paulmromer?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> https://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> https://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
>


-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to