From 1dd087cbad1bb0f51c8283cc3d7d8c6621121f04 Mon Sep 17 00:00:00 2001
From: Jack Jansen <jack.jansen@cwi.nl>
Date: Fri, 7 Jan 2005 13:43:31 +0000
Subject: Allow relative URLs for included databases and packages.

---
 Lib/plat-mac/pimp.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Lib/plat-mac/pimp.py b/Lib/plat-mac/pimp.py
index 625e388..255b57c 100644
--- a/Lib/plat-mac/pimp.py
+++ b/Lib/plat-mac/pimp.py
@@ -402,18 +402,21 @@ class PimpDatabase:
             self._maintainer = plistdata.get('Maintainer', '')
             self._description = plistdata.get('Description', '').strip()
             self._url = url
-        self._appendPackages(plistdata['Packages'])
+        self._appendPackages(plistdata['Packages'], url)
         others = plistdata.get('Include', [])
-        for url in others:
-            self.appendURL(url, included=1)
+        for o in others:
+            o = urllib.basejoin(url, o)
+            self.appendURL(o, included=1)
 
-    def _appendPackages(self, packages):
+    def _appendPackages(self, packages, url):
         """Given a list of dictionaries containing package
         descriptions create the PimpPackage objects and append them
         to our internal storage."""
 
         for p in packages:
             p = dict(p)
+            if p.has_key('Download-URL'):
+                p['Download-URL'] = urllib.basejoin(url, p['Download-URL'])
             flavor = p.get('Flavor')
             if flavor == 'source':
                 pkg = PimpPackage_source(self, p)
-- 
cgit v0.12

