changeset 1:47d9472e7754

add path of file directory when loading files
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 03 May 2011 14:26:35 -0700
parents 6fa6d987b3af
children 6cb7696edc4d
files pyloader/__init__.py setup.py
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pyloader/__init__.py	Tue May 03 08:06:48 2011 -0700
+++ b/pyloader/__init__.py	Tue May 03 14:26:35 2011 -0700
@@ -6,6 +6,7 @@
 
 import imp
 import os
+import sys
 
 def import_dotted_path(module):
   path = module.split('.')
@@ -22,7 +23,9 @@
       path, target = string.split(':', 1)
       if os.path.isabs(path) and os.path.exists(path):
         # path to file
+        sys.path.append(os.path.dirname(path))
         module = imp.load_source(path, path)
+        sys.path.pop()
       else:
         module = import_dotted_path(path)
       obj = module
--- a/setup.py	Tue May 03 08:06:48 2011 -0700
+++ b/setup.py	Tue May 03 14:26:35 2011 -0700
@@ -7,7 +7,7 @@
 except IOError: 
     description = ''
 
-version = "0.1"
+version = "0.1.1"
 dependencies = []
 
 setup(name='pyloader',