From d606b95242815f0b389be29bec931800756f5d6c Mon Sep 17 00:00:00 2001 From: Taranjeet Singh Date: Sat, 13 Aug 2016 21:16:19 +0530 Subject: [PATCH] zulip_tools.py: Move zulip_tools.py in scripts/lib. This commit moves zulip_tools.py as part of cleaning the root directory and organizing proejct into better directory structure. --- docs/dev-env-first-time-contributors.md | 2 +- scripts/deploy-zulip-from-git | 2 +- scripts/lib/create-production-venv | 2 +- scripts/lib/install | 2 +- scripts/lib/setup_venv.py | 2 +- scripts/lib/unpack-zulip | 2 +- scripts/lib/upgrade-zulip | 2 +- scripts/lib/upgrade-zulip-stage-2 | 2 +- zulip_tools.py => scripts/lib/zulip_tools.py | 0 scripts/purge-old-deployments | 2 +- scripts/restart-server | 2 +- tools/post-receive | 2 +- tools/provision.py | 2 +- tools/setup/install-phantomjs | 2 +- 14 files changed, 13 insertions(+), 13 deletions(-) rename zulip_tools.py => scripts/lib/zulip_tools.py (100%) diff --git a/docs/dev-env-first-time-contributors.md b/docs/dev-env-first-time-contributors.md index db4abe24e6..f1d065656c 100644 --- a/docs/dev-env-first-time-contributors.md +++ b/docs/dev-env-first-time-contributors.md @@ -609,7 +609,7 @@ that looks something like: ==> default: File "/srv/zulip/tools/provision.py", line 191, in main ==> default: ==> default: run(["npm", "install"]) -==> default: File "/srv/zulip/zulip_tools.py", line 78, in run +==> default: File "/srv/zulip/scripts/lib/zulip_tools.py", line 78, in run ==> default: ==> default: raise subprocess.CalledProcessError(rc, args) ==> default: subprocess diff --git a/scripts/deploy-zulip-from-git b/scripts/deploy-zulip-from-git index efcb49b92f..901e643943 100755 --- a/scripts/deploy-zulip-from-git +++ b/scripts/deploy-zulip-from-git @@ -24,7 +24,7 @@ except (configparser.NoSectionError, configparser.NoOptionError): os.environ["PYTHONUNBUFFERED"] = "y" sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -from zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, make_deploy_path, \ +from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, make_deploy_path, \ get_deployment_lock, release_deployment_lock, su_to_zulip logging.basicConfig(format="%(asctime)s update-deployment: %(message)s", diff --git a/scripts/lib/create-production-venv b/scripts/lib/create-production-venv index 278b94fabd..ae2a1abfc3 100755 --- a/scripts/lib/create-production-venv +++ b/scripts/lib/create-production-venv @@ -9,7 +9,7 @@ ZULIP_PATH = dirname(dirname(dirname(abspath(__file__)))) if ZULIP_PATH not in sys.path: sys.path.append(ZULIP_PATH) -from zulip_tools import run +from scripts.lib.zulip_tools import run from scripts.lib.setup_venv import setup_virtualenv, VENV_DEPENDENCIES parser = argparse.ArgumentParser(description="Create a production virtualenv with caching") diff --git a/scripts/lib/install b/scripts/lib/install index 0669be3689..684200f17a 100755 --- a/scripts/lib/install +++ b/scripts/lib/install @@ -95,7 +95,7 @@ if [ "$has_postgres" = 0 ]; then fi if [ "$has_appserver" = 0 ]; then - deploy_path=$(/root/zulip/zulip_tools.py make_deploy_path) + deploy_path=$(/root/zulip/scripts/lib/zulip_tools.py make_deploy_path) mv /root/zulip "$deploy_path" ln -nsf /home/zulip/deployments/next /root/zulip ln -nsf "$deploy_path" /home/zulip/deployments/next diff --git a/scripts/lib/setup_venv.py b/scripts/lib/setup_venv.py index 15d4a942f9..94d4dffeff 100644 --- a/scripts/lib/setup_venv.py +++ b/scripts/lib/setup_venv.py @@ -4,7 +4,7 @@ import os import sys from os.path import dirname, abspath import subprocess -from zulip_tools import run +from scripts.lib.zulip_tools import run ZULIP_PATH = dirname(dirname(dirname(abspath(__file__)))) VENV_CACHE_PATH = "/srv/zulip-venv-cache" diff --git a/scripts/lib/unpack-zulip b/scripts/lib/unpack-zulip index efea4885ec..18075fc944 100755 --- a/scripts/lib/unpack-zulip +++ b/scripts/lib/unpack-zulip @@ -10,7 +10,7 @@ import glob os.environ["PYTHONUNBUFFERED"] = "y" sys.path.append(os.path.join(os.path.dirname(__file__), '..', "..")) -from zulip_tools import DEPLOYMENTS_DIR, FAIL, ENDC, make_deploy_path +from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, ENDC, make_deploy_path if len(sys.argv) != 2: print(FAIL + "Usage: %s " % (sys.argv[0],) + ENDC) diff --git a/scripts/lib/upgrade-zulip b/scripts/lib/upgrade-zulip index 3bb27403f5..bdfc41737c 100755 --- a/scripts/lib/upgrade-zulip +++ b/scripts/lib/upgrade-zulip @@ -10,7 +10,7 @@ TARBALL_ARCHIVE_PATH="/home/zulip/archives" os.environ["PYTHONUNBUFFERED"] = "y" sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) -from zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, \ +from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, \ mkdir_p, su_to_zulip, get_deployment_lock, release_deployment_lock logging.basicConfig(format="%(asctime)s upgrade-zulip: %(message)s", diff --git a/scripts/lib/upgrade-zulip-stage-2 b/scripts/lib/upgrade-zulip-stage-2 index 110f6e8465..33c6ceda88 100755 --- a/scripts/lib/upgrade-zulip-stage-2 +++ b/scripts/lib/upgrade-zulip-stage-2 @@ -14,7 +14,7 @@ import logging os.environ["PYTHONUNBUFFERED"] = "y" sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) -from zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, su_to_zulip +from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, su_to_zulip logging.basicConfig(format="%(asctime)s upgrade-zulip-stage-2: %(message)s", level=logging.INFO) diff --git a/zulip_tools.py b/scripts/lib/zulip_tools.py similarity index 100% rename from zulip_tools.py rename to scripts/lib/zulip_tools.py diff --git a/scripts/purge-old-deployments b/scripts/purge-old-deployments index 019334082c..53e1664d2b 100755 --- a/scripts/purge-old-deployments +++ b/scripts/purge-old-deployments @@ -6,7 +6,7 @@ import datetime import shutil sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -from zulip_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT +from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT logging.basicConfig(format="%(asctime)s purge-deployments: %(message)s", level=logging.INFO) diff --git a/scripts/restart-server b/scripts/restart-server index b53c79a658..52c2aef318 100755 --- a/scripts/restart-server +++ b/scripts/restart-server @@ -8,7 +8,7 @@ import logging import time sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -from zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR +from scripts.lib.zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR logging.basicConfig(format="%(asctime)s restart-server: %(message)s", level=logging.INFO) diff --git a/tools/post-receive b/tools/post-receive index 179ac7cb4d..71a18af2c9 100755 --- a/tools/post-receive +++ b/tools/post-receive @@ -34,7 +34,7 @@ import sys import subprocess sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from zerver.lib.str_utils import force_str, force_bytes -from zulip_tools import ENDC, FAIL, subprocess_text_output +from scripts.lib.zulip_tools import ENDC, FAIL, subprocess_text_output def update_deployment(server, refname): return subprocess.call(["ssh", "-l", "zulip", server, "--", "env", "-u", "GIT_DIR", diff --git a/tools/provision.py b/tools/provision.py index bbb61b1368..f4b1e93d65 100755 --- a/tools/provision.py +++ b/tools/provision.py @@ -13,7 +13,7 @@ PY2 = sys.version_info[0] == 2 ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(ZULIP_PATH) -from zulip_tools import run, subprocess_text_output, OKBLUE, ENDC, WARNING +from scripts.lib.zulip_tools import run, subprocess_text_output, OKBLUE, ENDC, WARNING from scripts.lib.setup_venv import setup_virtualenv, VENV_DEPENDENCIES SUPPORTED_PLATFORMS = { diff --git a/tools/setup/install-phantomjs b/tools/setup/install-phantomjs index b062c1ce7f..e19f9f0940 100755 --- a/tools/setup/install-phantomjs +++ b/tools/setup/install-phantomjs @@ -6,7 +6,7 @@ import platform import subprocess sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) -from zulip_tools import run +from scripts.lib.zulip_tools import run if platform.architecture()[0] == '64bit': phantomjs_arch = 'x86_64'