summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2019-06-07 19:47:34 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2019-06-07 19:47:34 +0100
commit59cacbcdc5c5bee6250e6461a1138f72e2271593 (patch)
treee7b5fa2174248f9c1e3f9ca4c7f23900b1fa89a3
parente357d7b89a048c53b068b0b10c20e954c17bcd69 (diff)
downloadlogutils-git-59cacbcdc5c5bee6250e6461a1138f72e2271593.tar.gz
Added environment check.
-rw-r--r--setup.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index f0891d6..86156ed 100644
--- a/setup.py
+++ b/setup.py
@@ -2,9 +2,34 @@
import distutils.core
import logutils
+import os
from os.path import join, dirname, abspath
import re
+def missing_files():
+ result = []
+ if os.name == 'nt':
+
+ def found_file(fn):
+ if os.path.exists(fn):
+ return True
+ for d in os.environ['PATH'].split(os.pathsep):
+ p = os.path.join(d, fn)
+ if os.path.exists(p):
+ return True
+ return False
+
+ FILES = ('cat.exe', 'echo.exe', 'tee.exe', 'false.exe', 'true.exe',
+ 'sleep.exe', 'touch.exe')
+ if 'APPVEYOR' not in os.environ:
+ FILES = ('libiconv2.dll', 'libintl3.dll') + FILES
+
+ missing = []
+ for fn in FILES:
+ if not found_file(fn):
+ result.append(fn)
+ return result
+
def description():
f = open(join(dirname(__file__), 'README.rst'))
@@ -20,6 +45,13 @@ class TestCommand(distutils.core.Command):
user_options = []
def run(self):
+ missing = missing_files()
+
+ if missing:
+ missing = ', '.join(missing)
+ raise ValueError('Can\'t find one or more files needed for '
+ 'tests: %s' % missing)
+
import sys
import unittest