From de645b5b6e0bc04dd133b69e6b0d2004e65fdc1f Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Wed, 5 Dec 2012 17:41:54 +0100
Subject: [PATCH] Makefile: Reset environment for epydoc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

epydoc allows overriding configuration values via environment variables.
While this might be useful in certain use cases, but as no prefix
whatsoever is used, conflicts are easily created. Some people have the
environment variable β€œNAME” set, effectively overriding the project name
set in epydoc.conf. A bug in epydoc causes an error if non-ASCII
characters, such as German umlauts, are used in NAME.

$ NAME=TΓ€scht make py-apidoc
[…]
UNEXPECTED ERROR:
'ascii' codec can't decode byte 0xc3 in position 73: ordinal not in range(128)

$ parse=false make py-apidoc
[…]
epydoc: error: Invalid option combination: --parse-only and --introspect-only.

This patch changes the call in Makefile to reset the environment given
to epydoc save for PATH and PYTHONPATH.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.am b/Makefile.am
index dfd83700f..24f6f22ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1631,6 +1631,7 @@ endif
 
 .PHONY: py-apidoc
 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
+	env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
 	$(RUN_IN_TEMPDIR) epydoc -v \
 	  --conf $(CURDIR)/epydoc.conf \
 	  --output $(CURDIR)/$(APIDOC_PY_DIR)
-- 
GitLab