diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-22 09:23:42 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-22 09:23:42 -0400 |
| commit | f6b5e29275f9a54bda847de79760f24a613a3d28 (patch) | |
| tree | 6669f1ad56d804b1018e2412480ff255d991fc20 /setuptools/command/alias.py | |
| parent | 97fbee720d6dd5bda37dc2a945d60ec056d49d9e (diff) | |
| parent | 8e3f9d3253d1d0fb820dad4249d5110d017595c1 (diff) | |
| download | python-setuptools-git-f6b5e29275f9a54bda847de79760f24a613a3d28.tar.gz | |
Merge Pull Request 67 from bb://agronholm/bitbucket
Diffstat (limited to 'setuptools/command/alias.py')
| -rwxr-xr-x | setuptools/command/alias.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/setuptools/command/alias.py b/setuptools/command/alias.py index 05c0766b..452a9244 100755 --- a/setuptools/command/alias.py +++ b/setuptools/command/alias.py @@ -2,10 +2,12 @@ from distutils.errors import DistutilsOptionError from setuptools.command.setopt import edit_config, option_base, config_file + def shquote(arg): """Quote an argument for later parsing by shlex.split()""" for c in '"', "'", "\\", "#": - if c in arg: return repr(arg) + if c in arg: + return repr(arg) if arg.split() != [arg]: return repr(arg) return arg @@ -18,7 +20,7 @@ class alias(option_base): command_consumes_arguments = True user_options = [ - ('remove', 'r', 'remove (unset) the alias'), + ('remove', 'r', 'remove (unset) the alias'), ] + option_base.user_options boolean_options = option_base.boolean_options + ['remove'] @@ -46,7 +48,7 @@ class alias(option_base): print("setup.py alias", format_alias(alias, aliases)) return - elif len(self.args)==1: + elif len(self.args) == 1: alias, = self.args if self.remove: command = None @@ -58,9 +60,9 @@ class alias(option_base): return else: alias = self.args[0] - command = ' '.join(map(shquote,self.args[1:])) + command = ' '.join(map(shquote, self.args[1:])) - edit_config(self.filename, {'aliases': {alias:command}}, self.dry_run) + edit_config(self.filename, {'aliases': {alias: command}}, self.dry_run) def format_alias(name, aliases): @@ -73,4 +75,4 @@ def format_alias(name, aliases): source = '' else: source = '--filename=%r' % source - return source+name+' '+command + return source + name + ' ' + command |
