Mercurial > hg > MakeItSo
diff makeitso/makeitso.py @ 30:1549be7f0fcb
dont point at trunk tempital; as expected, hg repos dont work with setuptools :(
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 22 Dec 2010 14:34:20 -0800 |
parents | dc18d6db4956 |
children | 17f46f0e0a4a |
line wrap: on
line diff
--- a/makeitso/makeitso.py Wed Dec 22 14:03:53 2010 -0800 +++ b/makeitso/makeitso.py Wed Dec 22 14:34:20 2010 -0800 @@ -3,6 +3,7 @@ filesystem template interpreter """ +import inspect import os import re import shutil @@ -60,25 +61,13 @@ cleanup() raise NotImplementedError('This should say something like youre not connected to the net') - +# does tempita support delimeters? +has_delimeters = 'delimeters' in inspect.getargspec(tempita.Template.__init__).args # regular expressions for finding the shebang shebang_re = '#!.*makeitso.*' shebang_re = re.compile(shebang_re) -class MissingVariablesException(Exception): - def __init__(self, message, missing): - self.missing = missing - -def call(command, *args, **kw): - code = subprocess.call(command, *args, **kw) - if code: - if isinstance(command, basestring): - cmdstr = command - else: - cmdstr = ' '.join(command) - raise SystemExit("Command `%s` exited with code %d" % (cmdstr, code)) - def base_uri(uri): if '://' in uri: return 'uri'.rsplit('/', 1)[0] + '/' @@ -91,10 +80,15 @@ f, headers = urllib.urlretrieve(uri) return file(f).read() -### functions for variables +### things that deal with variables defaults = {'include': include} +class MissingVariablesException(Exception): + """exception for (non-interactive) missing variables""" + def __init__(self, message, missing): + self.missing = missing + def get_missing(name_error): """ This is a horrible hack because python doesn't do the proper thing @@ -169,10 +163,11 @@ # delimeters # XXX needs tempita trunk - parser.add_option('-[', '--start-braces', dest='start_braces', - help='starting delimeter') - parser.add_option('-]', '--end-braces', dest='end_braces', - help='starting delimeter') + if has_delimeters: + parser.add_option('-[', '--start-braces', dest='start_braces', + help='starting delimeter') + parser.add_option('-]', '--end-braces', dest='end_braces', + help='starting delimeter') # options about where to put things parser.add_option('--in-place', dest='in_place',