From 710af066d2e175db7d8197006087aa3c4f00f59d Mon Sep 17 00:00:00 2001 From: Chris Wood Date: Thu, 3 Oct 2019 14:07:24 -0400 Subject: [PATCH] Skip pkg_resources.get_distribution call if frozen Fixes: ticket:3259 --- src/allmydata/version_checks.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/allmydata/version_checks.py b/src/allmydata/version_checks.py index 761d6b6ea..9f084ff4b 100644 --- a/src/allmydata/version_checks.py +++ b/src/allmydata/version_checks.py @@ -23,11 +23,21 @@ from .util import ( verlib, ) -_INSTALL_REQUIRES = list( - str(req) - for req - in pkg_resources.get_distribution(__appname__).requires() -) +if getattr(sys, 'frozen', None): + # "Frozen" python interpreters (i.e., standalone executables + # generated by PyInstaller and other, similar utilities) run + # independently of a traditional setuptools-based packaging + # environment, and so pkg_resources.get_distribution() cannot be + # used in such cases to gather a list of requirements at runtime + # (and because a frozen application is one that has already been + # "installed", an empty list suffices here). + _INSTALL_REQUIRES = [] +else: + _INSTALL_REQUIRES = list( + str(req) + for req + in pkg_resources.get_distribution(__appname__).requires() + ) class PackagingError(EnvironmentError): """