Merge branch 'master' into licenses

This commit is contained in:
Dan Ryan
2018-04-12 22:55:18 -04:00
committed by GitHub
4 changed files with 30 additions and 7 deletions
+1
View File
@@ -8,6 +8,7 @@ env:
global:
- PYPI_VENDOR_DIR='./tests/pypi/'
- GIT_ASK_YESNO='false'
- PYTHONIOENCODING='utf-8'
matrix:
- TEST_SUITE='not install'
- TEST_SUITE='install'
+12 -6
View File
@@ -44,6 +44,7 @@ from .environments import (
PIPENV_VIRTUALENV,
PIPENV_TEST_INDEX,
PIPENV_PYTHON,
PIPENV_DEFAULT_PYTHON_VERSION,
)
@@ -578,12 +579,17 @@ class Project(object):
u'dev-packages': {},
}
# Default requires.
required_python = python or self.which(
'python', self.virtualenv_location
)
data[u'requires'] = {
'python_version': python_version(required_python)[: len('2.7')]
}
required_python = python
if not python:
if self.virtualenv_location:
required_python = self.which('python', self.virtualenv_location)
else:
required_python = self.which('python')
version = python_version(required_python) or PIPENV_DEFAULT_PYTHON_VERSION
if version and len(version) >= 3:
data[u'requires'] = {
'python_version': version[: len('2.7')]
}
self.write_toml(data, 'Pipfile')
def write_toml(self, data, path=None):
+6 -1
View File
@@ -220,8 +220,13 @@ def python_version(path_to_python):
c = delegator.run([path_to_python, '--version'], block=False)
except Exception:
return None
c.block()
version = parse_python_version(c.out.strip() or c.err.strip())
return u'{major}.{minor}.{micro}'.format(**version)
try:
version = u'{major}.{minor}.{micro}'.format(**version)
except TypeError:
return None
return version
def escape_grouped_arguments(s):
+11
View File
@@ -0,0 +1,11 @@
import os
import subprocess
import sys
def test_help():
output = subprocess.check_output(
[sys.executable, '-m', 'pipenv.help'],
stderr=subprocess.STDOUT, env=os.environ.copy(),
)
assert output