summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL2
-rw-r--r--SConstruct17
-rw-r--r--man/ubxtool.xml1
-rw-r--r--man/zerk.xml3
-rwxr-xr-xubxtool15
-rwxr-xr-xzerk15
6 files changed, 23 insertions, 30 deletions
diff --git a/INSTALL b/INSTALL
index 90d86cd2..bcf97da1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -96,7 +96,7 @@ various additional features have additional prerequisites:
|Qt + qmake | libQgpsmm depends on this
|python2.x(x>=6) or 3.y(y>=2) | required for various clients and utilities
|python-GI bindings | the test clients xgps and xgpsspeed, need this
-|pyserial | ubxtool and zerk need this
+|pyserial | for ubxtool and zerk in direct-serial mode
|===============================================================================
Some ncurses packages contain the terminfo library; some break it out
diff --git a/SConstruct b/SConstruct
index 124814f6..b354feda 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1457,7 +1457,7 @@ if not env['python']:
python_targets = []
else:
# installed python programs
- python_progs = ["gegps", "gpscat", "gpsfake", "gpsprof"]
+ python_progs = ["gegps", "gpscat", "gpsfake", "gpsprof", "ubxtool", "zerk"]
python_deps = {'gpscat': 'packet'}
# python misc helpers and stuff
@@ -1479,21 +1479,10 @@ else:
"man/gpscat.1": "man/gpscat.xml",
"man/gpsfake.1": "man/gpsfake.xml",
"man/gpsprof.1": "man/gpsprof.xml",
+ "man/ubxtool.1": "man/ubxtool.xml",
+ "man/zerk.1": "man/zerk.xml",
}
- # check for pyserial
- try:
- imp.find_module('serial')
- python_progs.extend(["ubxtool", "zerk"])
- python_manpages.update({
- "man/ubxtool.1": "man/ubxtool.xml",
- "man/zerk.1": "man/zerk.xml",
- })
- except ImportError:
- # no pyserial, reduced functionality in ubxtool and zerk
- announce("WARNING: Python module serial (pyserial) not found.\n"
- " ubxtool and zerk will not be installed")
-
if env['xgps']:
# check for pycairo
try:
diff --git a/man/ubxtool.xml b/man/ubxtool.xml
index fa69e9aa..47020e3e 100644
--- a/man/ubxtool.xml
+++ b/man/ubxtool.xml
@@ -170,6 +170,7 @@ is to enable the option.
<para>Connect to a file or device. Accepts one parameter, FILE,
the file or device to open. Files are opened read-only. Character
devices are opened read/write, unless the -r parameter is given.
+Requires the pyserial module.
</para>
</listitem>
</varlistentry>
diff --git a/man/zerk.xml b/man/zerk.xml
index e82d5c71..cf9d3319 100644
--- a/man/zerk.xml
+++ b/man/zerk.xml
@@ -192,7 +192,8 @@ same OPTIONs as -d, except the action is to enable the option.
<listitem>
<para>Connect to a file or device. Accepts one parameter, FILE,
the file or device to open. Files are opened read-only. Character
-devices are opened red/write, unless the -r parameter is given.
+devices are opened read/write, unless the -r parameter is given.
+Requires the pyserial module.
</para>
</listitem>
</varlistentry>
diff --git a/ubxtool b/ubxtool
index 929e033a..f8732136 100755
--- a/ubxtool
+++ b/ubxtool
@@ -44,9 +44,7 @@ PROG_NAME = 'ubxtool'
try:
import serial
except ImportError:
- # treat serial as special since it is not part of standard Python
- sys.stderr.write("%s: failed to import pyserial\n" % PROG_NAME)
- sys.exit(2)
+ serial = None # Defer complaining until we know we need it.
try:
import gps
@@ -2159,11 +2157,11 @@ class gps_io(object):
ser = None
input_is_device = False
- def __init__(self, serial_class):
+ def __init__(self):
"Initialize class"
- Serial = serial_class
- Serial_v3 = Serial.VERSION.split('.')[0] >= '3'
+ Serial = serial
+ Serial_v3 = Serial and Serial.VERSION.split('.')[0] >= '3'
# buffer to hold read data
self.out = b''
@@ -2238,6 +2236,9 @@ class gps_io(object):
timeout=0.05,
**{write_timeout_arg: 0.5}
)
+ except AttributeError:
+ sys.stderr.write('%s: failed to import pyserial\n' % PROG_NAME)
+ sys.exit(2)
except Serial.serialutil.SerialException:
# this exception happens on bad serial port device name
sys.stderr.write('%s: failed to open serial port "%s"\n'
@@ -2546,7 +2547,7 @@ try:
sys.exit(1)
# create the I/O instance
- io_handle = gps_io(serial)
+ io_handle = gps_io()
sys.stdout.flush()
diff --git a/zerk b/zerk
index 9041b123..ef6cef80 100755
--- a/zerk
+++ b/zerk
@@ -52,9 +52,7 @@ PROG_NAME = 'zerk'
try:
import serial
except ImportError:
- # treat serial as special since it is not part of standard Python
- sys.stderr.write("%s: failed to import pyserial\n" % PROG_NAME)
- sys.exit(2)
+ serial = None # Defer complaining until we know we need it.
try:
import gps
@@ -1458,11 +1456,11 @@ class gps_io(object):
ser = None
input_is_device = False
- def __init__(self, serial_class):
+ def __init__(self):
"Initialize class"
- Serial = serial_class
- Serial_v3 = Serial.VERSION.split('.')[0] >= '3'
+ Serial = serial
+ Serial_v3 = Serial and Serial.VERSION.split('.')[0] >= '3'
# buffer to hold read data
self.out = b''
@@ -1536,6 +1534,9 @@ class gps_io(object):
timeout=0.05,
**{write_timeout_arg: 0.5}
)
+ except AttributeError:
+ sys.stderr.write('%s: failed to import pyserial\n' % PROG_NAME)
+ sys.exit(2)
except Serial.serialutil.SerialException:
# this exception happens on bad serial port device name
sys.stderr.write('%s: failed to open serial port "%s"\n'
@@ -1853,7 +1854,7 @@ try:
sys.exit(1)
# create the I/O instance
- io_handle = gps_io(serial)
+ io_handle = gps_io()
# keep it simple, only one of -O, -c -d -e or -S
if opts['oaf_name'] is not None: