1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
From abc298ecc63dc99fc0023b288257e258c5bee368 Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@debian.org>
Date: Sat, 17 Oct 2015 18:54:39 +0200
Subject: fix-paths
make plugin/toolkit/test paths compatible with python-support. Fix
documentation generator to look for test files in the build directory.
Forwarded: not-needed
---
doc/gendoc.py | 6 ++++++
gamera/paths.py | 12 +++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/doc/gendoc.py b/doc/gendoc.py
index e7887d6..76257e1 100755
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -2,6 +2,12 @@
from gamera import core, gendoc
+import sys
+import os
+import gamera.paths
+
+gamera.paths.test = os.path.join(os.path.dirname(__file__), '..', 'gamera', 'test')
+
if __name__ == "__main__":
core.init_gamera()
gendoc.gendoc(classes=[
diff --git a/gamera/paths.py b/gamera/paths.py
index 7386a83..824cae4 100644
--- a/gamera/paths.py
+++ b/gamera/paths.py
@@ -22,11 +22,7 @@
from __future__ import generators
import os, sys, dircache, glob, imp # Python standard library
-if 1:
- def dummy():
- pass
-
-lib = os.path.dirname(os.path.realpath(dummy.func_code.co_filename))
+lib = os.path.dirname(__file__)
lib_gui = os.path.realpath(os.path.join(lib, "gui"))
# Figure out if we are in the source directory or installed
plugins = os.path.realpath(os.path.join(lib, "plugins"))
@@ -34,11 +30,13 @@ doc = os.path.realpath(os.path.join(lib, "doc"))
sys.path.append(plugins)
plugins_src = ""
toolkits = os.path.realpath(os.path.join(lib, "toolkits"))
-test = os.path.realpath(os.path.join(lib, "test"))
-test_results = os.path.realpath(os.path.join(lib, "test/results"))
+test = '/usr/share/gamera/test/'
+test_results = os.path.join(test, 'results')
def get_toolkit_names(dir):
toolkits = []
+ if not os.path.exists(dir):
+ return toolkits
listing = dircache.listdir(dir)
dircache.annotate(dir, listing)
for toolkit in listing:
|