63 |
checking. If <path> is not given, then add the path from |
checking. If <path> is not given, then add the path from |
64 |
the config. |
the config. |
65 |
""" |
""" |
66 |
|
|
67 |
if path == None: |
if path == None: |
68 |
addpath = self.get('main', 'module_path') |
addpath = self.get('main', 'module_path') |
69 |
|
|
70 |
# no non-existant paths |
# pass over non-existant paths |
|
# XXX: Should raise an exception here, returning -1 is for kids :) |
|
71 |
if not os.path.exists(addpath): |
if not os.path.exists(addpath): |
72 |
return -1 |
return |
73 |
|
|
74 |
# Clean it up in case its relative from circus_home |
# Clean it up in case its relative from circus_home |
75 |
path = os.path.abspath(addpath) |
path = os.path.abspath(addpath) |
76 |
|
|
77 |
|
# No dupes |
78 |
for p in sys.path: |
for p in sys.path: |
79 |
p = os.path.abspath(p) |
p = os.path.abspath(p) |
80 |
if addpath in (p, p + os.sep): |
if addpath in (p, p + os.sep): |
81 |
return 0 |
return |
82 |
|
|
83 |
sys.path.append(addpath) |
sys.path.append(addpath) |
84 |
|
|