Simplify prepare_command function and add deprecation warning

This commit is contained in:
Joe Rickerby
2018-04-08 18:25:18 +01:00
parent 4655311a7a
commit b74333a940
5 changed files with 18 additions and 10 deletions
+8 -3
View File
@@ -1,16 +1,21 @@
from fnmatch import fnmatch
import warnings
def prepare_command(command, python, pip, project):
def prepare_command(command, project):
'''
Preprocesses a command by expanding variables like {python} or {pip}.
Preprocesses a command by expanding variables like {project}.
For example, used for the before_build option, where the user would
like to run a command like `python setup.py test`. If the command should run on
Python 3, the user could write `{python} setup.py test`. This command would expand
it out to python2 or python3 as appropriate.
'''
return command.format(python=python, pip=pip, project=project)
if '{python}' in command or '{pip}' in command:
warnings.warn("'{python}' and '{pip}' are no longer needed, and have been deprecated. Simply use 'python' or 'pip' instead.",
DeprecationWarning)
return command.format(python='python', pip='pip', project=project)
class BuildSkipper(object):