[csw-devel] SF.net SVN: gar:[15946] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Fri Oct 21 10:07:13 CEST 2011
Revision: 15946
http://gar.svn.sourceforge.net/gar/?rev=15946&view=rev
Author: wahwah
Date: 2011-10-21 08:07:12 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
checkpkg: unit tests updated for relocated support
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/inspective_package.py
csw/mgar/gar/v2/lib/python/inspective_package_test.py
Modified: csw/mgar/gar/v2/lib/python/inspective_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package.py 2011-10-21 08:06:40 UTC (rev 15945)
+++ csw/mgar/gar/v2/lib/python/inspective_package.py 2011-10-21 08:07:12 UTC (rev 15946)
@@ -126,12 +126,16 @@
self.CheckPkgpathExists()
remove_prefix = "%s/" % self.pkgpath
self.file_paths = self.GetPathsInSubdir(remove_prefix, "root")
- self.file_paths += self.GetPathsInSubdir(remove_prefix, "reloc")
+ if self.RelocPresent():
+ self.file_paths += self.GetPathsInSubdir(remove_prefix, "reloc")
return self.file_paths
+ def RelocPresent(self):
+ return os.path.exists(os.path.join(self.directory, "reloc"))
+
def GetFilesDir(self):
"""Returns the subdirectory in which files, are either "reloc" or "root"."""
- if os.path.exists(os.path.join(self.directory, "reloc")):
+ if self.RelocPresent():
return "reloc"
else:
return "root"
Modified: csw/mgar/gar/v2/lib/python/inspective_package_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package_test.py 2011-10-21 08:06:40 UTC (rev 15945)
+++ csw/mgar/gar/v2/lib/python/inspective_package_test.py 2011-10-21 08:07:12 UTC (rev 15946)
@@ -46,10 +46,14 @@
u'/fake/path/CSWfoo/root/foo-file').AndReturn(
"application/x-executable")
self.mox.StubOutWithMock(os.path, 'isdir')
+ self.mox.StubOutWithMock(os.path, 'exists')
self.mox.StubOutWithMock(os, 'walk')
+ # self.mox.StubOutWithMock(__builtins__, 'open')
os.path.isdir("/fake/path/CSWfoo").AndReturn(True)
os.path.isdir("/fake/path/CSWfoo").AndReturn(True)
os.path.isdir("/fake/path/CSWfoo").AndReturn(True)
+ os.path.exists("/fake/path/CSWfoo/reloc").AndReturn(False)
+ os.path.exists("/fake/path/CSWfoo/reloc").AndReturn(False)
os.walk("/fake/path/CSWfoo/root").AndReturn(
[
("/fake/path/CSWfoo/root", [], ["foo-file"]),
@@ -57,6 +61,9 @@
)
self.mox.ReplayAll()
ip = inspective_package.InspectivePackage("/fake/path/CSWfoo")
+ ip.pkginfo_dict = {
+ "BASEDIR": "",
+ }
self.assertEqual(["foo-file"], ip.ListBinaries())
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