changeset 21:4df3e715817d

now have passing tests again
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 27 Feb 2012 13:44:52 -0800
parents 11bc01a089e7
children aad329df2548
files paint/package.py tests/doctest.txt
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/paint/package.py	Mon Feb 27 13:10:18 2012 -0800
+++ b/paint/package.py	Mon Feb 27 13:44:52 2012 -0800
@@ -9,6 +9,7 @@
 import tarfile
 import tempfile
 import urllib2
+import urlparse
 import utils
 
 try:
@@ -145,6 +146,7 @@
     def dependencies(self):
         """return the dependencies"""
 
+        # get the egg_info directory
         egg_info = self.egg_info()
 
         # read the dependencies
@@ -153,4 +155,17 @@
             dependencies = [i.strip() for i in file(requires).readlines() if i.strip()]
         else:
             dependencies = []
+        dependencies = dict([(i, None) for i in dependencies])
 
+        # read the dependency links
+        dependency_links = os.path.join(egg_info, 'dependency_links.txt')
+        if os.path.exists(dependency_links):
+            links = [i.strip() for i in file(dependency_links).readlines() if i.strip()]
+            for link in links:
+                # XXX pretty ghetto
+                assert '#egg=' in link
+                url, dep = link.split('#egg=', 1)
+                if dep in dependencies:
+                    dependencies[dep] = link
+
+        return dependencies
--- a/tests/doctest.txt	Mon Feb 27 13:10:18 2012 -0800
+++ b/tests/doctest.txt	Mon Feb 27 13:44:52 2012 -0800
@@ -9,4 +9,6 @@
 
     >>> jetperf = paint.Package('http://k0s.org/mozilla/hg/jetperf/archive/tip.tar.gz')
     >>> dependencies = jetperf.dependencies()
+    >>> dependencies == {'mozharness': 'http://hg.mozilla.org/build/mozharness/archive/tip.tar.gz#egg=mozharness', 'talos': 'http://hg.mozilla.org/build/talos/archive/tip.tar.gz#egg=talos'}
+    True
     >>> jetperf.cleanup()