SVN: zpkgtools/trunk/zpkgsetup/ add at least a minimal test for walk_packages(), noting a serious limitation

"Fred L. Drake, Jr." <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Log message for revision 38080:
  add at least a minimal test for walk_packages(), noting a serious limitation
  that cannot be fixed right now
  

Changed:
  U   zpkgtools/trunk/zpkgsetup/setup.py
  U   zpkgtools/trunk/zpkgsetup/tests/test_setup.py

-=-
Modified: zpkgtools/trunk/zpkgsetup/setup.py
===================================================================
--- zpkgtools/trunk/zpkgsetup/setup.py	2005-08-24 20:58:25 UTC (rev 38079)
+++ zpkgtools/trunk/zpkgsetup/setup.py	2005-08-24 21:41:26 UTC (rev 38080)
@@ -151,6 +151,16 @@
         path in POSIX notation.
 
         """
+        #
+        # walk_packages() doesn't pick up packages that don't have a
+        # SETUP.cfg in them, so it's not everything we want.  However,
+        # picking up C extensions in leaf packages gets us an in-place
+        # build, which is a good start.
+        #
+        # To fix this, the zpkgsetup code needs to understand the
+        # right way to detect package boundaries, which is currently
+        # done implicitly by the distribution construction code.
+        #
         parts = root.split("/")
         local_root = os.path.join(*parts)
         prefix_len = len(os.path.join(local_root, ""))

Modified: zpkgtools/trunk/zpkgsetup/tests/test_setup.py
===================================================================
--- zpkgtools/trunk/zpkgsetup/tests/test_setup.py	2005-08-24 20:58:25 UTC (rev 38079)
+++ zpkgtools/trunk/zpkgsetup/tests/test_setup.py	2005-08-24 21:41:26 UTC (rev 38080)
@@ -52,6 +52,23 @@
         self.assertEqual(context.package_data,
                          {"package2": ["PUBLICATION.cfg", "SETUP.cfg"]})
 
+    def test_walk_packages(self):
+        import zpkgsetup
+        top = os.path.dirname(os.path.dirname(zpkgsetup.__file__))
+        context = setup.SetupContext("collection", "0.1.2",
+                                     os.path.join(top, "setup.py"))
+        context.walk_packages("zpkgsetup/tests/input")
+        context.packages.sort()
+        self.assertEqual(context.ext_modules[0].name, "package2.sample")
+        #
+        # See the comments in the walk_packages() function for an
+        # explanation of the limitations of the method.  The following
+        # check is commented out due to the limitation, but should be
+        # enabled with a proper implementation.
+        #
+        #self.assertEqual(context.packages, ["package", "package2"])
+        
 
+
 def test_suite():
     return unittest.makeSuite(SetupContextTestCase)

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.