summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2016-04-09 19:57:16 -0700
committerEric S. Raymond <esr@thyrsus.com>2016-04-10 04:59:07 -0400
commit4ce87b1b589e6241553d20c72716954cdb415210 (patch)
treeb006eae040b42bb9c8dd228668ac322ee984aa25
parentf089f6d2dda9fa95bdf9b0e1e8ede9fa61ce087c (diff)
downloadgpsd-4ce87b1b589e6241553d20c72716954cdb415210.tar.gz
Makes "future imports" and Python version comments consistent.
This makes the "future import" statements consistently specify absolute_import, print_function, and division, for maximum consistency between Python 2 and Python 3. Although absolute_import is probably a don't care for top-level programs, if unit tests were ever implemented for the programs they would be imported as modules, making the module import behavior relevant. Note that previous Python 3 fixes are a prerequisite for this change. Also makes the "polyglot comment" consistent across sources. TESTED: Using a version of SConstruct patched to use the target Python for build helpers, ran "scons build-all check valgrind-audit www/hardware.html" with all six supported Python versions. Also ran gegps, gpscat, gpsprof, xgps, and xgpsspeed with both Python 2 and Python 3.
-rwxr-xr-xgegps5
-rw-r--r--gps/__init__.py4
-rw-r--r--gps/client.py2
-rwxr-xr-xgps/gps.py2
-rw-r--r--gpscap.py5
-rwxr-xr-xgpscat2
-rwxr-xr-xgpsfake2
-rwxr-xr-xgpsprof5
-rwxr-xr-xjsongen.py5
-rwxr-xr-xleapsecond.py5
-rwxr-xr-xmaskaudit.py5
-rwxr-xr-xtest_maidenhead.py2
-rwxr-xr-xvalgrind-audit.py4
-rwxr-xr-xxgps5
-rwxr-xr-xxgpsspeed5
15 files changed, 35 insertions, 23 deletions
diff --git a/gegps b/gegps
index 8ded4c95..2378cfce 100755
--- a/gegps
+++ b/gegps
@@ -20,8 +20,9 @@
# Modified by Chen Wei <weichen302@aol.com> for use with gpsd
# Cleaned up and adapted for the GPSD project by Eric S. Raymond.
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import print_function, division
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
import sys, os, getopt
import gps
diff --git a/gps/__init__.py b/gps/__init__.py
index 4292098e..553d30ea 100644
--- a/gps/__init__.py
+++ b/gps/__init__.py
@@ -2,7 +2,9 @@
#
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
-
+#
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
from __future__ import absolute_import # Ensure Python2 behaves like Python 3
api_major_version = 5 # bumped on incompatible changes
diff --git a/gps/client.py b/gps/client.py
index 70f0b347..88d8054f 100644
--- a/gps/client.py
+++ b/gps/client.py
@@ -1,7 +1,7 @@
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
#
-# This code run compatibly under Python 2 and 3.x for x >= 3.
+# This code run compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
from __future__ import absolute_import, print_function, division
diff --git a/gps/gps.py b/gps/gps.py
index 35a37074..bc66f7cb 100755
--- a/gps/gps.py
+++ b/gps/gps.py
@@ -15,7 +15,7 @@
# now live in a different module.
#
-# This code run compatibly under Python 2 and 3.x for x >= 3.
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
from __future__ import absolute_import, print_function, division
diff --git a/gpscap.py b/gpscap.py
index 32a854e0..84e8e985 100644
--- a/gpscap.py
+++ b/gpscap.py
@@ -4,8 +4,9 @@ gpscap - GPS/AIS capability dictionary class.
This file is Copyright (c) 2010 by the GPSD project
BSD terms apply: see the file COPYING in the distribution root for details.
"""
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import print_function
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
try:
import configparser
diff --git a/gpscat b/gpscat
index 53c3378e..0d8505e5 100755
--- a/gpscat
+++ b/gpscat
@@ -8,7 +8,7 @@
# This code runs compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
-from __future__ import print_function, division
+from __future__ import absolute_import, print_function, division
import os, sys, termios, socket, select, getopt, curses.ascii
import gps.packet as sniffer
diff --git a/gpsfake b/gpsfake
index f6874380..9a3f6f30 100755
--- a/gpsfake
+++ b/gpsfake
@@ -11,7 +11,7 @@
# This code runs compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
-from __future__ import print_function, division
+from __future__ import absolute_import, print_function, division
import getopt
import gps
diff --git a/gpsprof b/gpsprof
index 6ed691e1..5c9c52d6 100755
--- a/gpsprof
+++ b/gpsprof
@@ -6,8 +6,9 @@
# Collect and plot latency-profiling data from a running gpsd.
# Requires gnuplot.
#
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import print_function, division
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
import copy
import getopt
diff --git a/jsongen.py b/jsongen.py
index f42b4017..db1f27f5 100755
--- a/jsongen.py
+++ b/jsongen.py
@@ -8,8 +8,9 @@
# This code generates template declarations for AIS-JSON parsing from a
# declarative specification of a JSON structure.
#
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import print_function
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
import sys, getopt
diff --git a/leapsecond.py b/leapsecond.py
index e43f353d..2f0ce8fb 100755
--- a/leapsecond.py
+++ b/leapsecond.py
@@ -43,8 +43,9 @@ This file is Copyright (c) 2013 by the GPSD project
BSD terms apply: see the file COPYING in the distribution root for details.
"""
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import print_function, division
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
import os, re, random, time, calendar, math, sys, signal
diff --git a/maskaudit.py b/maskaudit.py
index cfa07785..20bc5d0a 100755
--- a/maskaudit.py
+++ b/maskaudit.py
@@ -9,8 +9,9 @@
#
# With -t, tabulate usage of defines to find unused ones. Requires -c or -d.
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import print_function
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
import getopt
import glob
diff --git a/test_maidenhead.py b/test_maidenhead.py
index 13b64475..707a05fb 100755
--- a/test_maidenhead.py
+++ b/test_maidenhead.py
@@ -9,7 +9,7 @@
# This code runs compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
-from __future__ import print_function
+from __future__ import absolute_import, print_function, division
import sys, gps.clienthelpers
diff --git a/valgrind-audit.py b/valgrind-audit.py
index caa56c0a..c674ef7f 100755
--- a/valgrind-audit.py
+++ b/valgrind-audit.py
@@ -7,7 +7,9 @@
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
#
-from __future__ import print_function
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
import sys, gps.fake
diff --git a/xgps b/xgps
index f9b986e7..2646e5f7 100755
--- a/xgps
+++ b/xgps
@@ -6,8 +6,9 @@ xgps -- test client for gpsd
usage: xgps [-D level] [-hV?] [-l degmfmt] [-u units] [server[:port[:device]]]
'''
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import print_function, division
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
gui_about = '''\
This is xgps, a test client for the gpsd daemon.
diff --git a/xgpsspeed b/xgpsspeed
index bba8ec4f..30954b2a 100755
--- a/xgpsspeed
+++ b/xgpsspeed
@@ -7,8 +7,9 @@
#
# BSD terms apply: see the file COPYING in the distribution root for details.
-# This code runs under both Python 2 and Python 3. Preserve this property!
-from __future__ import division
+# This code runs compatibly under Python 2 and 3.x for x >= 2.
+# Preserve this property!
+from __future__ import absolute_import, print_function, division
import gi
gi.require_version('Gtk', '3.0')