diff --git a/callirhoe.py b/callirhoe.py index d376fb3..f6fcf1c 100755 --- a/callirhoe.py +++ b/callirhoe.py @@ -84,10 +84,13 @@ def import_plugin(plugin_paths, cat, longcat, longcat2, listopt, preset): for path in plugin_paths: found += available_files(path, cat, preset) if len(found) == 0: raise IOError - old = sys.path[0]; - sys.path[0] = found[0][1] - m = __import__("%s.%s" % (cat,preset), globals(), locals(), [ "*" ]) - sys.path[0] = old + if found[0][1] == "/": + m = __import__("%s.%s" % (cat,preset), globals(), locals(), [ "*" ]) + else: + old = sys.path[0] + sys.path[0] = found[0][1] + m = __import__("%s.%s" % (cat,preset), globals(), locals(), [ "*" ]) + sys.path[0] = old return m except IOError: sys.exit("callirhoe: %s definition '%s' not found, use %s to see available definitions" % (longcat, diff --git a/lib/plugin.py b/lib/plugin.py index 8e5dcf3..0e02fc4 100644 --- a/lib/plugin.py +++ b/lib/plugin.py @@ -43,7 +43,7 @@ def available_files(parent, dir, fmatch = None): good = False res = [] pattern = parent + "/" + dir + "/*.py" - for x in glob.glob(pattern) if parent != "resource" else resources.resource_list[dir]: + for x in glob.glob(pattern) if parent != "/" else resources.resource_list[dir]: basex = os.path.basename(x) if basex == "__init__.py": good = True elif basex.startswith('_'): @@ -77,7 +77,7 @@ def get_plugin_paths(): result = [ os.path.expanduser("~/.callirhoe"), sys.path[0] if sys.path[0] else "." ] try: temp = resources.resource_list - result.append("resource") + result.append("/") except: pass return result diff --git a/make_pkg b/make_pkg index 1b923c4..e1b7a0f 100755 --- a/make_pkg +++ b/make_pkg @@ -9,7 +9,7 @@ cp -R layouts _callirhoe cp -R lib _callirhoe cp -R style _callirhoe cp callirhoe.py _callirhoe/__main__.py -mv resources.py lib +mv resources.py _callirhoe/lib cd _callirhoe zip -q -r callirhoe.zip * diff --git a/make_resources_list b/make_resources_list index abca989..bb8a267 100755 --- a/make_resources_list +++ b/make_resources_list @@ -1,10 +1,10 @@ #!/bin/bash echo -n resource_list = { \"lang\" : [ -find ./lang | grep '.py' | sed 's/\.\//"/' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/], /' +find ./lang | grep '.py' | sed 's/\.\//"\//' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/], /' echo -n \"layouts\" : [ -find ./layouts | grep '.py' | sed 's/\.\//"/' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/], /' +find ./layouts | grep '.py' | sed 's/\.\//"\//' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/], /' echo -n \"style\" : [ -find ./style | grep '.py' | sed 's/\.\//"/' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/], /' +find ./style | grep '.py' | sed 's/\.\//"\//' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/], /' echo -n \"geom\" : [ -find ./geom | grep '.py' | sed 's/\.\//"/' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/]}/' +find ./geom | grep '.py' | sed 's/\.\//"\//' | sed 's/$/"/' | tr '\n' ',' | sed 's/.$/]}/'