[csw-devel] SF.net SVN: gar:[14964] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sat Jul 2 15:22:05 CEST 2011
Revision: 14964
http://gar.svn.sourceforge.net/gar/?rev=14964&view=rev
Author: wahwah
Date: 2011-07-02 13:22:05 +0000 (Sat, 02 Jul 2011)
Log Message:
-----------
checkpkg: Use /opt/csw/share/opencsw/gar for data
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/checkpkg_lib.py
csw/mgar/gar/v2/lib/python/common_constants.py
Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py 2011-07-02 13:21:27 UTC (rev 14963)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py 2011-07-02 13:22:05 UTC (rev 14964)
@@ -36,6 +36,10 @@
pass
+class DataError(Error):
+ """A problem with reading required data."""
+
+
REPORT_TMPL = u"""#if $missing_deps or $surplus_deps or $orphan_sonames
Dependency issues of $pkgname:
#end if
@@ -377,12 +381,23 @@
def _GetPathsForArch(self, arch):
if not arch in self.lines_dict:
- file_name = os.path.join(
- os.path.dirname(__file__), "..", "..", "etc", "commondirs-%s" % arch)
- logging.debug("opening %s", file_name)
- f = open(file_name, "r")
- self.lines_dict[arch] = f.read().splitlines()
- f.close()
+ base_name = "commondirs-%s" % arch
+ paths = [
+ os.path.join(os.path.dirname(__file__), "..", "..", "etc", base_name),
+ os.path.join(common_constants.OPENCSW_SHARE, "gar", base_name)
+ ]
+ path_found = False
+ for file_name in paths:
+ if not os.path.exists(file_name):
+ continue
+ # There is a race condition here, but we don't worry about it.
+ path_found = True
+ logging.debug("opening %s", file_name)
+ with open(file_name, "r") as f:
+ self.lines_dict[arch] = f.read().splitlines()
+ break
+ if not path_found:
+ raise DataError("Could not find the %s file." % base_name)
return self.lines_dict[arch]
def GetCommonPaths(self, arch):
Modified: csw/mgar/gar/v2/lib/python/common_constants.py
===================================================================
--- csw/mgar/gar/v2/lib/python/common_constants.py 2011-07-02 13:21:27 UTC (rev 14963)
+++ csw/mgar/gar/v2/lib/python/common_constants.py 2011-07-02 13:22:05 UTC (rev 14964)
@@ -69,3 +69,6 @@
DO_NOT_REPORT_MISSING_RE = [r"\*?SUNW.*"]
PSTAMP_RE = r"(?P<username>\w+)@(?P<hostname>[\w\.-]+)-(?P<timestamp>\d+)"
+
+# The directory with shared, architecture independent data files.
+OPENCSW_SHARE = "/opt/csw/share/opencsw"
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