Commit 97ec4064 by Sébastien Eustace

Fix python restricted dependencies not being checked against virtualenv

parent 0ac244fa
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
### Fixed ### Fixed
- Fixed handking of post releases. - Fixed handling of post releases.
- Fixed python restricted dependencies not being checked agaisnt virtualenv version.
## [0.4.2] - 2018-03-10 ## [0.4.2] - 2018-03-10
......
...@@ -379,7 +379,7 @@ class Installer: ...@@ -379,7 +379,7 @@ class Installer:
continue continue
parser = VersionParser() parser = VersionParser()
python = '.'.join([str(i) for i in sys.version_info[:3]]) python = '.'.join([str(i) for i in self._io.venv.version_info[:3]])
if 'python' in package.requirements: if 'python' in package.requirements:
python_constraint = parser.parse_constraints( python_constraint = parser.parse_constraints(
package.requirements['python'] package.requirements['python']
......
...@@ -24,6 +24,7 @@ class Venv: ...@@ -24,6 +24,7 @@ class Venv:
def __init__(self, venv=None): def __init__(self, venv=None):
self._venv = venv self._venv = venv
self._version_info = None
@classmethod @classmethod
def create(cls) -> 'Venv': def create(cls) -> 'Venv':
...@@ -89,6 +90,21 @@ class Venv: ...@@ -89,6 +90,21 @@ class Venv:
""" """
return self._bin('pip') return self._bin('pip')
@property
def version_info(self):
if self._version_info is not None:
return self._version_info
if not self.is_venv():
self._version_info = sys.version_info
else:
output = self.run('python', '--version')
version = output.split(' ')
self._version_info = version[1].strip().split('.')
return self._version_info
def run(self, bin: str, *args, **kwargs) -> str: def run(self, bin: str, *args, **kwargs) -> str:
""" """
Run a command inside the virtual env. Run a command inside the virtual env.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment