From 8c4d7440c6d47f7ed690edafb7c0af53742f3297 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 22 Mar 2010 21:32:08 +0100 Subject: Move library files to layman/dbtools/ --- diff-gitosis-conf-against-repositories-xml.py | 2 +- extradata.py | 93 --------------------------- feedextractors.py | 60 ----------------- layman/__init__.py | 0 layman/dbtools/__init__.py | 0 layman/dbtools/extradata.py | 93 +++++++++++++++++++++++++++ layman/dbtools/feedextractors.py | 60 +++++++++++++++++ layman/dbtools/sharedutils.py | 45 +++++++++++++ sharedutils.py | 45 ------------- write-layman-global-txt.py | 2 +- write-overlays-ini.py | 2 +- write-repositories-xml.py | 6 +- 12 files changed, 204 insertions(+), 204 deletions(-) delete mode 100644 extradata.py delete mode 100644 feedextractors.py create mode 100644 layman/__init__.py create mode 100644 layman/dbtools/__init__.py create mode 100644 layman/dbtools/extradata.py create mode 100644 layman/dbtools/feedextractors.py create mode 100644 layman/dbtools/sharedutils.py delete mode 100644 sharedutils.py diff --git a/diff-gitosis-conf-against-repositories-xml.py b/diff-gitosis-conf-against-repositories-xml.py index c2c0d53..38f7181 100755 --- a/diff-gitosis-conf-against-repositories-xml.py +++ b/diff-gitosis-conf-against-repositories-xml.py @@ -24,7 +24,7 @@ import xml.etree.ElementTree as ET from ConfigParser import ConfigParser import re -from sharedutils import * # local +from layman.dbtools.sharedutils import * # local def sort_as_in(elements, tag_order): diff --git a/extradata.py b/extradata.py deleted file mode 100644 index 117509f..0000000 --- a/extradata.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (C) 2009 Sebastian Pipping -# Licensed under GPL 2 or later - -QUALITY_CORE = 'core' -QUALITY_STABLE = 'stable' -QUALITY_TESTING = 'testing' -QUALITY_EXPERIMENTAL = 'experimental' -QUALITY_GRAVEYARD = 'graveyard' - -TRANSITION_DATA_EXTRA = { - 'bazaar':{ - 'owner':{ - 'name':'Mark Lee', - 'email':'malept@malept.com', - }, - 'feeds':[ - 'http://bazaar.launchpad.net/~serkan-kaba/serkan-overlay/mainline/atom', - ], - }, - 'lila-theme':{ - 'owner':{ - 'email':'fosstux@gmail.com', - }, - }, - 'rbu':{ - 'quality':QUALITY_EXPERIMENTAL, - 'owner':{ - 'name':'Robert Buchholz', - }, - }, - 'sping':{ - 'quality':QUALITY_EXPERIMENTAL, - 'owner':{ - 'name':'Sebastian Pipping', - }, - }, - 'jyujin':{'feeds':['http://git.jyujin.de/?p=portage-overlay.git;a=atom']}, - 'pioto-overlay':{'feeds':['http://git.pioto.org/gitweb/pioto-overlay.git?a=atom']}, - 'thousand-parsec':{'feeds':['http://git.thousandparsec.net/gitweb/gitweb.cgi?p=gentoo-overlay.git;a=atom']}, - 'hollow':{'feeds':['http://git.xnull.de/gitweb/?p=overlay.git;a=atom']}, - 'zen-overlay':{'feeds':['http://git.zen-sources.org/?p=portage-overlay.git;a=atom']}, - 'THE':{'feeds':['http://git.zen-sources.org/?p=THE.git;a=atom']}, - 'lxde':{'feeds':['http://bitbucket.org/yngwin/lxde-overlay/atom/']}, - 'njw':{'feeds':['http://git.njw.me.uk/cgit/cgit.cgi/njw-gentoo-local/atom/?h=master']}, - 'oss-overlay':{'feeds':['http://hg.atheme.org/users/majeru/portage-overlay/atom-log']}, - 'devnull':{'feeds':['http://hg.core.ws/devnull/atom-log']}, - 'mamona':{'feeds':['http://rsalveti.net/git/?p=mamona-overlay;a=atom']}, - 'voyageur':{'feeds':['http://cafarelli.fr/websvn/rss.php?repname=voyageur-overlay&path=&isdir=1']}, - 'akoya':{'feeds':['https://hg.poildetroll.net/gentoo/overlay/atom-log']}, - 'pd-overlay':{'feeds':['http://sourceforge.net/export/rss2_keepsake.php?group_id=180376']}, - 'tryton':{'feeds':['http://hg.tryton.org/hgwebdir.cgi/tryton-overlay/atom-log']}, - 'sabayon':{'feeds':['http://gitweb.sabayon.org/?p=overlay.git;a=atom']}, -} - -# List more or less from current -TRANSITION_DATA_PROJECTS = set(( - 'cell', - 'efika', - 'emacs', - 'finnish', - 'gnome', - 'gnustep', - 'hardened-development', - 'java-overlay', - 'kde-testing', - 'kolab', - 'mozilla', - 'mysql-testing', - 'nx', - 'perl-experimental', - 'php-4', - 'php-experimental', - 'php-testing', - 'postgresql-experimental', - 'postgresql-testing', - 'powerpc', - 'python', - 'rox', - 'ruby', - 'science', - 'sunrise', - 'toolchain', - 'vdr-devel', - 'vdr-experimental', - 'vdr-testing', - 'vdr-xine', - 'vmware', - 'voip', - 'vps', - 'webapps-experimental', - 'xen', - 'xfce-dev', -)) diff --git a/feedextractors.py b/feedextractors.py deleted file mode 100644 index 553d9a8..0000000 --- a/feedextractors.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2009 Sebastian Pipping -# Licensed under GPL 2 or later - -import re -FEED_EXTRACTORS = [] - -def _register_feed_extractor(pattern, format): - regex = re.compile(pattern) - FEED_EXTRACTORS.append({'regex':regex, 'format':format}) - - -# git://github.com/dang/kvm.git -# http://github.com/feeds/dang/commits/kvm/master -_register_feed_extractor( - '^[^ ]+://github.com/([^/]+)/([^/.]+)(?:.git)?$', - 'http://github.com/feeds/\\1/commits/\\2/master') - - -# git://gitorious.org/gentoo-multimedia/gentoo-multimedia.git -# http://gitorious.org/gentoo-multimedia.atom -_register_feed_extractor( - '^[^ ]+://gitorious.org/([^/]+)/[^/.]+(?:.git)?$', - 'http://gitorious.org/\\1.atom') - -# git://git.overlays.gentoo.org/dev/alexxy.git -# http://git.overlays.gentoo.org/gitweb/?p=dev/alexxy.git;a=atom -_register_feed_extractor( - '^[^ ]+://git.overlays.gentoo.org/(dev|proj)/([^/.]+)(?:.git)?$', - 'http://git.overlays.gentoo.org/gitweb/?p=\\1/\\2.git;a=atom') - -# git://repo.or.cz/dottout.git -# http://repo.or.cz/w/dottout.git?a=rss -_register_feed_extractor( - '^[^ ]+://repo.or.cz/([^/.]+)(?:.git)?$', - 'http://repo.or.cz/w/\\1.git?a=rss') # atom broken currently - -# http://gentoo-china-overlay.googlecode.com/svn/trunk/ -# http://code.google.com/feeds/p/gentoo-china-overlay/svnchanges/basic -_register_feed_extractor( - '^[^ ]+://([^ ]+).googlecode.com/svn/.*$', - 'http://code.google.com/feeds/p/\\1/svnchanges/basic') - -# https://arcon.googlecode.com/hg/ -# http://code.google.com/feeds/p/arcon/hgchanges/basic -_register_feed_extractor( - '^[^ ]+://([^ ]+).googlecode.com/hg/.*$', - 'http://code.google.com/feeds/p/\\1/hgchanges/basic') - -# git://git.goodpoint.de/overlay-sping.git -# http://git.goodpoint.de/?p=overlay-sping.git;a=atom -_register_feed_extractor( - '^[^ ]+://git.goodpoint.de/([^/.]+)(?:.git)?$', - 'http://git.goodpoint.de/?p=\\1.git;a=atom') - - -# svn://overlays.gentoo.org/proj/toolchain -# http://overlays.gentoo.org/proj/toolchain/timeline -_register_feed_extractor( - '^svn://overlays.gentoo.org/(dev|proj)/([^/]+)(?:/.*)?$', - 'http://overlays.gentoo.org/\\1/\\2/timeline') diff --git a/layman/__init__.py b/layman/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/layman/dbtools/__init__.py b/layman/dbtools/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/layman/dbtools/extradata.py b/layman/dbtools/extradata.py new file mode 100644 index 0000000..117509f --- /dev/null +++ b/layman/dbtools/extradata.py @@ -0,0 +1,93 @@ +# Copyright (C) 2009 Sebastian Pipping +# Licensed under GPL 2 or later + +QUALITY_CORE = 'core' +QUALITY_STABLE = 'stable' +QUALITY_TESTING = 'testing' +QUALITY_EXPERIMENTAL = 'experimental' +QUALITY_GRAVEYARD = 'graveyard' + +TRANSITION_DATA_EXTRA = { + 'bazaar':{ + 'owner':{ + 'name':'Mark Lee', + 'email':'malept@malept.com', + }, + 'feeds':[ + 'http://bazaar.launchpad.net/~serkan-kaba/serkan-overlay/mainline/atom', + ], + }, + 'lila-theme':{ + 'owner':{ + 'email':'fosstux@gmail.com', + }, + }, + 'rbu':{ + 'quality':QUALITY_EXPERIMENTAL, + 'owner':{ + 'name':'Robert Buchholz', + }, + }, + 'sping':{ + 'quality':QUALITY_EXPERIMENTAL, + 'owner':{ + 'name':'Sebastian Pipping', + }, + }, + 'jyujin':{'feeds':['http://git.jyujin.de/?p=portage-overlay.git;a=atom']}, + 'pioto-overlay':{'feeds':['http://git.pioto.org/gitweb/pioto-overlay.git?a=atom']}, + 'thousand-parsec':{'feeds':['http://git.thousandparsec.net/gitweb/gitweb.cgi?p=gentoo-overlay.git;a=atom']}, + 'hollow':{'feeds':['http://git.xnull.de/gitweb/?p=overlay.git;a=atom']}, + 'zen-overlay':{'feeds':['http://git.zen-sources.org/?p=portage-overlay.git;a=atom']}, + 'THE':{'feeds':['http://git.zen-sources.org/?p=THE.git;a=atom']}, + 'lxde':{'feeds':['http://bitbucket.org/yngwin/lxde-overlay/atom/']}, + 'njw':{'feeds':['http://git.njw.me.uk/cgit/cgit.cgi/njw-gentoo-local/atom/?h=master']}, + 'oss-overlay':{'feeds':['http://hg.atheme.org/users/majeru/portage-overlay/atom-log']}, + 'devnull':{'feeds':['http://hg.core.ws/devnull/atom-log']}, + 'mamona':{'feeds':['http://rsalveti.net/git/?p=mamona-overlay;a=atom']}, + 'voyageur':{'feeds':['http://cafarelli.fr/websvn/rss.php?repname=voyageur-overlay&path=&isdir=1']}, + 'akoya':{'feeds':['https://hg.poildetroll.net/gentoo/overlay/atom-log']}, + 'pd-overlay':{'feeds':['http://sourceforge.net/export/rss2_keepsake.php?group_id=180376']}, + 'tryton':{'feeds':['http://hg.tryton.org/hgwebdir.cgi/tryton-overlay/atom-log']}, + 'sabayon':{'feeds':['http://gitweb.sabayon.org/?p=overlay.git;a=atom']}, +} + +# List more or less from current +TRANSITION_DATA_PROJECTS = set(( + 'cell', + 'efika', + 'emacs', + 'finnish', + 'gnome', + 'gnustep', + 'hardened-development', + 'java-overlay', + 'kde-testing', + 'kolab', + 'mozilla', + 'mysql-testing', + 'nx', + 'perl-experimental', + 'php-4', + 'php-experimental', + 'php-testing', + 'postgresql-experimental', + 'postgresql-testing', + 'powerpc', + 'python', + 'rox', + 'ruby', + 'science', + 'sunrise', + 'toolchain', + 'vdr-devel', + 'vdr-experimental', + 'vdr-testing', + 'vdr-xine', + 'vmware', + 'voip', + 'vps', + 'webapps-experimental', + 'xen', + 'xfce-dev', +)) diff --git a/layman/dbtools/feedextractors.py b/layman/dbtools/feedextractors.py new file mode 100644 index 0000000..553d9a8 --- /dev/null +++ b/layman/dbtools/feedextractors.py @@ -0,0 +1,60 @@ +# Copyright (C) 2009 Sebastian Pipping +# Licensed under GPL 2 or later + +import re +FEED_EXTRACTORS = [] + +def _register_feed_extractor(pattern, format): + regex = re.compile(pattern) + FEED_EXTRACTORS.append({'regex':regex, 'format':format}) + + +# git://github.com/dang/kvm.git +# http://github.com/feeds/dang/commits/kvm/master +_register_feed_extractor( + '^[^ ]+://github.com/([^/]+)/([^/.]+)(?:.git)?$', + 'http://github.com/feeds/\\1/commits/\\2/master') + + +# git://gitorious.org/gentoo-multimedia/gentoo-multimedia.git +# http://gitorious.org/gentoo-multimedia.atom +_register_feed_extractor( + '^[^ ]+://gitorious.org/([^/]+)/[^/.]+(?:.git)?$', + 'http://gitorious.org/\\1.atom') + +# git://git.overlays.gentoo.org/dev/alexxy.git +# http://git.overlays.gentoo.org/gitweb/?p=dev/alexxy.git;a=atom +_register_feed_extractor( + '^[^ ]+://git.overlays.gentoo.org/(dev|proj)/([^/.]+)(?:.git)?$', + 'http://git.overlays.gentoo.org/gitweb/?p=\\1/\\2.git;a=atom') + +# git://repo.or.cz/dottout.git +# http://repo.or.cz/w/dottout.git?a=rss +_register_feed_extractor( + '^[^ ]+://repo.or.cz/([^/.]+)(?:.git)?$', + 'http://repo.or.cz/w/\\1.git?a=rss') # atom broken currently + +# http://gentoo-china-overlay.googlecode.com/svn/trunk/ +# http://code.google.com/feeds/p/gentoo-china-overlay/svnchanges/basic +_register_feed_extractor( + '^[^ ]+://([^ ]+).googlecode.com/svn/.*$', + 'http://code.google.com/feeds/p/\\1/svnchanges/basic') + +# https://arcon.googlecode.com/hg/ +# http://code.google.com/feeds/p/arcon/hgchanges/basic +_register_feed_extractor( + '^[^ ]+://([^ ]+).googlecode.com/hg/.*$', + 'http://code.google.com/feeds/p/\\1/hgchanges/basic') + +# git://git.goodpoint.de/overlay-sping.git +# http://git.goodpoint.de/?p=overlay-sping.git;a=atom +_register_feed_extractor( + '^[^ ]+://git.goodpoint.de/([^/.]+)(?:.git)?$', + 'http://git.goodpoint.de/?p=\\1.git;a=atom') + + +# svn://overlays.gentoo.org/proj/toolchain +# http://overlays.gentoo.org/proj/toolchain/timeline +_register_feed_extractor( + '^svn://overlays.gentoo.org/(dev|proj)/([^/]+)(?:/.*)?$', + 'http://overlays.gentoo.org/\\1/\\2/timeline') diff --git a/layman/dbtools/sharedutils.py b/layman/dbtools/sharedutils.py new file mode 100644 index 0000000..9837b76 --- /dev/null +++ b/layman/dbtools/sharedutils.py @@ -0,0 +1,45 @@ +# Copyright (C) 2009 Sebastian Pipping +# Licensed under GPL 2 or later + +import codecs + +# From +# BEGIN +def indent(elem, level=0): + i = "\n" + level*" " + if len(elem): + if not elem.text or not elem.text.strip(): + elem.text = i + " " + if not elem.tail or not elem.tail.strip(): + elem.tail = i + for elem in elem: + indent(elem, level+1) + if not elem.tail or not elem.tail.strip(): + elem.tail = i + else: + if level and (not elem.tail or not elem.tail.strip()): + elem.tail = i +# END + +def recurse_print(e, level=0): + t = e.text + if t: + if t == '' or t.isspace(): + t = None + else: + t = t.strip('\n\r') + print '%s<%s>%s' % (' '*level, e.tag, t and (' .. %s' % to_ascii(t)) or '') + for k, v in sorted(e.attrib.items()): + print '%s| %s = %s' % (' '*(level+2), k, v) + for c in e.getchildren(): + recurse_print(c, level=level + 1) + +def to_ascii(o, current_encoding='utf-8'): + if not isinstance(o, basestring): + return o + + if isinstance(o, unicode): + s = o + else: + s = unicode(o, current_encoding) + return codecs.encode(s, 'ascii', 'ignore') diff --git a/sharedutils.py b/sharedutils.py deleted file mode 100644 index 9837b76..0000000 --- a/sharedutils.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2009 Sebastian Pipping -# Licensed under GPL 2 or later - -import codecs - -# From -# BEGIN -def indent(elem, level=0): - i = "\n" + level*" " - if len(elem): - if not elem.text or not elem.text.strip(): - elem.text = i + " " - if not elem.tail or not elem.tail.strip(): - elem.tail = i - for elem in elem: - indent(elem, level+1) - if not elem.tail or not elem.tail.strip(): - elem.tail = i - else: - if level and (not elem.tail or not elem.tail.strip()): - elem.tail = i -# END - -def recurse_print(e, level=0): - t = e.text - if t: - if t == '' or t.isspace(): - t = None - else: - t = t.strip('\n\r') - print '%s<%s>%s' % (' '*level, e.tag, t and (' .. %s' % to_ascii(t)) or '') - for k, v in sorted(e.attrib.items()): - print '%s| %s = %s' % (' '*(level+2), k, v) - for c in e.getchildren(): - recurse_print(c, level=level + 1) - -def to_ascii(o, current_encoding='utf-8'): - if not isinstance(o, basestring): - return o - - if isinstance(o, unicode): - s = o - else: - s = unicode(o, current_encoding) - return codecs.encode(s, 'ascii', 'ignore') diff --git a/write-layman-global-txt.py b/write-layman-global-txt.py index 634729c..1e5d718 100755 --- a/write-layman-global-txt.py +++ b/write-layman-global-txt.py @@ -13,7 +13,7 @@ layman_global_txt_location = sys.argv[2] import xml.etree.ElementTree as ET -from sharedutils import * # local +from layman.dbtools.sharedutils import * # local a = ET.parse(open(repositories_xml_location)) repositories = a.getroot() diff --git a/write-overlays-ini.py b/write-overlays-ini.py index 9136f14..af6fdd9 100755 --- a/write-overlays-ini.py +++ b/write-overlays-ini.py @@ -17,7 +17,7 @@ overlays_ini_location = sys.argv[3] import xml.etree.ElementTree as ET from ConfigParser import ConfigParser, DuplicateSectionError -from sharedutils import * # local +from layman.dbtools.sharedutils import * # local a = ET.parse(open(repositories_xml_location)) repositories = a.getroot() diff --git a/write-repositories-xml.py b/write-repositories-xml.py index 5113ae9..6ba5289 100755 --- a/write-repositories-xml.py +++ b/write-repositories-xml.py @@ -35,9 +35,9 @@ else: import xml.etree.ElementTree as ET import codecs -from extradata import * # local -from feedextractors import * # local -from sharedutils import * # local +from layman.dbtools.extradata import * # local +from layman.dbtools.feedextractors import * # local +from layman.dbtools.sharedutils import * # local def to_ascii(o, current_encoding='utf-8'): if not isinstance(o, basestring): -- cgit v1.2.3-65-gdbad