tox: make install_sibling_packages pip import optional
This enable using the tox role without pip module installed on the host Change-Id: Ic2c9e75ed967faf93267b6b9c58fdf3b02837ea9
This commit is contained in:
parent
ea5c3d08da
commit
62015d9e15
@ -52,8 +52,12 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import ConfigParser as configparser
|
import ConfigParser as configparser
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pip
|
||||||
|
except ImportError:
|
||||||
|
pip = None
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pip
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
@ -80,6 +84,8 @@ def get_sibling_python_packages(projects):
|
|||||||
|
|
||||||
|
|
||||||
def get_installed_packages(tox_python):
|
def get_installed_packages(tox_python):
|
||||||
|
if pip is None:
|
||||||
|
raise RuntimeError("pip python module is required")
|
||||||
with tempfile.NamedTemporaryFile(delete=False) as tmp_requirements:
|
with tempfile.NamedTemporaryFile(delete=False) as tmp_requirements:
|
||||||
tmp_requirements.write(subprocess.check_output(
|
tmp_requirements.write(subprocess.check_output(
|
||||||
[tox_python, '-m', 'pip', 'freeze']))
|
[tox_python, '-m', 'pip', 'freeze']))
|
||||||
|
Loading…
Reference in New Issue
Block a user