From ad7fb7807ceaee96521d779993a5e1b28650723f Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Tue, 11 Jan 2011 00:35:59 +0000 Subject: rename repsys to mgarepo, RepSys to MgaRepo, and update docs and examples for Mageia --- RepSys/ConfigParser.py | 434 ----------------------- RepSys/__init__.py | 19 -- RepSys/binrepo.py | 395 --------------------- RepSys/cgi/__init__.py | 0 RepSys/cgi/soapserver.py | 93 ----- RepSys/cgi/submit.py | 119 ------- RepSys/cgi/xmlrpcserver.py | 111 ------ RepSys/cgiutil.py | 53 --- RepSys/command.py | 61 ---- RepSys/commands/__init__.py | 0 RepSys/commands/authoremail.py | 37 -- RepSys/commands/changed.py | 41 --- RepSys/commands/ci.py | 35 -- RepSys/commands/co.py | 67 ---- RepSys/commands/create.py | 34 -- RepSys/commands/del.py | 30 -- RepSys/commands/editlog.py | 39 --- RepSys/commands/getspec.py | 38 --- RepSys/commands/getsrpm.py | 100 ------ RepSys/commands/log.py | 62 ---- RepSys/commands/markrelease.py | 103 ------ RepSys/commands/patchspec.py | 38 --- RepSys/commands/putsrpm.py | 59 ---- RepSys/commands/rpmlog.py | 68 ---- RepSys/commands/submit.py | 211 ------------ RepSys/commands/switch.py | 33 -- RepSys/commands/sync.py | 38 --- RepSys/commands/up.py | 22 -- RepSys/commands/upload.py | 28 -- RepSys/layout.py | 207 ----------- RepSys/log.py | 633 ---------------------------------- RepSys/mirror.py | 129 ------- RepSys/plugins/__init__.py | 27 -- RepSys/plugins/ldapusers.py | 189 ---------- RepSys/plugins/sample.py.txt | 14 - RepSys/rpmutil.py | 759 ----------------------------------------- RepSys/simplerpm.py | 19 -- RepSys/svn.py | 430 ----------------------- RepSys/util.py | 141 -------- 39 files changed, 4916 deletions(-) delete mode 100644 RepSys/ConfigParser.py delete mode 100644 RepSys/__init__.py delete mode 100644 RepSys/binrepo.py delete mode 100644 RepSys/cgi/__init__.py delete mode 100644 RepSys/cgi/soapserver.py delete mode 100644 RepSys/cgi/submit.py delete mode 100644 RepSys/cgi/xmlrpcserver.py delete mode 100644 RepSys/cgiutil.py delete mode 100644 RepSys/command.py delete mode 100644 RepSys/commands/__init__.py delete mode 100644 RepSys/commands/authoremail.py delete mode 100644 RepSys/commands/changed.py delete mode 100644 RepSys/commands/ci.py delete mode 100644 RepSys/commands/co.py delete mode 100644 RepSys/commands/create.py delete mode 100644 RepSys/commands/del.py delete mode 100644 RepSys/commands/editlog.py delete mode 100644 RepSys/commands/getspec.py delete mode 100644 RepSys/commands/getsrpm.py delete mode 100644 RepSys/commands/log.py delete mode 100644 RepSys/commands/markrelease.py delete mode 100644 RepSys/commands/patchspec.py delete mode 100644 RepSys/commands/putsrpm.py delete mode 100644 RepSys/commands/rpmlog.py delete mode 100644 RepSys/commands/submit.py delete mode 100644 RepSys/commands/switch.py delete mode 100644 RepSys/commands/sync.py delete mode 100644 RepSys/commands/up.py delete mode 100644 RepSys/commands/upload.py delete mode 100644 RepSys/layout.py delete mode 100644 RepSys/log.py delete mode 100644 RepSys/mirror.py delete mode 100644 RepSys/plugins/__init__.py delete mode 100644 RepSys/plugins/ldapusers.py delete mode 100644 RepSys/plugins/sample.py.txt delete mode 100644 RepSys/rpmutil.py delete mode 100644 RepSys/simplerpm.py delete mode 100644 RepSys/svn.py delete mode 100644 RepSys/util.py (limited to 'RepSys') diff --git a/RepSys/ConfigParser.py b/RepSys/ConfigParser.py deleted file mode 100644 index 3b4e213..0000000 --- a/RepSys/ConfigParser.py +++ /dev/null @@ -1,434 +0,0 @@ -""" -This is a heavily hacked version of ConfigParser to keep the order in -which options and sections are read, and allow multiple options with -the same key. -""" -from __future__ import generators -import string, types -import re - -__all__ = ["NoSectionError","DuplicateSectionError","NoOptionError", - "InterpolationError","InterpolationDepthError","ParsingError", - "MissingSectionHeaderError","ConfigParser", - "MAX_INTERPOLATION_DEPTH"] - -DEFAULTSECT = "DEFAULT" - -MAX_INTERPOLATION_DEPTH = 10 - -# exception classes -class Error(Exception): - def __init__(self, msg=''): - self._msg = msg - Exception.__init__(self, msg) - def __repr__(self): - return self._msg - __str__ = __repr__ - -class NoSectionError(Error): - def __init__(self, section): - Error.__init__(self, 'No section: %s' % section) - self.section = section - -class DuplicateSectionError(Error): - def __init__(self, section): - Error.__init__(self, "Section %s already exists" % section) - self.section = section - -class NoOptionError(Error): - def __init__(self, option, section): - Error.__init__(self, "No option `%s' in section: %s" % - (option, section)) - self.option = option - self.section = section - -class InterpolationError(Error): - def __init__(self, reference, option, section, rawval): - Error.__init__(self, - "Bad value substitution:\n" - "\tsection: [%s]\n" - "\toption : %s\n" - "\tkey : %s\n" - "\trawval : %s\n" - % (section, option, reference, rawval)) - self.reference = reference - self.option = option - self.section = section - -class InterpolationDepthError(Error): - def __init__(self, option, section, rawval): - Error.__init__(self, - "Value interpolation too deeply recursive:\n" - "\tsection: [%s]\n" - "\toption : %s\n" - "\trawval : %s\n" - % (section, option, rawval)) - self.option = option - self.section = section - -class ParsingError(Error): - def __init__(self, filename): - Error.__init__(self, 'File contains parsing errors: %s' % filename) - self.filename = filename - self.errors = [] - - def append(self, lineno, line): - self.errors.append((lineno, line)) - self._msg = self._msg + '\n\t[line %2d]: %s' % (lineno, line) - -class MissingSectionHeaderError(ParsingError): - def __init__(self, filename, lineno, line): - Error.__init__( - self, - 'File contains no section headers.\nfile: %s, line: %d\n%s' % - (filename, lineno, line)) - self.filename = filename - self.lineno = lineno - self.line = line - -class ConfigParser: - def __init__(self, defaults=None): - # Options are stored in __sections_list like this: - # [(sectname, [(optname, optval), ...]), ...] - self.__sections_list = [] - self.__sections_dict = {} - if defaults is None: - self.__defaults = {} - else: - self.__defaults = defaults - - def defaults(self): - return self.__defaults - - def sections(self): - return self.__sections_dict.keys() - - def has_section(self, section): - return self.__sections_dict.has_key(section) - - def options(self, section): - self.__sections_dict[section] - try: - opts = self.__sections_dict[section].keys() - except KeyError: - raise NoSectionError(section) - return self.__defaults.keys()+opts - - def read(self, filenames): - if type(filenames) in types.StringTypes: - filenames = [filenames] - for filename in filenames: - try: - fp = open(filename) - except IOError: - continue - self.__read(fp, filename) - fp.close() - - def readfp(self, fp, filename=None): - if filename is None: - try: - filename = fp.name - except AttributeError: - filename = '' - self.__read(fp, filename) - - def set(self, section, option, value): - if self.__sections_dict.has_key(section): - sectdict = self.__sections_dict[section] - sectlist = [] - self.__sections_list.append((section, sectlist)) - elif section == DEFAULTSECT: - sectdict = self.__defaults - sectlist = None - else: - sectdict = {} - self.__sections_dict[section] = sectdict - sectlist = [] - self.__sections_list.append((section, sectlist)) - xform = self.optionxform(option) - sectdict[xform] = value - if sectlist is not None: - sectlist.append([xform, value]) - - def get(self, section, option, raw=0, vars=None): - d = self.__defaults.copy() - try: - d.update(self.__sections_dict[section]) - except KeyError: - if section != DEFAULTSECT: - raise NoSectionError(section) - if vars: - d.update(vars) - option = self.optionxform(option) - try: - rawval = d[option] - except KeyError: - raise NoOptionError(option, section) - if raw: - return rawval - return self.__interpolate(rawval, d) - - def getall(self, section, option, raw=0, vars=None): - option = self.optionxform(option) - values = [] - d = self.__defaults.copy() - if section != DEFAULTSECT: - for sectname, options in self.__sections_list: - if sectname == section: - for optname, value in options: - if optname == option: - values.append(value) - d[optname] = value - if raw: - return values - if vars: - d.update(vars) - for i in len(values): - values[i] = self.__interpolate(values[i], d) - return values - - def walk(self, section, option=None, raw=0, vars=None): - # Build dictionary for interpolation - try: - d = self.__sections_dict[section].copy() - except KeyError: - if section == DEFAULTSECT: - d = {} - else: - raise NoSectionError(section) - d.update(self.__defaults) - if vars: - d.update(vars) - - # Start walking - if option: - option = self.optionxform(option) - if section != DEFAULTSECT: - for sectname, options in self.__sections_list: - if sectname == section: - for optname, value in options: - if not option or optname == option: - if not raw: - value = self.__interpolate(value, d) - yield (optname, value) - - def __interpolate(self, value, vars): - rawval = value - depth = 0 - while depth < 10: - depth = depth + 1 - if value.find("%(") >= 0: - try: - value = value % vars - except KeyError, key: - raise InterpolationError(key, option, section, rawval) - else: - break - if value.find("%(") >= 0: - raise InterpolationDepthError(option, section, rawval) - return value - - def __get(self, section, conv, option): - return conv(self.get(section, option)) - - def getint(self, section, option): - return self.__get(section, string.atoi, option) - - def getfloat(self, section, option): - return self.__get(section, string.atof, option) - - def getboolean(self, section, option): - states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, - '0': 0, 'no': 0, 'false': 0, 'off': 0} - v = self.get(section, option) - if not states.has_key(v.lower()): - raise ValueError, 'Not a boolean: %s' % v - return states[v.lower()] - - def optionxform(self, optionstr): - #return optionstr.lower() - return optionstr - - def has_option(self, section, option): - """Check for the existence of a given option in a given section.""" - if not section or section == "DEFAULT": - return self.__defaults.has_key(option) - elif not self.has_section(section): - return 0 - else: - option = self.optionxform(option) - return self.__sections_dict[section].has_key(option) - - SECTCRE = re.compile(r'\[(?P
[^]]+)\]') - OPTCRE = re.compile(r'(?P