[diffoscope] 01/01: diffoscope.tools: Add internal documentation for @tool_required decorator.
Chris Lamb
chris at chris-lamb.co.uk
Tue Mar 28 20:44:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch experimental
in repository diffoscope.
commit e77b9299efbfdf0f64d8fc81470b4f96d24ccb18
Author: Chris Lamb <lamby at debian.org>
Date: Tue Mar 28 21:44:54 2017 +0100
diffoscope.tools: Add internal documentation for @tool_required decorator.
Signed-off-by: Chris Lamb <lamby at debian.org>
---
diffoscope/tools.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/diffoscope/tools.py b/diffoscope/tools.py
index 15d7a60..2882b01 100644
--- a/diffoscope/tools.py
+++ b/diffoscope/tools.py
@@ -52,6 +52,16 @@ def tool_required(command):
def wrapper(fn):
@functools.wraps(fn)
def tool_check(*args, **kwargs):
+ """
+ Due to the way decorators are executed at import-time we defer the
+ execution of `find_executable` until we actually run the decorated
+ function (instead of prematurely returning a different version of
+ `tool_check`).
+
+ This ensures that any os.environ['PATH'] modifications are
+ performed prior to the `find_executable` tests.
+ """
+
if not find_executable(command):
raise RequiredToolNotFound(command)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the Reproducible-commits
mailing list