From: allfro Date: Thu, 14 Feb 2013 01:04:00 +0000 (-0500) Subject: Added fix to avoid putting in .py extension in __init__.py as part of erroneous call... X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=35ffb38f765e1ca8f1392a81b2a94ea5e7515085;p=get-hack-src.git Added fix to avoid putting in .py extension in __init__.py as part of erroneous call to create-transform. --- diff --git a/src/canari/commands/create_transform.py b/src/canari/commands/create_transform.py index 9e2c39e..95e28d1 100644 --- a/src/canari/commands/create_transform.py +++ b/src/canari/commands/create_transform.py @@ -58,9 +58,17 @@ def run(args): opts = parse_args(args) initf = path.join(opts.transform_dir, '__init__.py') - transform = opts.transform + transform = opts.transform if not opts.transform.endswith('.py') else opts.transform[:-3] + + if '.' in transform: + print "Transform name (%s) cannot have a dot ('.')." % repr(transform) + exit(-1) + elif not transform: + print "You must specify a valid transform name." + exit(-1) + directory = opts.transform_dir - transformf = path.join(directory, transform if transform.endswith('.py') else '%s.py' % transform ) + transformf = path.join(directory, opts.transform if opts.transform.endswith('.py') else '%s.py' % opts.transform ) if not path.exists(initf): print ('Directory %s does not appear to be a python package directory... quitting!' % repr(opts.transform_dir))