mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
At Ksplice we used /usr/bin/python because we shipped dependencies as Debian / Red Hat packages, which would be installed against the system Python. We were also very careful to use only Python 2.3 features so that even old system Python would still work. None of that is true at Humbug. We expect users to install dependencies themselves, so it's more likely that the Python in $PATH is correct. On OS X in particular, it's common to have five broken Python installs and there's no expectation that /usr/bin/python is the right one. The files which aren't marked executable are not interesting to run as scripts, so we just remove the line there. (In general it's common to have libraries that can also be executed, to run test cases or whatever, but that's not the case here.) (imported from commit 437d4aee2c6e66601ad3334eefd50749cce2eca6)
51 lines
1.4 KiB
Python
Executable File
51 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python
|
|
import os
|
|
import sys
|
|
import subprocess
|
|
import pylibmc
|
|
import traceback
|
|
|
|
def check_output(*popenargs, **kwargs):
|
|
if 'stdout' in kwargs:
|
|
raise ValueError('stdout argument not allowed, it will be overridden.')
|
|
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
|
|
output, unused_err = process.communicate()
|
|
retcode = process.poll()
|
|
if retcode:
|
|
cmd = kwargs.get("args")
|
|
if cmd is None:
|
|
cmd = popenargs[0]
|
|
raise subprocess.CalledProcessError(retcode, cmd, output=output)
|
|
return output
|
|
|
|
subprocess.check_output = check_output
|
|
|
|
# Color codes
|
|
OKBLUE = '\033[94m'
|
|
OKGREEN = '\033[92m'
|
|
WARNING = '\033[93m'
|
|
FAIL = '\033[91m'
|
|
ENDC = '\033[0m'
|
|
|
|
os.chdir("/home/humbug/humbug")
|
|
if len(sys.argv) > 1:
|
|
oldrev = sys.argv[1]
|
|
newrev = sys.argv[2]
|
|
refname = sys.argv[3]
|
|
|
|
subprocess.check_call(["git", "fetch"], stdout=open('/dev/null', 'w'))
|
|
subprocess.check_call(["git", "reset", "--hard", refname], stdout=open('/dev/null', 'w'))
|
|
|
|
subprocess.check_call(["./tools/restart-server"])
|
|
|
|
if newrev == '0000000000000000000000000000000000000000':
|
|
# 0000000000000000000000000000000000000000 means we're deleting the ref
|
|
commits = ''
|
|
else:
|
|
commits = subprocess.check_output(["git", "log", "%s..%s" % (oldrev, newrev)])
|
|
|
|
if '[schema]' in commits:
|
|
print
|
|
print FAIL + "Schema change detected! Please make the appropriate changes manually." + ENDC
|
|
print
|