install: add option to avoid installing python system dependencies, in case the python version being used is from source

This commit is contained in:
Blake Harnden 2022-07-21 15:35:31 -07:00
parent fe1593b51f
commit d63722c0ed

View file

@ -166,20 +166,26 @@ def check_existing_core(c: Context, hide: bool) -> None:
raise SystemError("core scripts found, please remove old installation") raise SystemError("core scripts found, please remove old installation")
def install_system(c: Context, os_info: OsInfo, hide: bool) -> None: def install_system(c: Context, os_info: OsInfo, hide: bool, no_python: bool) -> None:
python_dep = get_env_python_dep() python_dep = get_env_python_dep()
if os_info.like == OsLike.DEBIAN: if os_info.like == OsLike.DEBIAN:
c.run( c.run(
"sudo apt install -y automake pkg-config gcc libev-dev nftables " "sudo apt install -y automake pkg-config gcc libev-dev nftables "
f"iproute2 ethtool tk {python_dep}-tk bash", f"iproute2 ethtool tk bash",
hide=hide hide=hide
) )
if not no_python:
c.run(f"sudo apt install -y {python_dep}-tk", hide=hide)
elif os_info.like == OsLike.REDHAT: elif os_info.like == OsLike.REDHAT:
c.run( c.run(
"sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ " "sudo yum install -y automake pkgconf-pkg-config gcc gcc-c++ "
f"libev-devel nftables iproute {python_dep}-devel {python_dep}-tkinter " f"libev-devel nftables iproute tk ethtool make bash",
"tk ethtool make bash", hide=hide,
hide=hide )
if not no_python:
c.run(
f"sudo yum install -y {python_dep}-devel {python_dep}-tkinter ",
hide=hide,
) )
# centos 8+ does not support netem by default # centos 8+ does not support netem by default
if os_info.name == OsName.CENTOS and os_info.version >= 8: if os_info.name == OsName.CENTOS and os_info.version >= 8:
@ -336,6 +342,7 @@ def install_core_files(c, local=False, verbose=False, prefix=DEFAULT_PREFIX):
"install-type": "used to force an install type, " "install-type": "used to force an install type, "
"can be one of the following (redhat, debian)", "can be one of the following (redhat, debian)",
"ospf": "disable ospf installation", "ospf": "disable ospf installation",
"no-python": "avoid installing python system dependencies",
}, },
) )
def install( def install(
@ -346,6 +353,7 @@ def install(
prefix=DEFAULT_PREFIX, prefix=DEFAULT_PREFIX,
install_type=None, install_type=None,
ospf=True, ospf=True,
no_python=False,
): ):
""" """
install core, poetry, scripts, service, and ospf mdr install core, poetry, scripts, service, and ospf mdr
@ -360,7 +368,7 @@ def install(
with p.start("checking for old installations"): with p.start("checking for old installations"):
check_existing_core(c, hide) check_existing_core(c, hide)
with p.start("installing system dependencies"): with p.start("installing system dependencies"):
install_system(c, os_info, hide) install_system(c, os_info, hide, no_python)
with p.start("installing system grpcio-tools"): with p.start("installing system grpcio-tools"):
install_grpcio(c, hide) install_grpcio(c, hide)
with p.start("building core"): with p.start("building core"):