provision: Rewrite using subprocess module instead of sh.

The `with sh.sudo` pattern that we were using in python-sh was
deprecated, and emperically hangs on Ubuntu xenial.  Since in general
the use of python-sh/python-pbs caused trouble (requiring extra
dependencies, confusing syntax), this just removes it.

We replace it with a new zulip_tools.py library function that echoes
the command line and streams the output.

We do the same to install-phantomjs so we can remove that dependency.
This commit is contained in:
Tim Abbott
2016-04-06 08:15:31 -07:00
parent 2ac5271091
commit 52fc1c71bc
7 changed files with 61 additions and 69 deletions

View File

@@ -5,6 +5,7 @@ import errno
import os
import pwd
import shutil
import subprocess
import sys
import time
@@ -67,3 +68,12 @@ def get_deployment_lock(error_rerun_script):
def release_deployment_lock():
shutil.rmtree(LOCK_DIR)
def run(args):
# Output what we're doing in the `set -x` style
print("+ %s" % (" ".join(args)))
process = subprocess.Popen(args)
rc = process.wait()
if rc:
raise subprocess.CalledProcessError(rc, args)
return 0