[csw-devel] SF.net SVN: gar:[22075] csw/mgar/gar/v2/lib/python/package_checks.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Oct 1 15:14:00 CEST 2013


Revision: 22075
          http://gar.svn.sourceforge.net/gar/?rev=22075&view=rev
Author:   wahwah
Date:     2013-10-01 13:14:00 +0000 (Tue, 01 Oct 2013)
Log Message:
-----------
checkpkg: A Python package must contain .py files

A new check.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/package_checks.py

Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2013-10-01 12:46:43 UTC (rev 22074)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2013-10-01 13:14:00 UTC (rev 22075)
@@ -852,13 +852,11 @@
     # It's not a Python 2.x module. Nothing to see here.
     return
   spotted_a_py26_file = False
-  example_py_file = ""
   for pkgmap_entry in pkg_data["pkgmap"]:
     if not pkgmap_entry["path"]:
       continue
     if py26_file_re.match(pkgmap_entry["path"]):
       spotted_a_py26_file = True
-      example_py_file = pkgmap_entry["path"]
       break
   if not spotted_a_py26_file:
     error_mgr.ReportError("python-package-missing-py26-files")
@@ -867,6 +865,28 @@
         "does not contain any files for Python 2.6. ")
 
 
+def CheckPyPackageContainsPyFiles(pkg_data, error_mgr, logger, messenger):
+  """Packages named CSWpy- must provide files for Python 2.6."""
+  py_file_re = re.compile(r"/opt/csw/lib/python.*\.py$")
+  pkgname = pkg_data["basic_stats"]["pkgname"]
+  has_py_prefix = pkgname.startswith("CSWpy-")
+  if not has_py_prefix:
+    # It's not a Python module. Nothing to see here.
+    return
+  spotted_a_py_file = False
+  for pkgmap_entry in pkg_data["pkgmap"]:
+    if not pkgmap_entry["path"]:
+      continue
+    if py_file_re.match(pkgmap_entry["path"]):
+      spotted_a_py_file = True
+      break
+  if not spotted_a_py_file:
+    error_mgr.ReportError("python-package-missing-py-files")
+    messenger.Message(
+        "The package has the CSWpy- prefix but "
+        "does not contain any .py files.")
+
+
 def CheckArchitecture(pkg_data, error_mgr, logger, messenger):
   pkgname = pkg_data["basic_stats"]["pkgname"]
   for metadata in pkg_data["files_metadata"]:

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list