| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python 3 renames the iterator next() method to __next__(). Without
the new name, attempting to use the object as an iterator doesn't
work. This didn't surface until trying webgps.py.
For compatibility with both Python 2 and Python 3, both names need to
be provided. This change renames the existing method to conformto
Python 3 naming, and then adds a wrapper to provide the old name for
Python 2.
TESTED:
Ran webgps.py (with uncommitted fixes) with both Python 2 and Python
3.
|
|
|
|
|
|
| |
TESTED:
Ran "scons check". Note that this doesn't test the actual change,
since the exception in question is only used in certain error cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This doesn't really change any behavior, but serves as a better
example for future code. Note that this can't be done so easily for
gps.gps, due to the mismatched init signatures.
This uses the older super() syntax, which is compatible with both
Python 2 and Python 3.
TESTED:
Ran "scons build-all check" with all six supported Python versions.
Also tested exception objects manually.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although this isn't strictly a Python 3 requirement, using the
new-style class definition syntax improves consistency between Python
2 and Python 3. Old-style classes have been deprecated since Python
2.2, but many such definitions linger on. Python 3 eliminates
old-style classes, but instead of complaining about old-style
definitions, it simply unconditionally and silently makes all classes
new-style. The only incompatible differences are quite subtle and
rarely matter in practice, but things are more consistent across
versions if the new-style definitions are used.
Also, the preferred method for subclasses to invoke parent init
methods is via the super() construct, which is only available with
new-style classes. Using super() is especially useful with multiple
inheritance, which it handles automatically (provided that the init
methods have compatible signatures).
TESTED:
Ran "scons build-all check valgrind-audit", as well as gegps, gpscat,
gpsprof, xgps, and xgpsspeed, with all six supported Python versions
(except 2.6 for xgps*).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
TESTED:
Ran "scons check" with both Python 2 and Python 3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This incorporates the following changes:
1) Adds definitions for polystr(), polybytes(), and make_std_wrapper()
to misc.py (the most logical place for code needed by multiple
modules), using dummy definitions in the Python 2 case. For more
info, see the Practical Python Porting guide.
2) Reworks the logfile->daemon data path in fake.py to use 'bytes'
consistently.
3) Uses polybytes() in fake.py to construct control-socket commands as
'bytes', as expected by the socket I/O.
4) Uses make_std_wrapper() in gpsfake, to ensure that binary data is
correctly written to stdout.
5) Adds 'division' to the future imports in gpsfake for consistency,
though it doesn't actually matter in practice.
Also updates the compatibility comments in all three files, and fixes
a minor typo in misc.py.
TESTED:
Ran "scons build-all check" with Python 2.7, and ran all daemon
regression tests with Python 2.6 and with Python 3.2-3.5 (with
appropriately built extensions; not yet a build option).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using isinstance() rather than type() == is preferable for a few
reasons:
1) It's generally considered more pythonic.
2) Referring to types by name is a bit more readable than applying
type() to sample values.
3) Both 'str' and the Python 2 'unicode' type can be checked in a
single call.
4) Since the 'str' type check was the only use of a Unicode literal in
the common code, changing this eliminates Python 3.2 incompatibility.
In Python 2, both 'str' and 'unicode' are derived from the abstract
'basestring' class. In Python 3, 'unicode' has been folded into
'str', and the latter is itself the base class. Thus, an import-time
conditional is used to set up the proper STR_CLASS for comparison.
TESTED:
Ran "scons build-all check" (with Python 2.7). Also verified that the
regression tests and test_maidenhead.py run with Python 2.6, and that
gpsfake -T and test_maidenhead.py run with Python 3.2-3.5 when the
extensions are built for Python 3 (not yet a build option). Also
verified that xgps and xgpsspeed work with 2.7 and 3.2-3.5 (with
a pending fix to xgps for 3.2).
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Python 3, exception objects are local to the try/except block,
making them inaccessible outside that block. It was probably actually
an error to set the "message" to be the exception object rather than
its string representation, anyway.
TESTED:
Ran xgps without gpsd running, and verified that the proper error box
is displayed, in both Python 2 and Python 3 (with appropriate builds
of the extensions).
|
|
|
|
|
|
|
|
|
|
|
|
| |
This ensures that any future changes that accidentally rely on the
Python 2 implicit relative import behavior will fail in Python 2 as
well as Python 3.
TESTED:
Ran "scons build-all check" (with Python 2.7). Also verified that the
regression tests and test_maidenhead.py run with Python 2.6, and that
gpsfake -T and test_maidenhead.py run with Python 3 when the
extensions are built for Python 3 (not yet a build option).
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the import of the 'packet' module to be an explicit
relative import, which is valid in both Python2 and Python 3. The old
implicit relative import doesn't work in Python 3.
TESTED:
Ran "scons build-all check" (with Python 2.7). Also verified that the
regression tests and test_maidenhead.py run with Python 2.6, and that
gpsfake -T and test_maidenhead.py run with Python 3 when the
extensions are built for Python 3 (not yet a build option).
|
|
|
|
| |
Thanks to Fred Wright for locating the trouble spot.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an entire 4K buffer of packet data contains no newlines, it's
simply retained for future use. But the code was failing to clear the
previous response in that case, causing the caller to see duplicate
data.
Since this bug only mattered with lines longer than 4K bytes, and
since even then it varied as a function of the alignment of lines
vs. 4K boundaries, it was never seen on previous regression tests.
TESTED:
Ran "scons build-all check" with the updated code and the corrected
test data for RTCM3.2.
Signed-off-by: Gary E. Miller <gem@rellim.com>
|
|
|
|
|
| |
Also update the affected regression files. gpsd had been
throwing away the DGPS status.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Also, remove an archaism from the gps/ client library.
|
|
|
|
| |
Also, set xgps back to requiring python2 because of the gobject problem.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Verified by testing gpsprof under both versions. leapecond.py is also OK.
Not yet polyglot: gegps, gpscap.py, gpscat, gpsfake, jsongen.py, maskaudit.py,
test_maidenhead.py, valgrind_audit.py, xgps, xgpsspeed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes it possible to view the "slow" as well as the normal
WRITE_PAD values with gpsfake -T, without having to look at the source
code. It adds a new GetDelay() function to fake.py, which returns the
proper delay value, taking into account both the possible environment
variable and the "slow" option. This is now used for all hree uses of
WRITE_PAD.
Because the environment override is now part of the function, the
WRITE_PAD constant is no longer modified by the environment value, but
instead reflects the platform default.
TESTED:
Ran the full set of regression tests, with both default and acceptably
shortened WRITE_PAD. Also verified that a zero value causes trouble
(OSX), and that adding -S to the zero value makes it work.
Signed-off-by: Jon Schlueter <jon.schlueter@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Depending on timing, in TCP mode, gpsd may try to reconnect to fake.py
between the time that the logfile is complete and the time that the
remove_device is issued. With no listener, this results in a set of
three error messages from gpsd. They don't affect the test outcome,
since they only go to stderr and the "real" output is complete, but
they're annoying to the user.
The likelihood of this happening increases with longer logfiles and
with larger WRITE_PAD values. With a 30ms WRITE_PAD (the default on
OSX), most logfiles exhibit this on all platforms, though it's not
seen on Linux with the default zero WRITE_PAD.
The fix is simply to avoid closing the listener after accepting the
incoming connection. It's not necessary to explicitly service the
listener further, since the OS listen queue is sufficient to accept
the additional connection.
Closing the listener at drain time is almost acceptable, but still
occasionally fails due to the fact that drain() is (necessarily)
called before remove_device(). Not explicitly closing it at all is
acceptable, since Python closes it as part of the object cleanup.
TESTED:
Ran regress-driver in TCP mode with a 30ms WRITE_PAD on all logfiles
on three versions of OSX, as well as Linux, FreeBSD, and OpenBSD, both
with and without the fix. Observed spurious errors in all cases
without the fix, and no cases with the fix. Also verified that no
dangling sockets were left at the end of the runs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current method for assigning ports uses a counter initialized to a
constant. Although this works fine for multiple sessions managed by a
single instance of fake.py, it fails miserably when running multiple
parallel instances of fake.py. The fix is to allow the OS to assign
the port numbers, since it's guaranteed to pick unused ports.
In the TCP case, this is simply a matter of specifying 0 as the port,
and then extracting the actual assigned port number with
getsockname().
In the UDP case, it's more complicated since the port number being
picked is actually for *gpsd's* end, which can't be done in a
straightforward manner. The workaround, which was already being used
to pick the control-socket port for gpsd, is to bind a socket with a
reusable address, close it, and then assume that the port will remain
available until gpsd grabs it. This change turns the existing code to
do that into a function, with the socket type now being specifiable.
TESTED:
Ran all daemon tests in both TCP and UDP modes, on three versions of
OSX as well as Linux, FreeBSD, and OpenBSD. Used default WRITE_PAD
values except on OSX, where it was reduced to 1ms to save time.
Signed-off-by: Jon Schlueter <jon.schlueter@gmail.com>
|
| |
|
| |
|
|
|
|
|
| |
large scale autopep8 cleanup of several
pep8 whitespace warnings
|
|
|
|
|
| |
Before this fix, satellites from the Beidou or QZNSS wuld have been
incirrectly displayed with the SBAS shape.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
When gpsfake is run as root, it may, depending on OS configuration,
create the pty's with 600 permissions that gpsd can not later read.
Make fake.py create all pty's permission 666. Solves the problem
running scons check as root on Gentoo and OS X.
|
| |
|
|
|
|
| |
No logic changes. All regression tests pass.
|
| |
|
|
|
|
| |
All regression tests pass.
|
|
|
|
| |
All regression tests pass.
|
| |
|
| |
|
| |
|
|
|
|
| |
All regression tests pass.
|
|
|
|
|
|
|
|
|
| |
Regression tests pass with nonblocking I/O, but a regression test *rebuild*
fails with timing errors. Much as we want a solution to the select-buzz
problem, this change must go on hold until the root cause of the timing
problems is found and fixed.
Regression tests still pass.
|
| |
|
|
|
|
| |
This commit has no semantic change, just housekeeping.
|
| |
|
| |
|
| |
|
| |
|
| |
|