From 35ffb38f765e1ca8f1392a81b2a94ea5e7515085 Mon Sep 17 00:00:00 2001 From: allfro Date: Wed, 13 Feb 2013 20:04:00 -0500 Subject: [PATCH] Added fix to avoid putting in .py extension in __init__.py as part of erroneous call to create-transform. --- src/canari/commands/create_transform.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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)) -- 2.45.1