gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH] Fixes SConstruct clean/help/minimal bugs from commit


From: Fred Wright
Subject: [gpsd-dev] [PATCH] Fixes SConstruct clean/help/minimal bugs from commit 1c26179.
Date: Sat, 9 Apr 2016 14:36:37 -0700

Because the new Python config setup wasn't being run in the cleaning
or helping cases, certain variables that were still being referenced
weren't being defined, causing scons to crash.  There are two
different cases:

1) In the cleaning case, it's actually necessary to run the Python
config code, because some of the filenames to be cleaned may be
affected by the config values.  This reworks things to run that
portion of the config section even in the cleaning case, though with a
slight tweak to make a couple of the messages less verbose.

2) In the helping case, nothing related to building is actually
needed, but providing valid values is easier than fixing all the
places that need them.  To avoid having to run a possible external
target Python, it obtains the values unconditionally from the scons
Python in this case.

Also, the minimal build was broken due to a couple of lines of code
being inappropriately included in the python=no case.  That is now
fixed as well.

TESTED:
Ran "scons build-all check", "scons -c" and "scons -h", with and
without a target_python specified, and with and without minimal=yes.
All cases work, and no "cleaning leaks" were observed.  Also ran the
broken-build checker up through length 1, seeing only the two
long-standing failures, plus two (relatively) new ones that are almost
certainly unrelated to this change.
---
 SConstruct | 58 +++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 21 deletions(-)

diff --git a/SConstruct b/SConstruct
index 5e4d82a..f33f5b1 100644
--- a/SConstruct
+++ b/SConstruct
@@ -526,6 +526,14 @@ def GetLoadPath(context):
 cleaning = env.GetOption('clean')
 helping = env.GetOption('help')
 
+config = Configure(env, custom_tests={'CheckPKG': CheckPKG,
+                                      'CheckXsltproc': CheckXsltproc,
+                                      'CheckCompilerOption': 
CheckCompilerOption,
+                                      'CheckCompilerDefines': 
CheckCompilerDefines,
+                                      'CheckC11': CheckC11,
+                                      'CheckHeaderDefines': CheckHeaderDefines,
+                                      'GetPythonValue': GetPythonValue})
+
 if cleaning or helping:
     dbusflags = []
     rtlibs = []
@@ -536,13 +544,6 @@ if cleaning or helping:
     manbuilder = False
     htmlbuilder = False
 else:
-    config = Configure(env, custom_tests={'CheckPKG': CheckPKG,
-                                          'CheckXsltproc': CheckXsltproc,
-                                          'CheckCompilerOption': 
CheckCompilerOption,
-                                          'CheckCompilerDefines': 
CheckCompilerDefines,
-                                          'CheckC11': CheckC11,
-                                          'CheckHeaderDefines': 
CheckHeaderDefines,
-                                          'GetPythonValue': GetPythonValue})
 
     # If supported by the compiler, enable all warnings except uninitialized 
and
     # missing-field-initializers, which we can't help triggering because
@@ -858,15 +859,24 @@ int clock_gettime(clockid_t, struct timespec *);
             env["qt"] = False
             announce('Turning off Qt support, library not found.')
 
-    # Set up configuration for target Python
+# Set up configuration for target Python
+
+PYTHON_LIBDIR_CALL = 'sysconfig.get_python_lib()'
 
-    PYTHON_LIBDIR_CALL = 'sysconfig.get_python_lib()'
+PYTHON_CONFIG_NAMES = ['CC', 'CXX', 'OPT', 'BASECFLAGS',
+                       'CCSHARED', 'LDSHARED', 'SO', 'INCLUDEPY', 'LDFLAGS']
+PYTHON_CONFIG_QUOTED = ["'%s'" % s for s in PYTHON_CONFIG_NAMES]
+PYTHON_CONFIG_CALL = ('sysconfig.get_config_vars(%s)'
+                      % ', '.join(PYTHON_CONFIG_QUOTED))
 
-    PYTHON_CONFIG_NAMES = ['CC', 'CXX', 'OPT', 'BASECFLAGS',
-                           'CCSHARED', 'LDSHARED', 'SO', 'INCLUDEPY', 
'LDFLAGS']
-    PYTHON_CONFIG_QUOTED = ["'%s'" % s for s in PYTHON_CONFIG_NAMES]
-    PYTHON_CONFIG_CALL = ('sysconfig.get_config_vars(%s)'
-                          % ', '.join(PYTHON_CONFIG_QUOTED))
+if helping:
+
+    # If helping just get usable config info from the local Python
+    target_python_path = ''
+    py_config_text = str(eval(PYTHON_CONFIG_CALL))
+    python_libdir = str(eval(PYTHON_LIBDIR_CALL))
+
+else:
 
     if env['python'] and env['target_python']:
         target_python_path = config.CheckProg(env['target_python'])
@@ -877,25 +887,31 @@ int clock_gettime(clockid_t, struct timespec *);
         # Maximize consistency by using the reported sys.executable
         target_python_path = config.GetPythonValue('exe path',
                                                    'import sys',
-                                                   'sys.executable')
+                                                   'sys.executable',
+                                                   brief=cleaning)
         if env['python_libdir']:
             python_libdir = env['python_libdir']
         else:
             python_libdir = config.GetPythonValue('lib dir',
                                                   PYTHON_SYSCONFIG_IMPORT,
-                                                  PYTHON_LIBDIR_CALL)
+                                                  PYTHON_LIBDIR_CALL,
+                                                  brief=cleaning)
         py_config_text = config.GetPythonValue('config vars',
                                                    PYTHON_SYSCONFIG_IMPORT,
                                                    PYTHON_CONFIG_CALL,
                                                    brief=True)
-        py_config_vars =  ast.literal_eval(py_config_text)
-        py_config_vars = [[] if x is None else x for x in py_config_vars]
-        python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars))
+
+if env['python']:  # May have been turned off by error
     env['PYTHON'] = target_python_path
-    env['ENV']['PYTHON'] = target_python_path  # Also pass it to regress-driver
+    env['ENV']['PYTHON'] = target_python_path  # For regress-driver
+    py_config_vars =  ast.literal_eval(py_config_text)
+    py_config_vars = [[] if x is None else x for x in py_config_vars]
+    python_config = dict(zip(PYTHON_CONFIG_NAMES, py_config_vars))
+
 
+env = config.Finish()
 
-    env = config.Finish()
+if not (cleaning or helping):
 
     # Be explicit about what we're doing.
     changelatch = False
-- 
2.8.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]