Buildbot: Allow building on systems without scl
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 30 Jan 2020 12:04:58 +0000 (13:04 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 30 Jan 2020 12:32:22 +0000 (13:32 +0100)
Makes it easier to verify changes on local machine without scl
before committing changes to repo.

build_files/buildbot/buildbot_utils.py

index eded6646671c99e7a2268a3ad0a57d1c3d8271ce..b99fab7882735813f97f6d54a42ab41517c8d9a8 100644 (file)
@@ -24,6 +24,14 @@ import re
 import subprocess
 import sys
 
+def is_tool(name):
+    """Check whether `name` is on PATH and marked as executable."""
+
+    # from whichcraft import which
+    from shutil import which
+
+    return which(name) is not None
+
 class Builder:
     def __init__(self, name, branch):
         self.name = name
@@ -42,7 +50,10 @@ class Builder:
             self.command_prefix =  []
         elif name.startswith('linux'):
             self.platform = 'linux'
-            self.command_prefix =  ['scl', 'enable', 'devtoolset-6', '--']
+            if is_tool('scl'):
+                self.command_prefix =  ['scl', 'enable', 'devtoolset-6', '--']
+            else:
+                self.command_prefix =  []
         elif name.startswith('win'):
             self.platform = 'win'
             self.command_prefix =  []