[Zope-CVS] CVS: Products/Basket - basket.py:1.3

Chris McDonough chrism at plope.com
Thu Nov 10 14:37:14 EST 2005


Update of /cvs-repository/Products/Basket
In directory cvs.zope.org:/tmp/cvs-serv5000

Modified Files:
	basket.py 
Log Message:
Ensure that distros blown out to tempfiles have the correct metadata.


=== Products/Basket/basket.py 1.2 => 1.3 ===
--- Products/Basket/basket.py:1.2	Thu Nov 10 13:58:30 2005
+++ Products/Basket/basket.py	Thu Nov 10 14:37:14 2005
@@ -59,7 +59,7 @@
         for point in points:
             # XXX deal with duplicate product names by raising an exception
             # somewhere in here.
-            eggname = ' '.join(textwrap.wrap(point.dist.location, 80))
+            eggtitle = ' '.join(textwrap.wrap(point.dist.location, 80))
             try:
                 product_pkg = get_containing_package(point.module_name)
             except:
@@ -76,7 +76,7 @@
             productname = product_pkg.__name__.split('.')[-1]
             initializer = get_initializer(point, productname, debug_mode)
             context = EggProductContext(productname, initializer, app,
-                                        product_pkg, eggname)
+                                        product_pkg, eggtitle)
             returned = context.install(debug_mode)
             data.append(returned)
 
@@ -127,7 +127,7 @@
                 # if it's not zip-safe, blast it out to a tempdir and create
                 # new distro out of the file-based egg; we delete the
                 # tempdir at system exit
-                if by_require: # these get added to the working set above
+                if by_require: # these get added to the working set in req mode
                     remove_distribution_from_working_set(distribution)
                 tempdir = tempfile.mkdtemp()
                 eggname = os.path.basename(distribution.location)
@@ -136,7 +136,10 @@
                 self.tempdirs.append(tempdir)
                 un = unzip.unzip()
                 un.extract(distribution.location, eggdir)
-                new_distro = pkg_resources.Distribution.from_filename(eggdir)
+                metadata = pkg_resources.PathMetadata(eggdir,
+                                        os.path.join(eggdir, 'EGG-INFO'))
+                new_distro = pkg_resources.Distribution.from_filename(
+                    eggdir, metadata=metadata)
                 working_set.add(new_distro)
 
         self.pre_initialized = True



More information about the Zope-CVS mailing list