Mercurial > hg > silvermirror
changeset 17:f8edfc9c28ba
a really hacky way to disable...for temporary sanity and long term backing down from insanity
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 18 Jun 2013 15:58:35 -0700 |
parents | 76eac0c9953a |
children | 2c2998eabfb5 |
files | setup.py silvermirror/hg.py |
diffstat | 2 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py Fri May 24 14:26:57 2013 -0700 +++ b/setup.py Tue Jun 18 15:58:35 2013 -0700 @@ -20,7 +20,6 @@ 'martINI', 'netifaces', 'pexpect', - 'lxml', ], entry_points=""" # -*- Entry points: -*-
--- a/silvermirror/hg.py Fri May 24 14:26:57 2013 -0700 +++ b/silvermirror/hg.py Tue Jun 18 15:58:35 2013 -0700 @@ -1,13 +1,20 @@ #!/usr/bin/env python + """ stub for the hg backend of silvermirror """ -import lxml.html -import mercurial +try: + import lxml.html + import mercurial + from mercurial import commands, hg, ui + requirements_fulfilled = True +except ImportError as e: + _import_error = e + requirements_fulfilled = False + import os import sys -from mercurial import commands, hg, ui from optparse import OptionParser def update(host, path): @@ -16,7 +23,7 @@ """ _ui = ui.ui() url = '%s/%s' % (host, path) - try: + try: repo = hg.repository(_ui, path) print 'Updating %s:' % path except Exception, e: @@ -35,7 +42,7 @@ # ui = ui.ui() # files = [ os.path.join(path, f) for f in os.listdir(path) ] # directories = [ f for f in files if os.path.isdir(f) ] - + # repos = [] # for d in directories: # try: @@ -47,7 +54,7 @@ def repositories(url): """ - returns the list of reposotories under a URL of an hg server + returns the list of repositories under a URL of an hg server """ element = lxml.html.parse(url) tds = element.xpath('//tr[position() > 1]/td[1]') @@ -63,6 +70,9 @@ parser.add_option('--list', dest='list', action='store_true', default=False) options, args = parser.parse_args(args) + if not requirements_fulfilled: + # Hack; this should all be better o_O + parser.error("Must have mercurial and lxml packages to use, sorry") if not options.host: parser.print_usage() parser.exit() @@ -82,7 +92,6 @@ os.chdir(options.directory) for repo in repos: update(options.host, repo) - if __name__ == '__main__': main()