Merge pull request #1433 from pypa/scripts

scripts
This commit is contained in:
2018-02-17 06:54:04 -06:00
committed by GitHub
4 changed files with 25 additions and 2 deletions
+2
View File
@@ -1,6 +1,8 @@
9.0.4:
- Add --system flag to $ pipenv check.
- Removal of package name suggestions.
- Support for [scripts] in Pipfile.
- Updated patched version of dotenv.
9.0.3:
- v9.0.1.
9.0.2:
+5
View File
@@ -12,3 +12,8 @@ pytest-xdist = "*"
[packages]
"e1839a8" = {path = ".", editable = true}
[scripts]
tests = "pytest tests"
+8 -2
View File
@@ -5,6 +5,7 @@ import codecs
import os
import sys
import shutil
import shlex
import signal
import time
import tempfile
@@ -1974,6 +1975,10 @@ def do_run(command, args, three=None, python=False):
load_dot_env()
# Script was found…
if command in project.scripts:
command = ' '.join(project.scripts[command])
# Separate out things that were passed in as a string.
_c = list(command.split())
command = _c.pop(0)
@@ -1995,11 +2000,12 @@ def do_run(command, args, three=None, python=False):
command_path = system_which(command)
if not command_path:
click.echo(
'{0}: the command {1} could not be found within {2}.'
'{0}: the command {1} could not be found within {2} or Pipfile\'s {3}.'
''.format(
crayons.red('Error', bold=True),
crayons.red(command),
crayons.normal('PATH', bold=True)
crayons.normal('PATH', bold=True),
crayons.normal('[scripts]', bold=True)
), err=True
)
sys.exit(1)
+10
View File
@@ -3,6 +3,7 @@ import json
import os
import re
import sys
import shlex
import base64
import hashlib
@@ -292,6 +293,15 @@ class Project(object):
"""A dictionary of the settings added to the Pipfile."""
return self.parsed_pipfile.get('pipenv', {})
@property
def scripts(self):
scripts = self.parsed_pipfile.get('scripts', {})
for (k, v) in scripts.items():
scripts[k] = shlex.split(v, posix=True)
return scripts
def update_settings(self, d):
settings = self.settings