setup_venv: Added get_venv_dependencies function.

Added a get_venv_dependencies() function in setup_venv.py which
returns VENV_DEPENDENCIES according to the vendor and os_version.
The reason for adding this function was because python-dev will be
depreciated in Focal but can be used as python2-dev so when adding
support for Focal VENV_DEPENDENCIES should to be os_version dependent.
This commit is contained in:
arpit551
2020-03-18 00:57:35 +05:30
committed by Tim Abbott
parent 3963b6740a
commit b0cb493850
3 changed files with 18 additions and 3 deletions

View File

@@ -23,7 +23,6 @@ VENV_DEPENDENCIES = [
"libldap2-dev",
"libmemcached-dev",
"python3-dev", # Needed to install typed-ast dependency of mypy
"python-dev",
"python3-pip",
"python-pip",
"virtualenv",
@@ -45,6 +44,10 @@ VENV_DEPENDENCIES = [
"jq", # Used by scripts/lib/install-node to check yarn version
]
# python-dev is depreciated in Focal but can be used as python2-dev.
# So it is removed from VENV_DEPENDENCIES and added here.
PYTHON_DEV_DEPENDENCY = "python{}-dev"
COMMON_YUM_VENV_DEPENDENCIES = [
"libffi-devel",
"freetype-devel",
@@ -99,6 +102,13 @@ YUM_THUMBOR_VENV_DEPENDENCIES = [
"gifsicle",
]
def get_venv_dependencies(vendor, os_version):
# type: (str, str) -> List[str]
if vendor == 'ubuntu' and os_version == '20.04':
return VENV_DEPENDENCIES + [PYTHON_DEV_DEPENDENCY.format("2"), ]
else:
return VENV_DEPENDENCIES + [PYTHON_DEV_DEPENDENCY.format(""), ]
def install_venv_deps(pip, requirements_file, python2):
# type: (str, str, bool) -> None
pip_requirements = os.path.join(ZULIP_PATH, "requirements", "pip2.txt" if python2 else "pip.txt")