mirror of https://github.com/zulip/zulip.git
provision: Convert "".format to Python 3.6 f-strings.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
424b441bb1
commit
0682d5c0f3
|
@ -165,9 +165,9 @@ if vendor == 'debian' and os_version in [] or vendor == 'ubuntu' and os_version
|
|||
BUILD_PGROONGA_FROM_SOURCE = True
|
||||
SYSTEM_DEPENDENCIES = [
|
||||
*UBUNTU_COMMON_APT_DEPENDENCIES,
|
||||
"postgresql-{0}".format(POSTGRES_VERSION),
|
||||
f"postgresql-{POSTGRES_VERSION}",
|
||||
# Dependency for building pgroonga from source
|
||||
"postgresql-server-dev-{0}".format(POSTGRES_VERSION),
|
||||
f"postgresql-server-dev-{POSTGRES_VERSION}",
|
||||
"libgroonga-dev",
|
||||
"libmsgpack-dev",
|
||||
"clang-9",
|
||||
|
@ -177,25 +177,25 @@ if vendor == 'debian' and os_version in [] or vendor == 'ubuntu' and os_version
|
|||
elif "debian" in os_families():
|
||||
SYSTEM_DEPENDENCIES = [
|
||||
*UBUNTU_COMMON_APT_DEPENDENCIES,
|
||||
"postgresql-{0}".format(POSTGRES_VERSION),
|
||||
"postgresql-{0}-pgroonga".format(POSTGRES_VERSION),
|
||||
f"postgresql-{POSTGRES_VERSION}",
|
||||
f"postgresql-{POSTGRES_VERSION}-pgroonga",
|
||||
*VENV_DEPENDENCIES,
|
||||
]
|
||||
elif "rhel" in os_families():
|
||||
SYSTEM_DEPENDENCIES = [
|
||||
*COMMON_YUM_DEPENDENCIES,
|
||||
"postgresql{0}-server".format(POSTGRES_VERSION),
|
||||
"postgresql{0}".format(POSTGRES_VERSION),
|
||||
"postgresql{0}-devel".format(POSTGRES_VERSION),
|
||||
"postgresql{0}-pgroonga".format(POSTGRES_VERSION),
|
||||
f"postgresql{POSTGRES_VERSION}-server",
|
||||
f"postgresql{POSTGRES_VERSION}",
|
||||
f"postgresql{POSTGRES_VERSION}-devel",
|
||||
f"postgresql{POSTGRES_VERSION}-pgroonga",
|
||||
*VENV_DEPENDENCIES,
|
||||
]
|
||||
elif "fedora" in os_families():
|
||||
SYSTEM_DEPENDENCIES = [
|
||||
*COMMON_YUM_DEPENDENCIES,
|
||||
"postgresql{0}-server".format(POSTGRES_VERSION),
|
||||
"postgresql{0}".format(POSTGRES_VERSION),
|
||||
"postgresql{0}-devel".format(POSTGRES_VERSION),
|
||||
f"postgresql{POSTGRES_VERSION}-server",
|
||||
f"postgresql{POSTGRES_VERSION}",
|
||||
f"postgresql{POSTGRES_VERSION}-devel",
|
||||
# Needed to build pgroonga from source
|
||||
"groonga-devel",
|
||||
"msgpack-devel",
|
||||
|
@ -204,9 +204,9 @@ elif "fedora" in os_families():
|
|||
BUILD_PGROONGA_FROM_SOURCE = True
|
||||
|
||||
if "fedora" in os_families():
|
||||
TSEARCH_STOPWORDS_PATH = "/usr/pgsql-{}/share/tsearch_data/".format(POSTGRES_VERSION)
|
||||
TSEARCH_STOPWORDS_PATH = f"/usr/pgsql-{POSTGRES_VERSION}/share/tsearch_data/"
|
||||
else:
|
||||
TSEARCH_STOPWORDS_PATH = "/usr/share/postgresql/{}/tsearch_data/".format(POSTGRES_VERSION)
|
||||
TSEARCH_STOPWORDS_PATH = f"/usr/share/postgresql/{POSTGRES_VERSION}/tsearch_data/"
|
||||
REPO_STOPWORDS_PATH = os.path.join(
|
||||
ZULIP_PATH,
|
||||
"puppet",
|
||||
|
@ -278,16 +278,16 @@ def install_yum_deps(deps_to_install: List[str]) -> None:
|
|||
run_as_root(["python36", "-m", "ensurepip"])
|
||||
# `python36` is not aliased to `python3` by default
|
||||
run_as_root(["ln", "-nsf", "/usr/bin/python36", "/usr/bin/python3"])
|
||||
postgres_dir = 'pgsql-{}'.format(POSTGRES_VERSION)
|
||||
postgres_dir = f'pgsql-{POSTGRES_VERSION}'
|
||||
for cmd in ['pg_config', 'pg_isready', 'psql']:
|
||||
# Our tooling expects these postgres scripts to be at
|
||||
# well-known paths. There's an argument for eventually
|
||||
# making our tooling auto-detect, but this is simpler.
|
||||
run_as_root(["ln", "-nsf", "/usr/{}/bin/{}".format(postgres_dir, cmd),
|
||||
"/usr/bin/{}".format(cmd)])
|
||||
run_as_root(["ln", "-nsf", f"/usr/{postgres_dir}/bin/{cmd}",
|
||||
f"/usr/bin/{cmd}"])
|
||||
|
||||
# From here, we do the first-time setup/initialization for the postgres database.
|
||||
pg_datadir = "/var/lib/pgsql/{}/data".format(POSTGRES_VERSION)
|
||||
pg_datadir = f"/var/lib/pgsql/{POSTGRES_VERSION}/data"
|
||||
pg_hba_conf = os.path.join(pg_datadir, "pg_hba.conf")
|
||||
|
||||
# We can't just check if the file exists with os.path, since the
|
||||
|
@ -297,7 +297,7 @@ def install_yum_deps(deps_to_install: List[str]) -> None:
|
|||
# Skip setup if it has been applied previously
|
||||
return
|
||||
|
||||
run_as_root(["/usr/{}/bin/postgresql-{}-setup".format(postgres_dir, POSTGRES_VERSION), "initdb"],
|
||||
run_as_root([f"/usr/{postgres_dir}/bin/postgresql-{POSTGRES_VERSION}-setup", "initdb"],
|
||||
sudo_args = ['-H'])
|
||||
# Use vendored pg_hba.conf, which enables password authentication.
|
||||
run_as_root(["cp", "-a", "puppet/zulip/files/postgresql/centos_pg_hba.conf", pg_hba_conf])
|
||||
|
@ -306,11 +306,11 @@ def install_yum_deps(deps_to_install: List[str]) -> None:
|
|||
# Link in tsearch data files
|
||||
overwrite_symlink(
|
||||
"/usr/share/myspell/en_US.dic",
|
||||
"/usr/pgsql-{}/share/tsearch_data/en_us.dict".format(POSTGRES_VERSION),
|
||||
f"/usr/pgsql-{POSTGRES_VERSION}/share/tsearch_data/en_us.dict",
|
||||
)
|
||||
overwrite_symlink(
|
||||
"/usr/share/myspell/en_US.aff",
|
||||
"/usr/pgsql-{}/share/tsearch_data/en_us.affix".format(POSTGRES_VERSION,),
|
||||
f"/usr/pgsql-{POSTGRES_VERSION}/share/tsearch_data/en_us.affix",
|
||||
)
|
||||
|
||||
def main(options: argparse.Namespace) -> "NoReturn":
|
||||
|
@ -364,7 +364,7 @@ def main(options: argparse.Namespace) -> "NoReturn":
|
|||
|
||||
if not os.access(NODE_MODULES_CACHE_PATH, os.W_OK):
|
||||
run_as_root(["mkdir", "-p", NODE_MODULES_CACHE_PATH])
|
||||
run_as_root(["chown", "{}:{}".format(os.getuid(), os.getgid()), NODE_MODULES_CACHE_PATH])
|
||||
run_as_root(["chown", f"{os.getuid()}:{os.getgid()}", NODE_MODULES_CACHE_PATH])
|
||||
|
||||
# This is a wrapper around `yarn`, which we run last since
|
||||
# it can often fail due to network issues beyond our control.
|
||||
|
@ -395,7 +395,7 @@ def main(options: argparse.Namespace) -> "NoReturn":
|
|||
elif "fedora" in os_families():
|
||||
# These platforms don't enable and start services on
|
||||
# installing their package, so we do that here.
|
||||
for service in ["postgresql-{}".format(POSTGRES_VERSION), "rabbitmq-server", "memcached", "redis"]:
|
||||
for service in [f"postgresql-{POSTGRES_VERSION}", "rabbitmq-server", "memcached", "redis"]:
|
||||
run_as_root(["systemctl", "enable", service], sudo_args = ['-H'])
|
||||
run_as_root(["systemctl", "start", service], sudo_args = ['-H'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue