]> granicus.if.org Git - python/commitdiff
Added the "distribution query" methods: 'has_pure_modules()',
authorGreg Ward <gward@python.net>
Wed, 29 Mar 2000 02:20:45 +0000 (02:20 +0000)
committerGreg Ward <gward@python.net>
Wed, 29 Mar 2000 02:20:45 +0000 (02:20 +0000)
'has_ext_modules()', 'has_c_libraries()', 'has_modules()', and 'is_pure()'.

Lib/distutils/core.py

index 5090f25bc37b98c6ed466ba3bbb2d7ce70280973..08a1d641d1843bb9d268c7aa65d6df6dee322390 100644 (file)
@@ -618,7 +618,27 @@ class Distribution:
 
         return tuple (values)
 
-# end class Distribution
+
+    # -- Distribution query methods ------------------------------------
+
+    def has_pure_modules (self):
+        return len (self.packages or self.py_modules or []) > 0
+
+    def has_ext_modules (self):
+        return self.ext_modules and len (self.ext_modules) > 0
+
+    def has_c_libraries (self):
+        return self.libraries and len (self.libraries) > 0
+
+    def has_modules (self):
+        return self.has_pure_modules() or self.has_ext_modules()
+
+    def is_pure (self):
+        return (self.has_pure_modules() and
+                not self.has_ext_modules() and
+                not self.has_c_libraries())
+
+# class Distribution
 
 
 class Command:
@@ -992,4 +1012,4 @@ class Command:
 
     # make_file ()
 
-# end class Command
+# class Command