def lookup_repo_url(self, version=None): if version: release = self.releases.get(version=version) else: release = self.latest handler = repos.get_repo_for_repo_url(release.home_page) if isinstance(handler, repos.unsupported.UnsupportedHandler): return '' elif isinstance(handler, repos.github.GitHubHandler): repo_pattern = '((?:http|https|git)://github.com/[^/]*/[^/]*)/{0,1}' match = re.match(repo_pattern, release.home_page) if match and match.group(1): return match.group(1) else: # only github is special cased for now return release.home_page
def repo(self): return get_repo_for_repo_url(self.repo_url)
def repo(self): handler = get_repo_for_repo_url(self.repo_url) return handler
def test_get_repo_for_repo_url(self): samples = """u'http://repos.entrouvert.org/authentic.git/tree http://code.basieproject.org/ http://znc-sistemas.github.com/django-municipios http://django-brutebuster.googlecode.com/svn/trunk/BruteBuster/ http://hg.piranha.org.ua/byteflow/ http://code.google.com/p/classcomm http://savannah.nongnu.org/projects/dina-project/ tyrion/django-acl/ izi/django-admin-tools/ bkonkle/django-ajaxcomments/ http://django-ajax-selects.googlecode.com/svn/trunk/ http://django-antivirus.googlecode.com/svn/trunk/ codekoala/django-articles/ https://launchpad.net/django-audit https://django-audit.googlecode.com/hg/ tyrion/django-autocomplete/ http://code.google.com/p/django-autocomplete/ http://pypi.python.org/pypi/django-autoreports http://code.google.com/p/django-basic-tumblelog/ schinckel/django-biometrics/ discovery/django-bitly/ bkroeze/django-bursar/src http://hg.mornie.org/django/c5filemanager/ https://code.launchpad.net/django-cachepurge http://code.google.com/p/django-campaign/ http://code.google.com/p/django-cas/ http://code.google.com/p/django-chat http://code.google.com/p/django-compress/ https://launchpad.net/django-configglue dantario/djelfinder/ ubernostrum/django-contact-form/ http://bitbucket.org/smileychris/django-countries/ http://code.google.com/p/django-courier http://django-cube.googlecode.com/hg http://launchpad.net/django-debian http://pypi.python.org/pypi/django-debug-toolbar-extra http://code.playfire.com/django-debug-toolbar-user-panel http://svn.os4d.org/svn/djangodevtools/trunk http://code.google.com/p/django-dynamic-formset http://code.google.com/p/django-evolution/ http://pypi.python.org/pypi/django-form-admin muhuk/django-formfieldset/ http://code.google.com/p/django-forum/ http://code.google.com/p/django-generic-confirmation http://pypi.python.org/pypi/django-genericforeignkey https://launchpad.net/django-genshi http://code.google.com/p/django-gmapi/ http://code.google.com/p/django-ids http://pypi.python.org/pypi/django-inlinetrans http://www.github.com/rosarior/django-inventory codekoala/django-ittybitty/overview http://bitbucket.org/mrpau/django-jobsboard http://code.google.com/p/django-jqchat http://code.google.com/p/djangokit/ http://code.google.com/p/django-ldap-groups/ carljm/django-localeurl/ http://code.google.com/p/django-messages/ robcharlwood/django-mothertongue/ fivethreeo/django-mptt-comments/ http://code.google.com/p/django-multilingual http://code.google.com/p/django-navbar/ http://code.larlet.fr/django-oauth-plus/wiki/Home http://django-observer.googlecode.com/svn/trunk/ aaronmader/django-parse_rss/tree/master/parse_rss http://bitbucket.org/fhahn/django-permission-backend-nonrel https://code.google.com/p/django-pgsql-interval-field http://code.google.com/p/django-profile/ lukaszb/django-projector/ http://pypi.python.org/pypi/django-proxy-users https://bitbucket.org/dias.kev/django-quotidian nabucosound/django-rbac/ http://djangorestmodel.sourceforge.net/index.html kmike/django-robokassa/ http://code.google.com/p/django-selectreverse/ http://code.google.com/p/django-simple-newsletter/ http://code.google.com/p/django-simplepages/ http://code.google.com/p/django-simple-wiki http://pypi.python.org/pypi/django-smart-extends vgavro/django-smsgate/ schinckel/django-sms-gateway/ http://pypi.python.org/pypi/django-staticmedia http://opensource.washingtontimes.com/projects/django-supertagging/ http://code.google.com/p/django-tagging-autocomplete https://source.codetrax.org/hgroot/django-taggit-autocomplete-modified feuervogel/django-taggit-templatetags/ http://code.google.com/p/django-tasks/ http://code.google.com/p/djangotechblog/ https://launchpad.net/django-testscenarios/ http://django-thumbs.googlecode.com/svn/trunk/ http://code.google.com/p/django-trackback/ http://code.google.com/p/django-transmeta http://sourceforge.net/projects/django-ui daks/django-userthemes/ https://django-valuate.googlecode.com/hg kmike/django-vkontakte-iframe/ http://code.google.com/p/django-voice http://code.google.com/p/django-wikiapp cleemesser/django-wsgiserver/ http://code.google.com/p/djapian/ http://code.google.com/p/djfacet http://code.google.com/p/dojango-datable http://evennia.googlecode.com/svn/trunk http://feedjack.googlecode.com/hg http://code.google.com/p/fullhistory http://code.google.com/p/goflow https://launchpad.net/django-jsonfield https://launchpad.net/linaro-django-xmlrpc/ http://linkexchange.org.ua/browser http://code.google.com/p/mango-py http://dev.merengueproject.org/ http://code.google.com/p/django-inoutboard/ http://svn.osqa.net/svnroot/osqa/trunk http://peach3.nl/trac/ jespern/django-piston/ http://code.google.com/p/django-provinceitaliane/ http://bitbucket.org/kmike/pymorphy schinckel/django-rest-api/ chris1610/satchmo/ spookylukey/semanticeditor/ http://code.google.com/p/sorethumb/ andrewgodwin/south/ http://source.sphene.net/svn/root/django/communitytools/trunk http://source.sphene.net/svn/root/django/communitytools sebpiq/spiteat/ schinckel/django-timedelta-field/ http://projects.unbit.it/hg/uwsgi http://www.dataportal.it""" for sample in samples.split("\n"): self.assertTrue(isinstance(get_repo_for_repo_url(sample), UnsupportedHandler))
def test_get_repo_for_repo_url(self): samples = """u'http://repos.entrouvert.org/authentic.git/tree http://code.basieproject.org/ http://znc-sistemas.github.com/django-municipios http://django-brutebuster.googlecode.com/svn/trunk/BruteBuster/ http://hg.piranha.org.ua/byteflow/ http://code.google.com/p/classcomm http://savannah.nongnu.org/projects/dina-project/ tyrion/django-acl/ izi/django-admin-tools/ bkonkle/django-ajaxcomments/ http://django-ajax-selects.googlecode.com/svn/trunk/ http://django-antivirus.googlecode.com/svn/trunk/ codekoala/django-articles/ https://launchpad.net/django-audit https://django-audit.googlecode.com/hg/ tyrion/django-autocomplete/ http://code.google.com/p/django-autocomplete/ http://pypi.python.org/pypi/django-autoreports http://code.google.com/p/django-basic-tumblelog/ schinckel/django-biometrics/ discovery/django-bitly/ bkroeze/django-bursar/src http://hg.mornie.org/django/c5filemanager/ https://code.launchpad.net/django-cachepurge http://code.google.com/p/django-campaign/ http://code.google.com/p/django-cas/ http://code.google.com/p/django-chat http://code.google.com/p/django-compress/ https://launchpad.net/django-configglue dantario/djelfinder/ ubernostrum/django-contact-form/ http://bitbucket.org/smileychris/django-countries/ http://code.google.com/p/django-courier http://django-cube.googlecode.com/hg http://launchpad.net/django-debian http://pypi.python.org/pypi/django-debug-toolbar-extra http://code.playfire.com/django-debug-toolbar-user-panel http://svn.os4d.org/svn/djangodevtools/trunk http://code.google.com/p/django-dynamic-formset http://code.google.com/p/django-evolution/ http://pypi.python.org/pypi/django-form-admin muhuk/django-formfieldset/ http://code.google.com/p/django-forum/ http://code.google.com/p/django-generic-confirmation http://pypi.python.org/pypi/django-genericforeignkey https://launchpad.net/django-genshi http://code.google.com/p/django-gmapi/ http://code.google.com/p/django-ids http://pypi.python.org/pypi/django-inlinetrans http://www.github.com/rosarior/django-inventory codekoala/django-ittybitty/overview http://bitbucket.org/mrpau/django-jobsboard http://code.google.com/p/django-jqchat http://code.google.com/p/djangokit/ http://code.google.com/p/django-ldap-groups/ carljm/django-localeurl/ http://code.google.com/p/django-messages/ robcharlwood/django-mothertongue/ fivethreeo/django-mptt-comments/ http://code.google.com/p/django-multilingual http://code.google.com/p/django-navbar/ http://code.larlet.fr/django-oauth-plus/wiki/Home http://django-observer.googlecode.com/svn/trunk/ aaronmader/django-parse_rss/tree/master/parse_rss http://bitbucket.org/fhahn/django-permission-backend-nonrel https://code.google.com/p/django-pgsql-interval-field http://code.google.com/p/django-profile/ lukaszb/django-projector/ http://pypi.python.org/pypi/django-proxy-users https://bitbucket.org/dias.kev/django-quotidian nabucosound/django-rbac/ http://djangorestmodel.sourceforge.net/index.html kmike/django-robokassa/ http://code.google.com/p/django-selectreverse/ http://code.google.com/p/django-simple-newsletter/ http://code.google.com/p/django-simplepages/ http://code.google.com/p/django-simple-wiki http://pypi.python.org/pypi/django-smart-extends vgavro/django-smsgate/ schinckel/django-sms-gateway/ http://pypi.python.org/pypi/django-staticmedia http://opensource.washingtontimes.com/projects/django-supertagging/ http://code.google.com/p/django-tagging-autocomplete https://source.codetrax.org/hgroot/django-taggit-autocomplete-modified feuervogel/django-taggit-templatetags/ http://code.google.com/p/django-tasks/ http://code.google.com/p/djangotechblog/ https://launchpad.net/django-testscenarios/ http://django-thumbs.googlecode.com/svn/trunk/ http://code.google.com/p/django-trackback/ http://code.google.com/p/django-transmeta http://sourceforge.net/projects/django-ui daks/django-userthemes/ https://django-valuate.googlecode.com/hg kmike/django-vkontakte-iframe/ http://code.google.com/p/django-voice http://code.google.com/p/django-wikiapp cleemesser/django-wsgiserver/ http://code.google.com/p/djapian/ http://code.google.com/p/djfacet http://code.google.com/p/dojango-datable http://evennia.googlecode.com/svn/trunk http://feedjack.googlecode.com/hg http://code.google.com/p/fullhistory http://code.google.com/p/goflow https://launchpad.net/django-jsonfield https://launchpad.net/linaro-django-xmlrpc/ http://linkexchange.org.ua/browser http://code.google.com/p/mango-py http://dev.merengueproject.org/ http://code.google.com/p/django-inoutboard/ http://svn.osqa.net/svnroot/osqa/trunk http://peach3.nl/trac/ jespern/django-piston/ http://code.google.com/p/django-provinceitaliane/ http://bitbucket.org/kmike/pymorphy schinckel/django-rest-api/ chris1610/satchmo/ spookylukey/semanticeditor/ http://code.google.com/p/sorethumb/ andrewgodwin/south/ http://source.sphene.net/svn/root/django/communitytools/trunk http://source.sphene.net/svn/root/django/communitytools sebpiq/spiteat/ schinckel/django-timedelta-field/ http://projects.unbit.it/hg/uwsgi http://www.dataportal.it""" for sample in samples.split("\n"): self.assertTrue( isinstance(get_repo_for_repo_url(sample), UnsupportedHandler))