scons: Compatibility with Scons development version string
authorpal1000 <liviuprodea@yahoo.com>
Thu, 7 Mar 2019 08:38:10 +0000 (10:38 +0200)
committerJose Fonseca <jfonseca@vmware.com>
Tue, 12 Mar 2019 14:22:34 +0000 (14:22 +0000)
This ensures Mesa3D build doesn't fail in this case as encountered when
bisecting Scons source code while regression testing
https://bugs.freedesktop.org/show_bug.cgi?id=109443
and when testing 3.0.5.a.2

Technical details:
Scons version string has consistently been in this format:
MajorVersion.MinorVersion.Patch[.alpha/beta.yyyymmdd]
so these formulas should strip alpha/beta flags and return Scons version:

- as string - `'.'.join(SCons.__version__.split('.')[:3])`
- as tuple of integers - `tuple(map(int, SCons.__version__.split('.')[:3]))`

- v2: Fixed Scons version retrieval formulas as string and tuple of integers.
- v3: Fixed Scons version string format description.

Cc: "19.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
scons/custom.py
scons/gallium.py

index 09946fa73246c1956e09e08a616be6a584dcb6fa..8028990ef61b3a1af8f5de0f8697b13375d89d6b 100644 (file)
@@ -48,7 +48,12 @@ import source_list
 # a path directly. We want to support both, so we need to detect the SCons version,
 # for which no API is provided by SCons 8-P
 
 # a path directly. We want to support both, so we need to detect the SCons version,
 # for which no API is provided by SCons 8-P
 
-scons_version = tuple(map(int, SCons.__version__.split('.')))
+# Scons version string has consistently been in this format:
+# MajorVersion.MinorVersion.Patch[.alpha/beta.yyyymmdd]
+# so this formula should cover all versions regardless of type
+# stable, alpha or beta.
+# For simplicity alpha and beta flags are removed.
+scons_version = tuple(map(int, SCons.__version__.split('.')[:3]))
 
 def quietCommandLines(env):
     # Quiet command lines
 
 def quietCommandLines(env):
     # Quiet command lines
index efe32e06c6c99fcb8d52d8847e92c99c5282c6ad..61bbeb2399fbf1cd4694b12938455587b764ef6e 100755 (executable)
@@ -311,7 +311,14 @@ def generate(env):
     # Speed up dependency checking.  See
     # - https://github.com/SCons/scons/wiki/GoFastButton
     # - https://bugs.freedesktop.org/show_bug.cgi?id=109443
     # Speed up dependency checking.  See
     # - https://github.com/SCons/scons/wiki/GoFastButton
     # - https://bugs.freedesktop.org/show_bug.cgi?id=109443
-    scons_version = distutils.version.StrictVersion(SCons.__version__)
+
+    # Scons version string has consistently been in this format:
+    # MajorVersion.MinorVersion.Patch[.alpha/beta.yyyymmdd]
+    # so this formula should cover all versions regardless of type
+    # stable, alpha or beta.
+    # For simplicity alpha and beta flags are removed.
+
+    scons_version = distutils.version.StrictVersion('.'.join(SCons.__version__.split('.')[:3]))
     if scons_version < distutils.version.StrictVersion('3.0.2') or \
        scons_version > distutils.version.StrictVersion('3.0.4'):
         env.Decider('MD5-timestamp')
     if scons_version < distutils.version.StrictVersion('3.0.2') or \
        scons_version > distutils.version.StrictVersion('3.0.4'):
         env.Decider('MD5-timestamp')