mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
zulip_tools: Extract get_deploy_root function.
Modified by tabbott from the original to preserve the implementation; see https://github.com/zulip/zulip/pull/11295#discussion_r254925032 for why this is correct. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Tim Abbott
parent
4826393ec4
commit
70bfcd3402
@@ -80,6 +80,13 @@ def parse_cache_script_args(description):
|
|||||||
args.verbose |= args.dry_run # Always print a detailed report in case of dry run.
|
args.verbose |= args.dry_run # Always print a detailed report in case of dry run.
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def get_deploy_root() -> str:
|
||||||
|
# This calls realpath twice to handle both symlinks and users
|
||||||
|
# running our scripts with relative paths from a current working
|
||||||
|
# directory of `scripts/`.
|
||||||
|
return os.path.realpath(os.path.dirname(os.path.dirname(
|
||||||
|
os.path.dirname(os.path.realpath(__file__)))))
|
||||||
|
|
||||||
def get_deployment_version(extract_path):
|
def get_deployment_version(extract_path):
|
||||||
# type: (str) -> str
|
# type: (str) -> str
|
||||||
version = '0.0.0'
|
version = '0.0.0'
|
||||||
@@ -122,8 +129,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
def get_dev_uuid_var_path(create_if_missing=False):
|
def get_dev_uuid_var_path(create_if_missing=False):
|
||||||
# type: (bool) -> str
|
# type: (bool) -> str
|
||||||
zulip_path = os.path.realpath(os.path.dirname(os.path.dirname(
|
zulip_path = get_deploy_root()
|
||||||
os.path.dirname(os.path.realpath(__file__)))))
|
|
||||||
uuid_path = os.path.join(os.path.realpath(os.path.dirname(zulip_path)), ".zulip-dev-uuid")
|
uuid_path = os.path.join(os.path.realpath(os.path.dirname(zulip_path)), ".zulip-dev-uuid")
|
||||||
if os.path.exists(uuid_path):
|
if os.path.exists(uuid_path):
|
||||||
with open(uuid_path) as f:
|
with open(uuid_path) as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user