From cebd349e285d068fd41b53f94250eeb1e677c467 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sat, 16 Feb 2019 13:06:02 +0200 Subject: [PATCH] compat with py2app - issue #100. It does not provide site.PREFIXES . --- pysollib/util.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pysollib/util.py b/pysollib/util.py index 84f18a4e..f0c53581 100644 --- a/pysollib/util.py +++ b/pysollib/util.py @@ -100,10 +100,17 @@ class DataLoader: path.append(os.path.join(sys.path[0], "pysollib", "data")) # from settings.py path.extend(DATA_DIRS) + # py2app compatibility, see + # https://github.com/shlomif/PySolFC/issues/100 + _prefixes = [] + try: + _prefixes = site.PREFIXES + except Exception: + _prefixes = [] # itz 2018-10-21 in case of venv installation # (or even homedir installation), path[0] will be quite wrong. # Just directly use the location where setup.py puts the data. - for pref in site.PREFIXES: + for pref in _prefixes: path.append(os.path.join(pref, 'share', 'PySolFC')) # check path for valid directories self.path = []