createmodule.py: Add --noprefix option

This commit is contained in:
Orion Poplawski 2013-08-29 15:19:04 -06:00
parent 8ab02627e6
commit 43aac49861

View File

@ -26,7 +26,8 @@ from subprocess import *
usage = "Usage: %prog [-p prefix] <initscript> [args]" usage = "Usage: %prog [-p prefix] <initscript> [args]"
parser = OptionParser() parser = OptionParser()
parser.set_usage(usage) 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() (options, args) = parser.parse_args()
# Need a script name # Need a script name
@ -139,10 +140,10 @@ for key in env2.keys():
pathnames.append(setenv[key]) pathnames.append(setenv[key])
# Determine a prefix # Determine a prefix
prefix = None prefix=None
if options.prefix: if options.prefix:
prefix = options.prefix prefix = options.prefix
else: elif not options.noprefix:
prefix = os.path.commonprefix(pathnames).rstrip('/') prefix = os.path.commonprefix(pathnames).rstrip('/')
if prefix == '': if prefix == '':
prefix = None prefix = None