chiark / gitweb /
fix egg-link and easy_install support for Python3
authorHans-Christoph Steiner <hans@eds.org>
Thu, 19 Oct 2017 20:48:38 +0000 (22:48 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 19 Oct 2017 21:28:13 +0000 (23:28 +0200)
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
fdroidserver/init.py

index c3f647219002d158ac1f333f5be8fc0fa93414c6..bad9cefad50d68c397ef698075aa78e2d3be6b6d 100644 (file)
@@ -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'),
 ]
 
index 3aa0b61aaf0b66e17517c4e07451cd4197b7ec35..36c2bf448b2ae3fa70dd52875482ca7d625591a9 100644 (file)
@@ -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'