aboutsummaryrefslogtreecommitdiff
path: root/environment.py
diff options
context:
space:
mode:
Diffstat (limited to 'environment.py')
-rw-r--r--environment.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/environment.py b/environment.py
index 3253295..f7f42e1 100644
--- a/environment.py
+++ b/environment.py
@@ -532,6 +532,26 @@ def is_osx():
def is_windows():
return platform.system().lower() == 'windows'
+def is_debianlike():
+ try:
+ open('/etc/debian_version', 'r')
+ return True
+ except FileNotFoundError:
+ return False
+
+def detect_ninja():
+ for n in ['ninja', 'ninja-build']:
+ # Plain 'ninja' or 'ninja -h' yields an error
+ # code. Thanks a bunch, guys.
+ try:
+ p = subprocess.Popen([n, '-t', 'list'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ except FileNotFoundError:
+ continue
+ p.communicate()
+ if p.returncode == 0:
+ return n
+
+
header_suffixes = ['h', 'hh', 'hpp', 'hxx', 'H']
cpp_suffixes = ['cc', 'cpp', 'cxx', 'hh', 'hpp', 'hxx']
c_suffixes = ['c']