You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The context for this is py2app: Py2app bundles an application on macOS into a ".app" bundle.
Description
As part of the bundling of an application into an .app by py2app the python modules/packages used by the script are copied into a ZIP file that's added on sys.path.
The class pkg_resources.WorkingSet does not use the dist-info information that's included in that zipfile because pkg_resources.WorkingSet.add_entry asks the Finder (in this case find_apps_in_zip) to not look for subitems (the only argument is set to True).
Because of that pkg_resources.iter_entrypoints does not find the entry points of distributions copied into the zipfile.
Patch py2app/recipes/setuptools.py: Remove the "prescripts" from the dict returned by the check function
instal py2appl: pip install ./py2app
Change directory to examples/Tkinter/hello_tk
Open hello.py and replace the last two lines (creating the app object and running the mainloop) by the code below
importhumanfriendlyimportpkg_resourcesforepinpkg_resources.iter_entry_points("console_scripts"):
ifep.dist.project_name=="humanfriendly":
breakelse:
raiseRuntimeError("EP for humanfriendly not found")
Build the app bundle using python setup.py py2app
Start the application using dist/hello.app/Contents/MacOS/hello
What you'll see:
The app fails to launch and prints in the Terminal that the EP for humanfriendly is not found.
Expected behaviour:
Application starts and immediately stops
Output
See description in the previous step.
The text was updated successfully, but these errors were encountered:
setuptools version
setuptools==60.10.0
Python version
Python 3.10
OS
macOS
Additional environment information
The context for this is py2app: Py2app bundles an application on macOS into a ".app" bundle.
Description
As part of the bundling of an application into an .app by py2app the python modules/packages used by the script are copied into a ZIP file that's added on sys.path.
The class
pkg_resources.WorkingSet
does not use the dist-info information that's included in that zipfile becausepkg_resources.WorkingSet.add_entry
asks the Finder (in this casefind_apps_in_zip
) to not look for subitems (the only argument is set toTrue
).Because of that
pkg_resources.iter_entrypoints
does not find the entry points of distributions copied into the zipfile.Related issue in py2app: ronaldoussoren/py2app#413
Expected behavior
I'd expect that the dist-info information that's included in the zipfile is used by pkg_resources.
How to Reproduce
On a macOS system:
setuptools
andhumanfriendly
py2app/recipes/setuptools.py
: Remove the"prescripts"
from the dict returned by thecheck
functionpip install ./py2app
examples/Tkinter/hello_tk
hello.py
and replace the last two lines (creating the app object and running the mainloop) by the code belowpython setup.py py2app
dist/hello.app/Contents/MacOS/hello
What you'll see:
Expected behaviour:
Output
See description in the previous step.
The text was updated successfully, but these errors were encountered: