changeset 4:a984091d681a

fix up destination
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 18 Sep 2011 10:46:10 -0700
parents 11e11e5c0c48
children 5b78d1411cdd
files fetch/main.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/fetch/main.py	Sun Sep 18 10:41:18 2011 -0700
+++ b/fetch/main.py	Sun Sep 18 10:46:10 2011 -0700
@@ -81,9 +81,19 @@
       assert not [i for i in types
                   if [True for fetcher in fetchers if fetcher.match(i)]]
 
-    # fetch the items
     for item in items:
-      self(item['url'])
+
+      # fix up relative paths
+      dest = item['destination']
+      if not os.path.isabs(dest):
+        if self.relative_to:
+          dest = os.path.join(self.relative_to, dest)
+        else:
+          dest = os.path.join(os.path.dirname(os.path.abspath(item['manifest'])), dest)
+
+      # fetch the items
+      self(item['url'], destination=dest, type=item['type'], **item['options'])
+
 
 format_string = "[URL] [destination] [type] <options>"
 def read_manifests(*manifests):