Fixed some things, now it partialy works

What doesn't work is --list-[plugin]



git-svn-id: https://callirhoe.googlecode.com/svn/branches/phantome@175 81c8bb96-aa45-f2e2-0eef-c4fa4a15c6df
This commit is contained in:
ph4ntome@gmail.com 2014-10-31 14:15:46 +00:00
parent af09f855ff
commit d8e74ff812
4 changed files with 14 additions and 11 deletions

View File

@ -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,

View File

@ -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

View File

@ -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 *

View File

@ -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/.$/]}/'