From 43aac49861011ac046ebe2d28c28a9f7667ec36e Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 29 Aug 2013 15:19:04 -0600 Subject: [PATCH] createmodule.py: Add --noprefix option --- createmodule.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/createmodule.py b/createmodule.py index 2588333..cee37ef 100755 --- a/createmodule.py +++ b/createmodule.py @@ -26,7 +26,8 @@ from subprocess import * usage = "Usage: %prog [-p prefix] [args]" parser = OptionParser() parser.set_usage(usage) -parser.add_option('-p', '--prefix', dest='prefix', help='Specify path prefix') +parser.add_option('-p', '--prefix', action='store', type='string', dest='prefix', help='Specify path prefix') +parser.add_option('--noprefix', action='store_true', dest='noprefix', default=False, help='Do not generate a prefix') (options, args) = parser.parse_args() # Need a script name @@ -139,10 +140,10 @@ for key in env2.keys(): pathnames.append(setenv[key]) # Determine a prefix -prefix = None +prefix=None if options.prefix: prefix = options.prefix -else: +elif not options.noprefix: prefix = os.path.commonprefix(pathnames).rstrip('/') if prefix == '': prefix = None