From 8617263c079908e092b02bb4af635578bf308992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Fri, 24 Jun 2005 16:22:03 +0000 Subject: [PATCH] * removepathprefix'de de yazdigim splitpath'i kullan, testini de yap guzelce --- pisi/install.py | 4 +--- pisi/util.py | 6 +++--- tests/utiltests.py | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pisi/install.py b/pisi/install.py index b3b9e2f4..81808981 100644 --- a/pisi/install.py +++ b/pisi/install.py @@ -27,10 +27,8 @@ def install(package_fn): util.clean_dir(config.install_dir()) package.extract_PISI_files(config.install_dir()) - import sys - sys.exit(1) - # verify package + # check if we have all required files metadata = MetaData() diff --git a/pisi/util.py b/pisi/util.py index 2d0efff4..f31e7218 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -88,9 +88,9 @@ def subpath(a, b): "find if path a is before b in the directory tree" return prefix(splitpath(a), splitpath(b)) -def removepathprefix(a, b): - "remove path prefix a from p, finding the pathname rooted at a" - comps = remove_prefix(os.path.split(a), os.path.split(b)) +def removepathprefix(prefix, path): + "remove path prefix a from b, finding the pathname rooted at a" + comps = remove_prefix(splitpath(prefix), splitpath(path)) if len(comps) > 0: return os.path.join(*tuple(comps)) else: diff --git a/tests/utiltests.py b/tests/utiltests.py index 6540e65d..479c91da 100644 --- a/tests/utiltests.py +++ b/tests/utiltests.py @@ -14,4 +14,8 @@ class UtilTestCase(unittest.TestCase): self.assert_(subpath('usr', 'usr/local/src')) self.assert_(not subpath('usr/local', 'usr')) + def testRemovePathPrefix(self): + a = removepathprefix('usr/local', 'usr/local/lib') + self.assertEqual(a, 'lib') + suite = unittest.makeSuite(UtilTestCase)