aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/scripts/supercommand.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-09-09 10:41:19 +0200
committerGuido Günther <agx@sigxcpu.org>2016-09-12 08:52:07 +0200
commitd1c163401153329363a010373cb512f8e59ef1e2 (patch)
tree4360253804301e13b626a47d3ee9b7740dc9fbec /gbp/scripts/supercommand.py
parentf7db3b77c491e5f76f441a1155aa87b1e5dedde6 (diff)
pep8/pyflakes cleanups
Diffstat (limited to 'gbp/scripts/supercommand.py')
-rw-r--r--gbp/scripts/supercommand.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/gbp/scripts/supercommand.py b/gbp/scripts/supercommand.py
index 2d0a9f47..e9e03ab2 100644
--- a/gbp/scripts/supercommand.py
+++ b/gbp/scripts/supercommand.py
@@ -26,7 +26,8 @@ import sys
# Command is this module and common/ is shared code
# so we don't allow these to be imported:
-invalid_modules = [ 'common', 'supercommand' ]
+invalid_modules = ['common', 'supercommand']
+
def sanitize(cmd):
"""
@@ -35,6 +36,7 @@ def sanitize(cmd):
"""
return cmd.replace('-', '_')
+
def usage():
print("""
Usage:
@@ -50,6 +52,7 @@ The most commonly used commands are:
Use '--list-cmds' to list all available commands.
""")
+
def version(prog):
try:
from gbp.version import gbp_version
@@ -64,7 +67,7 @@ def import_command(cmd):
"""
modulename = sanitize(cmd)
if (not re.match(r'[a-z][a-z0-9_]', modulename) or
- modulename in invalid_modules):
+ modulename in invalid_modules):
raise ImportError('Illegal module name %s' % modulename)
return __import__('gbp.scripts.%s' % modulename, fromlist='main', level=0)
@@ -75,7 +78,7 @@ def pymod_to_cmd(mod):
>>> pymod_to_cmd('/x/y/z/a_cmd.py')
'a-cmd'
"""
- return os.path.basename(mod.rsplit('.', 1)[0]).replace('_','-')
+ return os.path.basename(mod.rsplit('.', 1)[0]).replace('_', '-')
def get_available_commands(path):
@@ -125,10 +128,10 @@ def supercommand(argv=None):
elif cmd == 'help':
usage()
return 0
- elif cmd in [ '--version', 'version' ]:
+ elif cmd in ['--version', 'version']:
version(argv[0])
return 0
- elif cmd in [ '--list-cmds', 'list-cmds' ]:
+ elif cmd in ['--list-cmds', 'list-cmds']:
list_available_commands()
return 0