#3259 closed defect (fixed)

The switch to use pkg_resources breaks frozen builds

Reported by: cypher Owned by: daira
Priority: normal Milestone: 1.14.0
Component: packaging Version: n/a
Keywords: regression Cc:
Launchpad Bug:

Description

PR #646 introduced a change that broke "frozen" builds of Tahoe-LAFS (i.e., standalone executables generated by PyInstaller?, cx_Freeze, and the like). Specifically, because "frozen" python interpreters run outside of and without a traditional setuptools-based packaging environment, the pkg_resources.get_distribution(__appname__) call will fail as follows when running under a "frozen" interpreter:

Traceback (most recent call last):
  File "tahoe.py", line 23, in <module>
    from twisted.python.procutils import which
  File "/tmp/pip-install-Om4he9/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module
  File "site-packages/allmydata/scripts/runner.py", line 9, in <module>
  File "/tmp/pip-install-Om4he9/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module
  File "site-packages/allmydata/version_checks.py", line 29, in <module>
  File "site-packages/pkg_resources/__init__.py", line 481, in get_distribution
  File "site-packages/pkg_resources/__init__.py", line 357, in get_provider
  File "site-packages/pkg_resources/__init__.py", line 900, in require
  File "site-packages/pkg_resources/__init__.py", line 786, in resolve
pkg_resources.DistributionNotFound: The 'tahoe-lafs' distribution was not found and is required by the application
[23457] Failed to execute script tahoe

Conditionally skipping this call when running under a frozen interpreter will allow the execution of the application to continue as intended (as is already being done elsewhere in the version_checks module -- e.g., here).

Change History (3)

comment:2 Changed at 2019-10-09T19:32:10Z by Chris Wood <chris@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 710af06/trunk:

Skip pkg_resources.get_distribution call if frozen

Fixes: ticket:3259

comment:3 Changed at 2019-10-09T19:32:10Z by GitHub <noreply@…>

In 91dd27b/trunk:

Merge pull request #661 from crwood/3259.frozen-pkg_resources-fix

Skip pkg_resources.get_distribution call if frozen

Fixes: ticket:3259

Note: See TracTickets for help on using tickets.