diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2006-10-23 13:32:21 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2006-10-23 13:32:21 +0000 |
commit | 29fb68e4a59dd18bb84e2bed46949f245f9b0327 (patch) | |
tree | 946398e6f54ac57c1829499ae6281ddf84d486f3 /RepSys/__init__.py | |
parent | e6afb8fdb59e4d2754cfc9db8cc3834d6e6411dc (diff) | |
download | mgarepo-29fb68e4a59dd18bb84e2bed46949f245f9b0327.tar mgarepo-29fb68e4a59dd18bb84e2bed46949f245f9b0327.tar.gz mgarepo-29fb68e4a59dd18bb84e2bed46949f245f9b0327.tar.bz2 mgarepo-29fb68e4a59dd18bb84e2bed46949f245f9b0327.tar.xz mgarepo-29fb68e4a59dd18bb84e2bed46949f245f9b0327.zip |
- fixed the problem of trailling slashes in package urls
Diffstat (limited to 'RepSys/__init__.py')
-rw-r--r-- | RepSys/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/RepSys/__init__.py b/RepSys/__init__.py index c371e7a..c394746 100644 --- a/RepSys/__init__.py +++ b/RepSys/__init__.py @@ -1,9 +1,28 @@ #!/usr/bin/python +import re +import os import ConfigParser + config = ConfigParser.Config() del ConfigParser class Error(Exception): pass +class RepSysTree: + """ + This class just hold methods that abstract all the not-so-explicit + rules about the directory structure of a repsys repository. + """ + def fixpath(cls, url): + return re.sub("/+$", "", url) + fixpath = classmethod(fixpath) + + def pkgname(cls, pkgdirurl): + # we must remove trailling slashes in the package path because + # os.path.basename could return "" from URLs ending with "/" + fixedurl = cls.fixpath(pkgdirurl) + return os.path.basename(fixedurl) + pkgname = classmethod(pkgname) + # vim:et:ts=4:sw=4 |