source: soft/build_system/build_system/repsys/tags/V1_6_17/RepSys/__init__.py @ 1

Last change on this file since 1 was 1, checked in by fasma, 12 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 824 bytes
Line 
1#!/usr/bin/python
2import re
3import os
4import tempfile
5
6import ConfigParser
7
8config = ConfigParser.Config()
9tempfile.tempdir = config.get("global", "tempdir", None) or None # when ""
10del ConfigParser
11
12class Error(Exception): pass
13
14class RepSysTree:
15    """
16    This class just hold methods that abstract all the not-so-explicit
17    rules about the directory structure of a repsys repository.
18    """
19    def fixpath(cls, url):
20        return re.sub("/+$", "", url)
21    fixpath = classmethod(fixpath)
22
23    def pkgname(cls, pkgdirurl):
24        # we must remove trailling slashes in the package path because
25        # os.path.basename could return "" from URLs ending with "/"
26        fixedurl = cls.fixpath(pkgdirurl)
27        return os.path.basename(fixedurl)
28    pkgname = classmethod(pkgname)
29           
30# vim:et:ts=4:sw=4
Note: See TracBrowser for help on using the repository browser.