|
32 | 32 | """
|
33 | 33 |
|
34 | 34 | from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED
|
| 35 | +from datetime import datetime |
35 | 36 | import logging
|
36 | 37 | import os
|
37 | 38 | import subprocess
|
@@ -89,13 +90,19 @@ def _file_unchanged(old, new):
|
89 | 90 | return True
|
90 | 91 |
|
91 | 92 |
|
92 |
| -def shell_out(cmd, shell=False): |
| 93 | +def shell_out(cmd, shell=False, logfile=None): |
93 | 94 | logging.debug("Running command %r", cmd)
|
94 | 95 | try:
|
95 |
| - return subprocess.check_output(cmd, shell=shell, |
96 |
| - stdin=subprocess.PIPE, |
97 |
| - stderr=subprocess.STDOUT, |
98 |
| - universal_newlines=True) |
| 96 | + output = subprocess.check_output(cmd, shell=shell, |
| 97 | + stdin=subprocess.PIPE, |
| 98 | + stderr=subprocess.STDOUT, |
| 99 | + universal_newlines=True) |
| 100 | + if logfile: |
| 101 | + with open(logfile, 'a+') as log: |
| 102 | + log.write("#" + str(datetime.now())) |
| 103 | + log.write(output) |
| 104 | + log.write("\n\n") |
| 105 | + return output |
99 | 106 | except subprocess.CalledProcessError as e:
|
100 | 107 | logging.debug("Command failed with output %r", e.output)
|
101 | 108 | raise
|
@@ -226,9 +233,15 @@ def build_one(version, git_branch, isdev, quick, venv, build_root, www_root,
|
226 | 233 | sphinxbuild = os.path.join(venv, "bin/sphinx-build")
|
227 | 234 | blurb = os.path.join(venv, "bin/blurb")
|
228 | 235 | shell_out(
|
229 |
| - "make -C %s PYTHON=%s SPHINXBUILD=%s BLURB=%s VENVDIR=%s SPHINXOPTS='%s' %s >> %s 2>&1" % |
230 |
| - (os.path.join(checkout, 'Doc'), python, sphinxbuild, blurb, venv, ' '.join(sphinxopts), maketarget, |
231 |
| - os.path.join(log_directory, logname)), shell=True) |
| 236 | + ["make", |
| 237 | + "-C", os.path.join(checkout, 'Doc'), |
| 238 | + "PYTHON=" + python, |
| 239 | + "SPHINXBUILD=" + sphinxbuild, |
| 240 | + "BLURB=" + blurb, |
| 241 | + "VENVDIR=" + venv, |
| 242 | + "SPHINXOPTS=" + ' '.join(sphinxopts), |
| 243 | + maketarget], |
| 244 | + logfile=os.path.join(log_directory, logname)) |
232 | 245 | shell_out(['chgrp', '-R', group, log_directory])
|
233 | 246 | changed = changed_files(os.path.join(checkout, "Doc/build/html"), target)
|
234 | 247 | logging.info("Copying HTML files to %s", target)
|
|
0 commit comments