mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 05:58:25 +00:00
setup_venv: Used get_venv_dependencies() to return correct VENV dependencies.
Used get_venv_dependencies function to return the correct dependencies for RHEL, Centos, Fedora rather than importing them as separate COMMON_YUM_DEPENDENCIES in provision and create-production-venv.
This commit is contained in:
@@ -10,8 +10,7 @@ if ZULIP_PATH not in sys.path:
|
|||||||
|
|
||||||
from scripts.lib.zulip_tools import os_families, overwrite_symlink, run, parse_os_release
|
from scripts.lib.zulip_tools import os_families, overwrite_symlink, run, parse_os_release
|
||||||
from scripts.lib.setup_venv import (
|
from scripts.lib.setup_venv import (
|
||||||
setup_virtualenv, get_venv_dependencies, REDHAT_VENV_DEPENDENCIES,
|
setup_virtualenv, get_venv_dependencies
|
||||||
FEDORA_VENV_DEPENDENCIES
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
|
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
|
||||||
@@ -26,11 +25,7 @@ VENV_DEPENDENCIES = get_venv_dependencies(vendor, os_version)
|
|||||||
if "debian" in os_families():
|
if "debian" in os_families():
|
||||||
run(["apt-get", "-y", "install"] + VENV_DEPENDENCIES)
|
run(["apt-get", "-y", "install"] + VENV_DEPENDENCIES)
|
||||||
elif "fedora" in os_families():
|
elif "fedora" in os_families():
|
||||||
if "rhel" in os_families():
|
run(["yum", "-y", "install"] + VENV_DEPENDENCIES)
|
||||||
_VENV_DEPS = REDHAT_VENV_DEPENDENCIES
|
|
||||||
else:
|
|
||||||
_VENV_DEPS = FEDORA_VENV_DEPENDENCIES
|
|
||||||
run(["yum", "-y", "install"] + _VENV_DEPS)
|
|
||||||
else:
|
else:
|
||||||
print("Unsupported platform: {}".format(distro_info['ID']))
|
print("Unsupported platform: {}".format(distro_info['ID']))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from scripts.lib.zulip_tools import run, run_as_root, ENDC, WARNING
|
from scripts.lib.zulip_tools import run, run_as_root, ENDC, WARNING, os_families
|
||||||
from scripts.lib.hash_reqs import expand_reqs
|
from scripts.lib.hash_reqs import expand_reqs
|
||||||
|
|
||||||
from typing import List, Optional, Tuple, Set
|
from typing import List, Optional, Tuple, Set
|
||||||
@@ -106,8 +106,14 @@ def get_venv_dependencies(vendor, os_version):
|
|||||||
# type: (str, str) -> List[str]
|
# type: (str, str) -> List[str]
|
||||||
if vendor == 'ubuntu' and os_version == '20.04':
|
if vendor == 'ubuntu' and os_version == '20.04':
|
||||||
return VENV_DEPENDENCIES + [PYTHON_DEV_DEPENDENCY.format("2"), ]
|
return VENV_DEPENDENCIES + [PYTHON_DEV_DEPENDENCY.format("2"), ]
|
||||||
else:
|
elif "debian" in os_families():
|
||||||
return VENV_DEPENDENCIES + [PYTHON_DEV_DEPENDENCY.format(""), ]
|
return VENV_DEPENDENCIES + [PYTHON_DEV_DEPENDENCY.format(""), ]
|
||||||
|
elif "rhel" in os_families():
|
||||||
|
return REDHAT_VENV_DEPENDENCIES
|
||||||
|
elif "fedora" in os_families():
|
||||||
|
return FEDORA_VENV_DEPENDENCIES
|
||||||
|
else:
|
||||||
|
raise AssertionError("Invalid vendor")
|
||||||
|
|
||||||
def install_venv_deps(pip, requirements_file, python2):
|
def install_venv_deps(pip, requirements_file, python2):
|
||||||
# type: (str, str, bool) -> None
|
# type: (str, str, bool) -> None
|
||||||
|
|||||||
@@ -16,9 +16,8 @@ from scripts.lib.zulip_tools import run_as_root, ENDC, WARNING, \
|
|||||||
get_dev_uuid_var_path, FAIL, os_families, parse_os_release, \
|
get_dev_uuid_var_path, FAIL, os_families, parse_os_release, \
|
||||||
overwrite_symlink
|
overwrite_symlink
|
||||||
from scripts.lib.setup_venv import (
|
from scripts.lib.setup_venv import (
|
||||||
get_venv_dependencies, REDHAT_VENV_DEPENDENCIES,
|
get_venv_dependencies, THUMBOR_VENV_DEPENDENCIES,
|
||||||
THUMBOR_VENV_DEPENDENCIES, YUM_THUMBOR_VENV_DEPENDENCIES,
|
YUM_THUMBOR_VENV_DEPENDENCIES,
|
||||||
FEDORA_VENV_DEPENDENCIES
|
|
||||||
)
|
)
|
||||||
from scripts.lib.node_cache import setup_node_modules, NODE_MODULES_CACHE_PATH
|
from scripts.lib.node_cache import setup_node_modules, NODE_MODULES_CACHE_PATH
|
||||||
from tools.setup import setup_venvs
|
from tools.setup import setup_venvs
|
||||||
@@ -145,7 +144,7 @@ UBUNTU_COMMON_APT_DEPENDENCIES = COMMON_DEPENDENCIES + [
|
|||||||
"netcat", # Used for flushing memcached
|
"netcat", # Used for flushing memcached
|
||||||
"libfontconfig1", # Required by phantomjs
|
"libfontconfig1", # Required by phantomjs
|
||||||
"default-jre-headless", # Required by vnu-jar
|
"default-jre-headless", # Required by vnu-jar
|
||||||
] + VENV_DEPENDENCIES + THUMBOR_VENV_DEPENDENCIES
|
] + THUMBOR_VENV_DEPENDENCIES
|
||||||
|
|
||||||
COMMON_YUM_DEPENDENCIES = COMMON_DEPENDENCIES + [
|
COMMON_YUM_DEPENDENCIES = COMMON_DEPENDENCIES + [
|
||||||
"redis",
|
"redis",
|
||||||
@@ -172,14 +171,14 @@ if vendor == 'debian' and os_version in [] or vendor == 'ubuntu' and os_version
|
|||||||
"libgroonga-dev",
|
"libgroonga-dev",
|
||||||
"libmsgpack-dev",
|
"libmsgpack-dev",
|
||||||
]
|
]
|
||||||
]
|
] + VENV_DEPENDENCIES
|
||||||
elif "debian" in os_families():
|
elif "debian" in os_families():
|
||||||
SYSTEM_DEPENDENCIES = UBUNTU_COMMON_APT_DEPENDENCIES + [
|
SYSTEM_DEPENDENCIES = UBUNTU_COMMON_APT_DEPENDENCIES + [
|
||||||
pkg.format(POSTGRES_VERSION) for pkg in [
|
pkg.format(POSTGRES_VERSION) for pkg in [
|
||||||
"postgresql-{0}",
|
"postgresql-{0}",
|
||||||
"postgresql-{0}-pgroonga",
|
"postgresql-{0}-pgroonga",
|
||||||
]
|
]
|
||||||
]
|
] + VENV_DEPENDENCIES
|
||||||
elif "rhel" in os_families():
|
elif "rhel" in os_families():
|
||||||
SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [
|
SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [
|
||||||
pkg.format(POSTGRES_VERSION) for pkg in [
|
pkg.format(POSTGRES_VERSION) for pkg in [
|
||||||
@@ -188,7 +187,7 @@ elif "rhel" in os_families():
|
|||||||
"postgresql{0}-devel",
|
"postgresql{0}-devel",
|
||||||
"postgresql{0}-pgroonga",
|
"postgresql{0}-pgroonga",
|
||||||
]
|
]
|
||||||
] + REDHAT_VENV_DEPENDENCIES
|
] + VENV_DEPENDENCIES
|
||||||
elif "fedora" in os_families():
|
elif "fedora" in os_families():
|
||||||
SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [
|
SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [
|
||||||
pkg.format(POSTGRES_VERSION) for pkg in [
|
pkg.format(POSTGRES_VERSION) for pkg in [
|
||||||
@@ -199,7 +198,7 @@ elif "fedora" in os_families():
|
|||||||
"groonga-devel",
|
"groonga-devel",
|
||||||
"msgpack-devel",
|
"msgpack-devel",
|
||||||
]
|
]
|
||||||
] + FEDORA_VENV_DEPENDENCIES
|
] + VENV_DEPENDENCIES
|
||||||
BUILD_PGROONGA_FROM_SOURCE = True
|
BUILD_PGROONGA_FROM_SOURCE = True
|
||||||
|
|
||||||
if "fedora" in os_families():
|
if "fedora" in os_families():
|
||||||
|
|||||||
Reference in New Issue
Block a user