Permalink
Browse files

Added helper function to merge module dependencies.

  • Loading branch information...
1 parent 576046e commit a7bfece70c835c1819d1b24a260a37d623e314e9 @paddycarver paddycarver committed Dec 14, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 iron_worker.py
View
@@ -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:

0 comments on commit a7bfece

Please sign in to comment.