Skip to content

Commit

Permalink
Added helper function to merge module dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paddy Foran committed Dec 14, 2012
1 parent 576046e commit a7bfece
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions iron_worker.py
Expand Up @@ -182,6 +182,22 @@ def merge(self, target, ignoreRootDir=False):
for dest, loc in self.files.iteritems():
self.executable = dest

def merge_dependency(self, dep):
dependency = __import__(dep)
location = os.path.dirname(dependency.__file__)
print location
parent = location.rstrip(os.path.basename(location))
print parent
for dirname, dirnames, filenames in os.walk(location):
for filename in filenames:
path = os.path.join(dirname, filename)
if path.startswith(parent):
newpath = path[len(parent):]
else:
newpath = path
ziploc = newpath.lstrip("/")
self.files[ziploc] = path

def zip(self, destination=None, overwrite=True):
if destination is None:
if self.name is not None:
Expand Down

0 comments on commit a7bfece

Please sign in to comment.