# HG changeset patch # User Jeff Hammel # Date 1293057260 28800 # Node ID 1549be7f0fcbfaff60778fe6198add8671007812 # Parent 7e8a5da34eeee05aa95ef6d1bb1f6fbcfa63f617 dont point at trunk tempital; as expected, hg repos dont work with setuptools :( diff -r 7e8a5da34eee -r 1549be7f0fcb makeitso/makeitso.py --- 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', diff -r 7e8a5da34eee -r 1549be7f0fcb setup.py --- a/setup.py Wed Dec 22 14:03:53 2010 -0800 +++ b/setup.py Wed Dec 22 14:34:20 2010 -0800 @@ -21,9 +21,6 @@ # -*- Extra requirements: -*- 'tempita' ], - dependency_links=[ - 'http://bitbucket.org/ianb/tempita#egg=tempita' - ], entry_points=""" # -*- Entry points: -*- [console_scripts]