Fix _pyversion if include dir contains other files

This commit is contained in:
Daniel Simon
2018-10-18 18:30:52 +02:00
parent 87551b9d45
commit 7690671ea1
+2 -2
View File
@@ -926,8 +926,8 @@ class Project(object):
@property
def _pyversion(self):
include_dir = vistir.compat.Path(self.virtualenv_location) / "include"
python_path = next(iter(list(include_dir.iterdir())), None)
if python_path and python_path.name.startswith("python"):
python_path = next((x for x in include_dir.iterdir() if x.name.startswith("python")), None)
if python_path:
python_version = python_path.name.replace("python", "")
py_version_short, abiflags = python_version[:3], python_version[3:]
return {"py_version_short": py_version_short, "abiflags": abiflags}