mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
python: Reformat with Black, except quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
5028c081cb
commit
11741543da
@@ -25,7 +25,9 @@ from scripts.lib.zulip_tools import (
|
||||
|
||||
config_file = get_config_file()
|
||||
deploy_options = get_deploy_options(config_file)
|
||||
remote_url = get_config(config_file, 'deployment', 'git_repo_url', "https://github.com/zulip/zulip.git")
|
||||
remote_url = get_config(
|
||||
config_file, 'deployment', 'git_repo_url', "https://github.com/zulip/zulip.git"
|
||||
)
|
||||
|
||||
assert_running_as_root(strip_lib_from_paths=True)
|
||||
|
||||
@@ -33,13 +35,13 @@ assert_running_as_root(strip_lib_from_paths=True)
|
||||
os.umask(0o22)
|
||||
|
||||
logging.Formatter.converter = time.gmtime
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip-from-git: %(message)s",
|
||||
level=logging.INFO)
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip-from-git: %(message)s", level=logging.INFO)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("refname", help="Git reference, e.g. a branch, tag, or commit ID.")
|
||||
parser.add_argument("--remote-url",
|
||||
help="Override the Git remote URL configured in /etc/zulip/zulip.conf.")
|
||||
parser.add_argument(
|
||||
"--remote-url", help="Override the Git remote URL configured in /etc/zulip/zulip.conf."
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
refname = args.refname
|
||||
@@ -58,26 +60,38 @@ try:
|
||||
deploy_path = make_deploy_path()
|
||||
if not os.path.exists(LOCAL_GIT_CACHE_DIR):
|
||||
logging.info("Cloning the repository")
|
||||
subprocess.check_call(["git", "clone", "-q", remote_url, "--mirror", LOCAL_GIT_CACHE_DIR],
|
||||
stdout=open('/dev/null', 'w'))
|
||||
subprocess.check_call(
|
||||
["git", "clone", "-q", remote_url, "--mirror", LOCAL_GIT_CACHE_DIR],
|
||||
stdout=open('/dev/null', 'w'),
|
||||
)
|
||||
if os.stat(LOCAL_GIT_CACHE_DIR).st_uid == 0:
|
||||
subprocess.check_call(["chown", "-R", "zulip:zulip", LOCAL_GIT_CACHE_DIR])
|
||||
|
||||
logging.info("Fetching the latest commits")
|
||||
os.chdir(LOCAL_GIT_CACHE_DIR)
|
||||
subprocess.check_call(["git", "remote", "set-url", "origin", remote_url], preexec_fn=su_to_zulip)
|
||||
subprocess.check_call(
|
||||
["git", "remote", "set-url", "origin", remote_url], preexec_fn=su_to_zulip
|
||||
)
|
||||
subprocess.check_call(["git", "fetch", "-q", "--tags"], preexec_fn=su_to_zulip)
|
||||
|
||||
subprocess.check_call(["git", "clone", "-q", "-b", refname, LOCAL_GIT_CACHE_DIR, deploy_path],
|
||||
stdout=open('/dev/null', 'w'),
|
||||
preexec_fn=su_to_zulip)
|
||||
subprocess.check_call(
|
||||
["git", "clone", "-q", "-b", refname, LOCAL_GIT_CACHE_DIR, deploy_path],
|
||||
stdout=open('/dev/null', 'w'),
|
||||
preexec_fn=su_to_zulip,
|
||||
)
|
||||
os.chdir(deploy_path)
|
||||
|
||||
overwrite_symlink("/etc/zulip/settings.py", "zproject/prod_settings.py")
|
||||
|
||||
overwrite_symlink(deploy_path, os.path.join(DEPLOYMENTS_DIR, "next"))
|
||||
|
||||
subprocess.check_call([os.path.join(deploy_path, "scripts", "lib", "upgrade-zulip-stage-2"),
|
||||
deploy_path, "--from-git", *deploy_options])
|
||||
subprocess.check_call(
|
||||
[
|
||||
os.path.join(deploy_path, "scripts", "lib", "upgrade-zulip-stage-2"),
|
||||
deploy_path,
|
||||
"--from-git",
|
||||
*deploy_options,
|
||||
]
|
||||
)
|
||||
finally:
|
||||
release_deployment_lock()
|
||||
|
||||
Reference in New Issue
Block a user