diff --git a/main.py b/main.py index b309fad..1393b40 100755 --- a/main.py +++ b/main.py @@ -204,7 +204,7 @@ class _Repo(object): SetDefaultColoring(gopts.color) try: - cmd = self.commands[name] + cmd = self.commands[name]() except KeyError: print("repo: '%s' is not a repo command. See 'repo help'." % name, file=sys.stderr) diff --git a/subcmds/__init__.py b/subcmds/__init__.py index a49e7bd..c3de9d1 100644 --- a/subcmds/__init__.py +++ b/subcmds/__init__.py @@ -16,6 +16,7 @@ import os +# A mapping of the subcommand name to the class that implements it. all_commands = {} my_dir = os.path.dirname(__file__) @@ -37,7 +38,7 @@ for py in os.listdir(my_dir): ['%s' % name]) mod = getattr(mod, name) try: - cmd = getattr(mod, clsn)() + cmd = getattr(mod, clsn) except AttributeError: raise SyntaxError('%s/%s does not define class %s' % ( __name__, py, clsn)) diff --git a/subcmds/help.py b/subcmds/help.py index 5e24ed0..1e16019 100644 --- a/subcmds/help.py +++ b/subcmds/help.py @@ -43,7 +43,7 @@ Displays detailed usage information about a command. fmt = ' %%-%ds %%s' % maxlen for name in commandNames: - command = all_commands[name] + command = all_commands[name]() try: summary = command.helpSummary.strip() except AttributeError: @@ -134,7 +134,7 @@ Displays detailed usage information about a command. def _PrintAllCommandHelp(self): for name in sorted(all_commands): - cmd = all_commands[name] + cmd = all_commands[name]() cmd.manifest = self.manifest self._PrintCommandHelp(cmd, header_prefix='[%s] ' % (name,)) @@ -159,7 +159,7 @@ Displays detailed usage information about a command. name = args[0] try: - cmd = all_commands[name] + cmd = all_commands[name]() except KeyError: print("repo: '%s' is not a repo command." % name, file=sys.stderr) sys.exit(1) diff --git a/subcmds/version.py b/subcmds/version.py index 91dbe68..8721bf4 100644 --- a/subcmds/version.py +++ b/subcmds/version.py @@ -44,9 +44,9 @@ class Version(Command, MirrorSafeCommand): print('repo version %s' % rp_ver) print(' (from %s)' % rem.url) - if Version.wrapper_path is not None: - print('repo launcher version %s' % Version.wrapper_version) - print(' (from %s)' % Version.wrapper_path) + if self.wrapper_path is not None: + print('repo launcher version %s' % self.wrapper_version) + print(' (from %s)' % self.wrapper_path) if src_ver != rp_ver: print(' (currently at %s)' % src_ver)