Commit 92f6da92 authored by sumpfralle's avatar sumpfralle

allow to override the data dir via an environment variable


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@234 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent ebe916b5
...@@ -22,7 +22,11 @@ import time ...@@ -22,7 +22,11 @@ import time
import os import os
import sys import sys
DATA_DIR_ENVIRON_KEY = "PYCAM_DATA_DIR"
DATA_BASE_DIRS = [os.path.join(os.path.dirname(__file__), "gtk-interface"), os.path.join(sys.prefix, "share", "python-pycam", "ui")] DATA_BASE_DIRS = [os.path.join(os.path.dirname(__file__), "gtk-interface"), os.path.join(sys.prefix, "share", "python-pycam", "ui")]
if DATA_DIR_ENVIRON_KEY in os.environ:
DATA_BASE_DIRS.insert(0, os.environ[DATA_DIR_ENVIRON_KEY])
GTKBUILD_FILE = "pycam-project.ui" GTKBUILD_FILE = "pycam-project.ui"
GTKMENU_FILE = "menubar.xml" GTKMENU_FILE = "menubar.xml"
...@@ -53,6 +57,7 @@ def get_data_file_location(filename): ...@@ -53,6 +57,7 @@ def get_data_file_location(filename):
return test_path return test_path
else: else:
print >>sys.stderr, "Failed to locate a resource file (%s) in %s!" % (filename, DATA_BASE_DIRS) print >>sys.stderr, "Failed to locate a resource file (%s) in %s!" % (filename, DATA_BASE_DIRS)
print >>sys.stderr, "You can extend the search path by setting the environment variable '%s'." % str(DATA_DIR_ENVIRON_KEY)
return None return None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment