summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-02-25 23:16:15 (GMT)
committerPeter Wu <peter@lekensteyn.nl>2016-02-25 23:16:15 (GMT)
commit572cc8eb6f70e3acbae57e586788f15e9b562f96 (patch)
treee089e5d5f57e84097cbd2dd573d1fbdeee8de755
parentd1763746b65cc7349d4ed9478befdb651aa24589 (diff)
downloadNinja-572cc8eb6f70e3acbae57e586788f15e9b562f96.zip
Ninja-572cc8eb6f70e3acbae57e586788f15e9b562f96.tar.gz
Ninja-572cc8eb6f70e3acbae57e586788f15e9b562f96.tar.bz2
browse.py: allow port override via environment variable
-rw-r--r--doc/manual.asciidoc3
-rwxr-xr-xsrc/browse.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc
index 0d842f9..4e69ad4 100644
--- a/doc/manual.asciidoc
+++ b/doc/manual.asciidoc
@@ -223,7 +223,8 @@ found useful during Ninja's development. The current tools are:
`browse`:: browse the dependency graph in a web browser. Clicking a
file focuses the view on that file, showing inputs and outputs. This
-feature requires a Python installation.
+feature requires a Python installation. The `PORT` environment variable
+can be used to override the default port number (8000).
`graph`:: output a file in the syntax used by `graphviz`, a automatic
graph layout tool. Use it like:
diff --git a/src/browse.py b/src/browse.py
index 9e59bd8..081eb8c 100755
--- a/src/browse.py
+++ b/src/browse.py
@@ -182,7 +182,7 @@ class RequestHandler(httpserver.BaseHTTPRequestHandler):
def log_message(self, format, *args):
pass # Swallow console spam.
-port = 8000
+port = int(os.getenv("PORT", '8000'))
httpd = httpserver.HTTPServer(('',port), RequestHandler)
try:
hostname = socket.gethostname()