diff --git a/bots/check-rabbitmq-consumers b/bots/check-rabbitmq-consumers index e34e47bcc3..071d2d5c51 100755 --- a/bots/check-rabbitmq-consumers +++ b/bots/check-rabbitmq-consumers @@ -7,7 +7,7 @@ from collections import defaultdict from os import path, environ -sys.path.append(path.join(path.dirname(__file__), '../tools')) +sys.path.append(path.join(path.dirname(__file__), '..')) from zulip_tools import check_output states = { diff --git a/bots/check-rabbitmq-queue b/bots/check-rabbitmq-queue index eb0391d350..ef57dcb0b4 100755 --- a/bots/check-rabbitmq-queue +++ b/bots/check-rabbitmq-queue @@ -6,7 +6,7 @@ import time from os import path, environ -sys.path.append(path.join(path.dirname(__file__), '../tools')) +sys.path.append(path.join(path.dirname(__file__), '..')) from zulip_tools import check_output WARN_THRESHOLD = 50 diff --git a/scripts/purge-deployments b/scripts/purge-deployments index 24be39f01b..8437f233f2 100755 --- a/scripts/purge-deployments +++ b/scripts/purge-deployments @@ -5,7 +5,7 @@ import logging import datetime import shutil -sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from zulip_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT logging.basicConfig(format="%(asctime)s purge-deployments: %(message)s", diff --git a/scripts/restart-server b/scripts/restart-server index e2aa2d6475..62024d9fdb 100755 --- a/scripts/restart-server +++ b/scripts/restart-server @@ -6,7 +6,7 @@ import subprocess import logging import time -sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR logging.basicConfig(format="%(asctime)s restart-server: %(message)s", diff --git a/scripts/update-deployment b/scripts/update-deployment index a6384bdba5..76882608ef 100755 --- a/scripts/update-deployment +++ b/scripts/update-deployment @@ -7,7 +7,7 @@ import datetime import shutil import time -sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from zulip_tools import DEPLOYMENTS_DIR, LOCK_DIR, TIMESTAMP_FORMAT, FAIL, WARNING, ENDC logging.basicConfig(format="%(asctime)s update-deployment: %(message)s", diff --git a/tools/check-handlebar-templates b/tools/check-handlebar-templates index 5eb03f04c1..3821e3642f 100755 --- a/tools/check-handlebar-templates +++ b/tools/check-handlebar-templates @@ -1,8 +1,12 @@ #!/usr/bin/env python -from zulip_tools import check_output +import os +import sys import re import glob +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +from zulip_tools import check_output + class Record: pass diff --git a/tools/lint-all b/tools/lint-all index dba9f8746e..b2530f5140 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -8,6 +8,7 @@ import subprocess from os import path from collections import defaultdict +sys.path.append(path.join(path.dirname(__file__), '..')) from zulip_tools import check_output parser = optparse.OptionParser() diff --git a/tools/post-receive b/tools/post-receive index 1b1e90826e..54f160d486 100755 --- a/tools/post-receive +++ b/tools/post-receive @@ -28,8 +28,10 @@ # # see contrib/hooks/ for a sample +import os import sys import subprocess +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from zulip_tools import check_output, ENDC, FAIL def update_deployment(server, refname): diff --git a/tools/zulip_tools/__init__.py b/zulip_tools.py similarity index 100% rename from tools/zulip_tools/__init__.py rename to zulip_tools.py