[diffoscope] 02/05: Ensure tests and the runtime environment can locate binaries in /usr/sbin (eg. tcpdump)
Chris Lamb
chris at chris-lamb.co.uk
Tue Mar 28 19:40:19 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 2c62e89af575dcae6d0336aae57d55a9eb28dedd
Author: Chris Lamb <lamby at debian.org>
Date: Tue Mar 28 20:15:08 2017 +0100
Ensure tests and the runtime environment can locate binaries in /usr/sbin (eg. tcpdump)
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 8419710..d03e248 100644
--- a/diffoscope/tools.py
+++ b/diffoscope/tools.py
@@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
+import os
import collections
import platform
import functools
@@ -37,6 +38,15 @@ OS_NAMES = collections.OrderedDict([
('FreeBSD', 'FreeBSD'),
])
+# Ensure tests and the runtime environment can locate binaries in /usr/sbin
+# (eg. tcpdump). We must modify the path before the @tool_required decorator is
+# applied.
+pathlist = os.environ['PATH'].split(os.pathsep)
+for x in ('/sbin', '/usr/sbin', '/usr/local/sbin'):
+ if x not in pathlist:
+ pathlist.append(x)
+os.environ['PATH'] = os.pathsep.join(pathlist)
+
def tool_required(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