summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-09-21 17:48:14 -0700
committerGary E. Miller <gem@rellim.com>2018-09-21 17:50:00 -0700
commit3480625b7ef19161ba7f96cd20b5dd9f93750540 (patch)
treea7ba702273c7e8eade0d99cf32b1059f4d85cda1 /SConstruct
parenta4710779e21895d4072531249b1e5101374cf421 (diff)
downloadgpsd-3480625b7ef19161ba7f96cd20b5dd9f93750540.tar.gz
SConstruct: pep8 cleanup, no functional change.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct137
1 files changed, 68 insertions, 69 deletions
diff --git a/SConstruct b/SConstruct
index 7ba2fa8a..71dd86e2 100644
--- a/SConstruct
+++ b/SConstruct
@@ -31,6 +31,24 @@
# Python requires this to precede any non-comment code.
from __future__ import print_function
+import ast
+import copy
+import glob
+import operator
+import os
+import platform
+import re
+# replacement for functions from the commands module, which is deprecated.
+import subprocess
+import sys
+import time
+from distutils import sysconfig
+from distutils.util import get_platform
+from functools import reduce
+import SCons
+
+from leapsecond import conditional_leapsecond_fetch
+
# Release identification begins here
gpsd_version = "3.18~dev"
@@ -73,21 +91,6 @@ webupload = "login.ibiblio.org:/public/html/catb/gpsd"
EnsureSConsVersion(2, 3, 0)
-import ast
-import copy
-import glob
-import operator
-import os
-import platform
-import re
-# replacement for functions from the commands module, which is deprecated.
-import subprocess
-import sys
-import time
-from distutils import sysconfig
-from distutils.util import get_platform
-from functools import reduce
-import SCons
PYTHON_SYSCONFIG_IMPORT = 'from distutils import sysconfig'
@@ -190,7 +193,7 @@ boolopts = (
("qt", True, "build QT bindings"),
# Daemon options
("controlsend", True, "allow gpsctl/gpsmon to change device settings"),
- ("nofloats", False, "float ops are expensive, suppress error estimates"),
+ ("nofloats", False, "float ops are expensive, suppress error estimates"),
("reconfigure", True, "allow gpsd to change device settings"),
("squelch", False, "squelch gpsd_log/gpsd_hexdump to save cpu"),
# Build control
@@ -290,15 +293,14 @@ if ARGUMENTS.get('minimal'):
for (name, default, help) in boolopts:
# Ensure gpsd and gpsdclients are always enabled unless explicitly
# turned off.
- if ((default is True
- and not ARGUMENTS.get(name)
- and not (name is "gpsd" or name is "gpsdclients"))):
+ if ((default is True and
+ not ARGUMENTS.get(name) and
+ not (name is "gpsd" or name is "gpsdclients"))):
env[name] = False
# Time-service build = stripped-down with some diagnostic tools
if ARGUMENTS.get('timeservice'):
- timerelated = (
- "gpsd",
+ timerelated = ("gpsd",
"ipv6",
"magic_hat",
"mtk3301", # For the Adafruit HAT
@@ -312,9 +314,9 @@ if ARGUMENTS.get('timeservice'):
"ublox", # For the Uputronics board
)
for (name, default, help) in boolopts:
- if ((default is True
- and not ARGUMENTS.get(name)
- and name not in timerelated)):
+ if ((default is True and
+ not ARGUMENTS.get(name) and
+ name not in timerelated)):
env[name] = False
# NTPSHM requires NTP
@@ -655,8 +657,8 @@ else:
# OS X aliases gcc to clang
# clang accepts -pthread, then warns it is unused.
- if ((config.CheckCompilerOption("-pthread")
- and not sys.platform.startswith('darwin'))):
+ if ((config.CheckCompilerOption("-pthread") and
+ not sys.platform.startswith('darwin'))):
env.MergeFlags("-pthread")
confdefs = ["/* gpsd_config.h generated by scons, do not hand-hack. */\n"]
@@ -768,8 +770,8 @@ else:
confdefs.append("typedef unsigned short int in_port_t;\n")
# SUN_LEN is not defined on Android
- if ((not config.CheckDeclaration("SUN_LEN", "#include <sys/un.h>")
- and not config.CheckDeclaration("SUN_LEN", "#include <linux/un.h>"))):
+ if ((not config.CheckDeclaration("SUN_LEN", "#include <sys/un.h>") and
+ not config.CheckDeclaration("SUN_LEN", "#include <linux/un.h>"))):
announce("SUN_LEN is not system-defined, using local definition")
confdefs.append("#ifndef SUN_LEN\n")
confdefs.append("#define SUN_LEN(ptr) "
@@ -787,9 +789,9 @@ else:
# check for C11 or better, and __STDC__NO_ATOMICS__ is not defined
# before looking for stdatomic.h
- if ((config.CheckC11()
- and not config.CheckCompilerDefines("__STDC_NO_ATOMICS__")
- and config.CheckHeader("stdatomic.h"))):
+ if ((config.CheckC11() and
+ not config.CheckCompilerDefines("__STDC_NO_ATOMICS__") and
+ config.CheckHeader("stdatomic.h"))):
confdefs.append("#define HAVE_STDATOMIC_H 1\n")
else:
confdefs.append("/* #undef HAVE_STDATOMIC_H */\n")
@@ -978,6 +980,7 @@ def polystr(o):
return str(o, encoding='latin-1')
raise ValueError
+
if helping:
# If helping just get usable config info from the local Python
@@ -1162,8 +1165,9 @@ if not env["shared"]:
return env.StaticLibrary(target,
[env.StaticObject(s) for s in sources],
parse_flags=parse_flags)
- LibraryInstall = lambda env, libdir, sources, version: \
- env.Install(libdir, sources)
+
+ def LibraryInstall(env, libdir, sources, version):
+ return env.Install(libdir, sources)
else:
def Library(env, target, sources, version, parse_flags=[]):
# Note: We have a possibility of getting either Object or file
@@ -1179,8 +1183,9 @@ else:
source=obj_list,
parse_flags=parse_flags,
SHLIBVERSION=version)
- LibraryInstall = lambda env, libdir, sources, version: \
- env.InstallVersionedLib(libdir, sources, SHLIBVERSION=version)
+
+ def LibraryInstall(env, libdir, sources, version):
+ return env.InstallVersionedLib(libdir, sources, SHLIBVERSION=version)
compiled_gpslib = Library(env=env,
target="gps",
@@ -1237,8 +1242,8 @@ gpsdflags = usbflags + bluezflags + gpsflags
gpsd_sources = [
'dbusexport.c',
- 'gpsd.c',
- 'shmexport.c',
+ 'gpsd.c',
+ 'shmexport.c',
'timehint.c'
]
@@ -1366,8 +1371,7 @@ else:
# Build Python binding
#
python_extensions = {
- "gps" + os.sep + "packet": [
- "crc24q.c",
+ "gps" + os.sep + "packet": ["crc24q.c",
"driver_greis_checksum.c",
"driver_rtcm2.c",
"gpspacket.c",
@@ -1376,8 +1380,7 @@ else:
"os_compat.c",
"packet.c",
],
- "gps" + os.sep + "clienthelpers": [
- "geoid.c",
+ "gps" + os.sep + "clienthelpers": ["geoid.c",
"gpsclient.c",
"gpsdclient.c",
"os_compat.c",
@@ -1402,8 +1405,8 @@ else:
if python_config['CC'].split()[0] != env['CC']:
python_env['CCFLAGS'] = ''
else:
- python_env['CC'] = (' '.join([env['CC']]
- + python_config['CC'].split()[1:]))
+ python_env['CC'] = (' '.join([env['CC']] +
+ python_config['CC'].split()[1:]))
if env['CXX'] is None or env['CXX'].find('scan-build') < 0:
python_env['CXX'] = python_config['CXX']
# As we seem to be changing compilers we must assume that the
@@ -1414,8 +1417,8 @@ else:
python_env['CCFLAGS'] = ''
python_env['CXXFLAGS'] = ''
else:
- python_env['CXX'] = (' '.join([env['CXX']]
- + python_config['CXX'].split()[1:]))
+ python_env['CXX'] = (' '.join([env['CXX']] +
+ python_config['CXX'].split()[1:]))
ldshared = python_config['LDSHARED']
ldshared = ldshared.replace('-fPIE', '')
@@ -1438,9 +1441,9 @@ else:
python_objects[ext].append(
python_env.NoCache(
python_env.SharedObject(
- src.split(".")[0] + '-py_'
- + '_'.join(['%s' % (x) for x in sys.version_info])
- + python_config['SO'], src
+ src.split(".")[0] + '-py_' +
+ '_'.join(['%s' % (x) for x in sys.version_info]) +
+ python_config['SO'], src
)
)
)
@@ -1548,7 +1551,6 @@ env.Textfile(target="revision.h", source=[revision])
# leapseconds.cache is a local cache for information on leapseconds issued
# by the U.S. Naval observatory. It gets kept in the repository so we can
# build without Internet access.
-from leapsecond import conditional_leapsecond_fetch
def leapseconds_cache_rebuild(target, source, env):
@@ -1686,7 +1688,8 @@ if man_env.GetOption('silent'):
man_env['SPAWN'] = filtered_spawn # Suppress stderr chatter
manpage_targets = []
if manbuilder:
- for (man, xml) in list(base_manpages.items()) + list(python_manpages.items()):
+ items = list(base_manpages.items()) + list(python_manpages.items())
+ for (man, xml) in items:
manpage_targets.append(man_env.Man(source=xml, target=man))
# Where it all comes together
@@ -1730,8 +1733,8 @@ if qt_env:
binaryinstall.append(LibraryInstall(qt_env, installdir('libdir'),
compiled_qgpsmmlib, libgps_version))
-if ((not env['debug'] and not env['profiling'] and not env['nostrip']
- and not sys.platform.startswith('darwin'))):
+if ((not env['debug'] and not env['profiling'] and not env['nostrip'] and
+ not sys.platform.startswith('darwin'))):
env.AddPostAction(binaryinstall, '$STRIP $TARGET')
if not env['python']:
@@ -1740,8 +1743,8 @@ else:
python_module_dir = str(python_libdir) + os.sep + 'gps'
python_extensions_install = python_env.Install(DESTDIR + python_module_dir,
python_built_extensions)
- if ((not env['debug'] and not env['profiling']
- and not env['nostrip'] and not sys.platform.startswith('darwin'))):
+ if ((not env['debug'] and not env['profiling'] and
+ not env['nostrip'] and not sys.platform.startswith('darwin'))):
python_env.AddPostAction(python_extensions_install, '$STRIP $TARGET')
python_modules_install = python_env.Install(DESTDIR + python_module_dir,
@@ -1773,8 +1776,8 @@ for manpage in list(base_manpages.keys()) + list(python_manpages.keys()):
section = manpage.split(".")[1]
dest = os.path.join(installdir('mandir'), "man" + section, manpage)
maninstall.append(env.InstallAs(source=manpage, target=dest))
-install = env.Alias('install', binaryinstall + maninstall + python_install
- + pc_install + headerinstall)
+install = env.Alias('install', binaryinstall + maninstall + python_install +
+ pc_install + headerinstall)
def Uninstall(nodes):
@@ -1835,8 +1838,8 @@ Utility("scan-build", ["gpsd.h", "packet_names.h"],
"scan-build scons")
# Sanity-check Python code.
-# Bletch. We don't really want to suppress W0231 E0602 E0611 E1123, but Python 3
-# syntax confuses a pylint running under Python 2.
+# Bletch. We don't really want to suppress W0231 E0602 E0611 E1123,
+# but Python 3 syntax confuses a pylint running under Python 2.
if len(python_progs) > 0:
checkable = python_progs[:]
# Theres's an internal error in astroid that requires we disable some
@@ -1856,8 +1859,7 @@ if len(python_progs) > 0:
'''W0121,W0123,W0231,W0232,W0234,W0401,W0403,W0141,W0142,W0603,'''
'''W0614,W0640,W0621,W1504,E0602,E0611,E1101,E1102,E1103,E1123,'''
'''F0401,I0011 '''
- '''gps/*.py *.py '''
- + " ".join(checkable)])
+ '''gps/*.py *.py ''' + " ".join(checkable)])
# Additional Python readability style checks
if len(python_progs) > 0:
@@ -1917,9 +1919,9 @@ if env['python']:
'%s -tt -m py_compile tmp.py' % (sys.executable, )
'rm -f tmp.py tmp.pyc'
python_compilation_regress = Utility('python-compilation-regress',
- Glob('*.py') + python_modules
- + python_progs
- + ['SConstruct'], check_compile)
+ Glob('*.py') + python_modules +
+ python_progs + ['SConstruct'],
+ check_compile)
else:
python_compilation_regress = None
@@ -1971,8 +1973,7 @@ else:
for gps_name, gps_log in zip(gps_names, gps_logs):
gps_rebuilds.append(Utility('gps-makeregress-' + gps_name, gps_herald,
'$SRCDIR/regress-driver -bq -o -t '
- '$REGRESSOPTS '
- + gps_log))
+ '$REGRESSOPTS ' + gps_log))
if GetOption('num_jobs') <= 1:
Utility('gps-makeregress', gps_herald,
'$SRCDIR/regress-driver -b $REGRESSOPTS %s' % gps_log_pattern)
@@ -2206,8 +2207,7 @@ Utility('shmclean', [], ["ipcrm -M 0x4e545030;"
# asciidoc documents
if env.WhereIs('asciidoc'):
- txtfiles = [
- 'AIVDM',
+ txtfiles = ['AIVDM',
'client-howto',
'gpsd-time-service-howto',
'NMEA',
@@ -2420,8 +2420,7 @@ else:
env.Default(build)
# Tags for Emacs and vi
-misc_sources = [
- 'cgps.c',
+misc_sources = ['cgps.c',
'gps2udp.c',
'gpsctl.c',
'gpsdctl.c',