handle python major and minor version correctly in create_pipfile

fix #4379
previous code cannot handle 3.XX
This commit is contained in:
Yoshihisa Mochihara
2020-08-13 17:15:46 +02:00
committed by frostming
parent 0394f4de8b
commit 6fcecbcc1b
+2 -2
View File
@@ -756,8 +756,8 @@ class Project(object):
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")]}
if version and len(version.split(".")) > 2:
data[u"requires"] = {"python_version": ".".join(version.split(".")[:2])}
self.write_toml(data)
@classmethod