From 4ff50e9099afb1c992eba6abf7eb2a5743a66315 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 19 Oct 2017 22:48:38 +0200 Subject: [PATCH] fix egg-link and easy_install support for Python3 Wow, this is hacky and weird, but its been there for a long time. I don't know if its even relevant anymore, but is isolated so it shouldn't hurt anything. Plus there is a test for it in tests/complete-ci-tests, so it seems worth fixing. --- fdroidserver/__init__.py | 1 + fdroidserver/init.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fdroidserver/__init__.py b/fdroidserver/__init__.py index c3f64721..bad9cefa 100644 --- a/fdroidserver/__init__.py +++ b/fdroidserver/__init__.py @@ -8,6 +8,7 @@ import sys # support running straight from git and standard installs rootpaths = [ os.path.realpath(os.path.join(os.path.dirname(__file__), '..')), + os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'share')), os.path.join(sys.prefix, 'share'), ] diff --git a/fdroidserver/init.py b/fdroidserver/init.py index 3aa0b61a..36c2bf44 100644 --- a/fdroidserver/init.py +++ b/fdroidserver/init.py @@ -69,10 +69,11 @@ def main(): tmp = os.path.dirname(sys.argv[0]) examplesdir = None if os.path.basename(tmp) == 'bin': - egg_link = os.path.join(tmp, '..', 'local/lib/python2.7/site-packages/fdroidserver.egg-link') - if os.path.exists(egg_link): + egg_links = glob.glob(os.path.join(tmp, '..', + 'local/lib/python3.*/site-packages/fdroidserver.egg-link')) + if egg_links: # installed from local git repo - examplesdir = os.path.join(open(egg_link).readline().rstrip(), 'examples') + examplesdir = os.path.join(open(egg_links[0]).readline().rstrip(), 'examples') else: # try .egg layout examplesdir = os.path.dirname(os.path.dirname(__file__)) + '/share/doc/fdroidserver/examples'