gamera (3.3.3-2) fix-paths.diff

Summary

 doc/gendoc.py   |    6 ++++++
 gamera/paths.py |   12 +++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

    
download this patch

Patch contents

Description: make plugin/toolkit/test paths compatible with python-support
 Fix documentation generator to look for test files in the build directory.
Author: Jakub Wilk <jwilk@debian.org>
Forwarded: not-needed
Last-Update: 2010-09-02

--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -7,6 +7,12 @@
 
 import draw_text_helper
 
+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=[
--- 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 @@
 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: