[environment-modules] createmodule.py: Add --noprefix option
Orion Poplawski
orion at fedoraproject.org
Wed Sep 4 15:42:01 UTC 2013
commit 43aac49861011ac046ebe2d28c28a9f7667ec36e
Author: Orion Poplawski <orion at nwra.com>
Date: Thu Aug 29 15:19:04 2013 -0600
createmodule.py: Add --noprefix option
createmodule.py | 7 ++++---
1 files 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] <initscript> [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
More information about the scm-commits
mailing list