Hello community,
here is the log from the commit of package python3-pyserial for openSUSE:Factory checked in at 2016-07-12 23:50:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-pyserial (Old)
and /work/SRC/openSUSE:Factory/.python3-pyserial.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-pyserial"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-pyserial/python3-pyserial-doc.changes 2016-06-02 12:38:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python3-pyserial.new/python3-pyserial-doc.changes 2016-07-12 23:50:04.000000000 +0200
@@ -1,0 +2,21 @@
+Mon Jul 4 01:30:11 UTC 2016 - arun@gmx.de
+
+- update to version 3.1.1:
+ * Improvements:
+ + deprecate "nonblocking()" method on posix, the port is already
+ in this mode.
+ + style: use .format() in various places instead of "%" formatting
+ * Bugfixes:
+ + [#122] fix bug in FramedPacket
+ + [#127] The Serial class in the .NET/Mono (IronPython) backend
+ does not implement the _reconfigure_port method
+ + [#123, #128] Avoid Python 3 syntax in aio module
+ * Bugfixes (posix):
+ + [#126] PATCH: Check delay_before_tx/rx for None in
+ serialposix.py
+ + posix: retry if interrupted in Serial.read
+ * Bugfixes (win32):
+ + win32: handle errors of GetOverlappedResult in read(), fixes
+ #121
+
+-------------------------------------------------------------------
python3-pyserial.changes: same change
Old:
----
pyserial-3.1.tar.gz
New:
----
pyserial-3.1.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-pyserial-doc.spec ++++++
--- /var/tmp/diff_new_pack.FgxfSx/_old 2016-07-12 23:50:05.000000000 +0200
+++ /var/tmp/diff_new_pack.FgxfSx/_new 2016-07-12 23:50:05.000000000 +0200
@@ -17,7 +17,7 @@
Name: python3-pyserial-doc
-Version: 3.1
+Version: 3.1.1
Release: 0
Url: https://github.com/pyserial/pyserial
Summary: Documentation for python3-pyserial
python3-pyserial.spec: same change
++++++ pyserial-3.1.tar.gz -> pyserial-3.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/CHANGES.rst new/pyserial-3.1.1/CHANGES.rst
--- old/pyserial-3.1/CHANGES.rst 2016-05-27 23:18:27.000000000 +0200
+++ new/pyserial-3.1.1/CHANGES.rst 2016-06-12 22:46:29.000000000 +0200
@@ -621,3 +621,28 @@
- fix bad super call and duplicate old-style __init__ call
- [#80] list_ports: Compatibility issue between Windows/Linux
+
+
+Version 3.1.1 2016-06-12
+--------------------------
+Improvements:
+
+- deprecate ``nonblocking()`` method on posix, the port is already in this
+ mode.
+- style: use .format() in various places instead of "%" formatting
+
+Bugfixes:
+
+- [#122] fix bug in FramedPacket
+- [#127] The Serial class in the .NET/Mono (IronPython) backend does not
+ implement the _reconfigure_port method
+- [#123, #128] Avoid Python 3 syntax in aio module
+
+Bugfixes (posix):
+
+- [#126] PATCH: Check delay_before_tx/rx for None in serialposix.py
+- posix: retry if interrupted in Serial.read
+
+Bugfixes (win32):
+
+- win32: handle errors of GetOverlappedResult in read(), fixes #121
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/PKG-INFO new/pyserial-3.1.1/PKG-INFO
--- old/pyserial-3.1/PKG-INFO 2016-05-27 23:26:34.000000000 +0200
+++ new/pyserial-3.1.1/PKG-INFO 2016-06-12 22:49:16.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pyserial
-Version: 3.1
+Version: 3.1.1
Summary: Python Serial Port Extension
Home-page: https://github.com/pyserial/pyserial
Author: Chris Liechti
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/documentation/conf.py new/pyserial-3.1.1/documentation/conf.py
--- old/pyserial-3.1/documentation/conf.py 2016-05-27 23:19:00.000000000 +0200
+++ new/pyserial-3.1.1/documentation/conf.py 2016-06-12 01:42:17.000000000 +0200
@@ -47,7 +47,7 @@
# The short X.Y version.
version = '3.1'
# The full version, including alpha/beta/rc tags.
-release = '3.1.0'
+release = '3.1.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/documentation/pyserial_api.rst new/pyserial-3.1.1/documentation/pyserial_api.rst
--- old/pyserial-3.1/documentation/pyserial_api.rst 2016-05-24 00:07:50.000000000 +0200
+++ new/pyserial-3.1.1/documentation/pyserial_api.rst 2016-06-04 22:25:50.000000000 +0200
@@ -485,9 +485,10 @@
:platform: Posix
- Configure the device for nonblocking operation. This can be useful if
- the port is used with :mod:`select`. Note that :attr:`timeout` must
- also be set to ``0``
+ .. deprecated:: 3.2
+ The serial port is already opened in this mode. This method is not
+ needed and going away.
+
.. method:: fileno()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/documentation/shortintro.rst new/pyserial-3.1.1/documentation/shortintro.rst
--- old/pyserial-3.1/documentation/shortintro.rst 2015-12-17 19:36:37.000000000 +0100
+++ new/pyserial-3.1.1/documentation/shortintro.rst 2016-06-07 21:12:36.000000000 +0200
@@ -55,7 +55,7 @@
Readline
========
-Be carefully when using :meth:`readline`. Do specify a timeout when opening the
+Be careful when using :meth:`readline`. Do specify a timeout when opening the
serial port otherwise it could block forever if no newline character is
received. Also note that :meth:`readlines` only works with a timeout.
:meth:`readlines` depends on having a timeout and interprets that as EOF (end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/pyserial.egg-info/PKG-INFO new/pyserial-3.1.1/pyserial.egg-info/PKG-INFO
--- old/pyserial-3.1/pyserial.egg-info/PKG-INFO 2016-05-27 23:26:34.000000000 +0200
+++ new/pyserial-3.1.1/pyserial.egg-info/PKG-INFO 2016-06-12 22:49:15.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pyserial
-Version: 3.1
+Version: 3.1.1
Summary: Python Serial Port Extension
Home-page: https://github.com/pyserial/pyserial
Author: Chris Liechti
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/pyserial.egg-info/SOURCES.txt new/pyserial-3.1.1/pyserial.egg-info/SOURCES.txt
--- old/pyserial-3.1/pyserial.egg-info/SOURCES.txt 2016-05-27 23:26:34.000000000 +0200
+++ new/pyserial-3.1.1/pyserial.egg-info/SOURCES.txt 2016-06-12 22:49:16.000000000 +0200
@@ -57,6 +57,7 @@
serial/urlhandler/protocol_hwgrep.py
serial/urlhandler/protocol_loop.py
serial/urlhandler/protocol_rfc2217.py
+serial/urlhandler/protocol_serve-rfc2217.py
serial/urlhandler/protocol_socket.py
serial/urlhandler/protocol_spy.py
test/run_all_tests.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/__init__.py new/pyserial-3.1.1/serial/__init__.py
--- old/pyserial-3.1/serial/__init__.py 2016-05-27 23:18:38.000000000 +0200
+++ new/pyserial-3.1.1/serial/__init__.py 2016-06-12 01:41:54.000000000 +0200
@@ -13,7 +13,7 @@
from serial.serialutil import *
#~ SerialBase, SerialException, to_bytes, iterbytes
-__version__ = '3.1'
+__version__ = '3.1.1'
VERSION = __version__
@@ -30,7 +30,7 @@
elif os.name == 'java':
from serial.serialjava import Serial
else:
- raise ImportError("Sorry: no implementation for your platform ('%s') available" % (os.name,))
+ raise ImportError("Sorry: no implementation for your platform ('{}') available".format(os.name))
protocol_handler_packages = [
@@ -66,7 +66,7 @@
# if it is an URL, try to import the handler module from the list of possible packages
if '://' in url_lowercase:
protocol = url_lowercase.split('://', 1)[0]
- module_name = '.protocol_%s' % (protocol,)
+ module_name = '.protocol_{}'.format(protocol)
for package_name in protocol_handler_packages:
try:
importlib.import_module(package_name)
@@ -80,7 +80,7 @@
klass = handler_module.Serial
break
else:
- raise ValueError('invalid URL, protocol %r not known' % (protocol,))
+ raise ValueError('invalid URL, protocol {!r} not known'.format(protocol))
# instantiate and open when desired
instance = klass(None, *args, **kwargs)
instance.port = url
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/aio.py new/pyserial-3.1.1/serial/aio.py
--- old/pyserial-3.1/serial/aio.py 2016-05-23 22:23:38.000000000 +0200
+++ new/pyserial-3.1.1/serial/aio.py 2016-06-12 03:33:42.000000000 +0200
@@ -52,7 +52,6 @@
# Asynchronous I/O requires non-blocking devices
self._serial.timeout = 0
self._serial.write_timeout = 0
- self._serial.nonblocking()
# These two callbacks will be enqueued in a FIFO queue by asyncio
loop.call_soon(protocol.connection_made, self)
@@ -279,7 +278,7 @@
def _set_write_buffer_limits(self, high=None, low=None):
"""Ensure consistent write-buffer limits."""
if high is None:
- high = 64*1024 if low is None else 4*low
+ high = 64 * 1024 if low is None else 4 * low
if low is None:
low = high // 4
if not high >= low >= 0:
@@ -363,10 +362,7 @@
@asyncio.coroutine
-def open_serial_connection(*,
- loop=None,
- limit=asyncio.streams._DEFAULT_LIMIT,
- **kwargs):
+def open_serial_connection(**kwargs):
"""A wrapper for create_serial_connection() returning a (reader,
writer) pair.
@@ -380,16 +376,22 @@
This function is a coroutine.
"""
- if loop is None:
- loop = asyncio.get_event_loop()
+ # in order to avoid errors when pySerial is installed under Python 2,
+ # avoid Pyhthon 3 syntax here. So do not use this function as a good
+ # example!
+ loop = kwargs.get('loop', asyncio.get_event_loop())
+ limit = kwargs.get('limit', asyncio.streams._DEFAULT_LIMIT)
reader = asyncio.StreamReader(limit=limit, loop=loop)
protocol = asyncio.StreamReaderProtocol(reader, loop=loop)
- transport, _ = yield from create_serial_connection(
- loop=loop,
- protocol_factory=lambda: protocol,
- **kwargs)
+ # in Python 3 we would write "yield transport, _ from c()"
+ for transport, _ in create_serial_connection(
+ loop=loop,
+ protocol_factory=lambda: protocol,
+ **kwargs):
+ yield transport, _
writer = asyncio.StreamWriter(transport, protocol, reader, loop)
- return reader, writer
+ # in Python 3 we would write "return reader, writer"
+ raise StopIteration(reader, writer)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/rfc2217.py new/pyserial-3.1.1/serial/rfc2217.py
--- old/pyserial-3.1/serial/rfc2217.py 2016-04-21 22:44:38.000000000 +0200
+++ new/pyserial-3.1.1/serial/rfc2217.py 2016-06-08 06:05:48.000000000 +0200
@@ -410,7 +410,7 @@
if self.is_open:
raise SerialException("Port is already open.")
try:
- self._socket = socket.create_connection(self.from_url(self.portstr), timeout=5) # XXX good value?
+ self._socket = socket.create_connection(self.from_url(self.portstr), timeout=5) # XXX good value?
self._socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
except Exception as msg:
self._socket = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/serialcli.py new/pyserial-3.1.1/serial/serialcli.py
--- old/pyserial-3.1/serial/serialcli.py 2016-05-07 23:26:45.000000000 +0200
+++ new/pyserial-3.1.1/serial/serialcli.py 2016-06-09 20:29:14.000000000 +0200
@@ -47,7 +47,7 @@
if self._dtr_state is None:
self._dtr_state = True
- self._reconfigurePort()
+ self._reconfigure_port()
self._port_handle.Open()
self.is_open = True
if not self._dsrdtr:
@@ -56,7 +56,7 @@
self._update_rts_state()
self.reset_input_buffer()
- def _reconfigurePort(self):
+ def _reconfigure_port(self):
"""Set communication parameters on opened port."""
if not self._port_handle:
raise SerialException("Can only operate on a valid port handle")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/serialposix.py new/pyserial-3.1.1/serial/serialposix.py
--- old/pyserial-3.1/serial/serialposix.py 2016-05-22 03:04:21.000000000 +0200
+++ new/pyserial-3.1.1/serial/serialposix.py 2016-06-09 20:24:43.000000000 +0200
@@ -139,8 +139,10 @@
buf[0] |= SER_RS485_RTS_AFTER_SEND
else:
buf[0] &= ~SER_RS485_RTS_AFTER_SEND
- buf[1] = int(rs485_settings.delay_before_tx * 1000)
- buf[2] = int(rs485_settings.delay_before_rx * 1000)
+ if rs485_settings.delay_before_tx is not None:
+ buf[1] = int(rs485_settings.delay_before_tx * 1000)
+ if rs485_settings.delay_before_rx is not None:
+ buf[2] = int(rs485_settings.delay_before_rx * 1000)
else:
buf[0] = 0 # clear SER_RS485_ENABLED
fcntl.ioctl(self.fd, TIOCSRS485, buf)
@@ -271,6 +273,8 @@
self.reset_input_buffer()
self.pipe_abort_read_r, self.pipe_abort_read_w = os.pipe()
self.pipe_abort_write_r, self.pipe_abort_write_w = os.pipe()
+ fcntl.fcntl(self.pipe_abort_read_r, fcntl.F_SETFL, os.O_NONBLOCK)
+ fcntl.fcntl(self.pipe_abort_write_r, fcntl.F_SETFL, os.O_NONBLOCK)
def _reconfigure_port(self, force_update=False):
"""Set communication parameters on opened port."""
@@ -445,7 +449,7 @@
start_time = time.time()
ready, _, _ = select.select([self.fd, self.pipe_abort_read_r], [], [], timeout)
if self.pipe_abort_read_r in ready:
- os.read(self.pipe_abort_read_r, 1)
+ os.read(self.pipe_abort_read_r, 1000)
break
# If select was used with a timeout, and the timeout occurs, it
# returns with empty lists -> thus abort read operation.
@@ -464,14 +468,10 @@
'device reports readiness to read but returned no data '
'(device disconnected or multiple access on port?)')
read.extend(buf)
- if timeout is not None:
- timeout -= time.time() - start_time
- if timeout <= 0:
- break
except OSError as e:
# this is for Python 3.x where select.error is a subclass of
# OSError ignore EAGAIN errors. all other errors are shown
- if e.errno != errno.EAGAIN:
+ if e.errno != errno.EAGAIN and e.errno != errno.EINTR:
raise SerialException('read failed: {}'.format(e))
except select.error as e:
# this is for Python 2.x
@@ -479,6 +479,10 @@
# see also http://www.python.org/dev/peps/pep-3151/#select
if e[0] != errno.EAGAIN:
raise SerialException('read failed: {}'.format(e))
+ if timeout is not None:
+ timeout -= time.time() - start_time
+ if timeout <= 0:
+ break
return bytes(read)
def cancel_read(self):
@@ -511,7 +515,7 @@
raise writeTimeoutError
abort, ready, _ = select.select([self.pipe_abort_write_r], [self.fd], [], timeleft)
if abort:
- os.read(self.pipe_abort_write_r, 1)
+ os.read(self.pipe_abort_write_r, 1000)
break
if not ready:
raise writeTimeoutError
@@ -633,12 +637,6 @@
s = fcntl.ioctl(self.fd, TIOCOUTQ, TIOCM_zero_str)
return struct.unpack('I', s)[0]
- def nonblocking(self):
- """internal - not portable!"""
- if not self.is_open:
- raise portNotOpenError
- fcntl.fcntl(self.fd, fcntl.F_SETFL, os.O_NONBLOCK)
-
def fileno(self):
"""\
For easier use of the serial port instance with select.
@@ -674,6 +672,11 @@
else:
termios.tcflow(self.fd, termios.TCOOFF)
+ def nonblocking(self):
+ """DEPRECATED - has no use"""
+ import warnings
+ warnings.warn("nonblocking() has no effect, already nonblocking", DeprecationWarning)
+
class PosixPollSerial(Serial):
"""\
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/serialwin32.py new/pyserial-3.1.1/serial/serialwin32.py
--- old/pyserial-3.1/serial/serialwin32.py 2016-05-27 22:19:48.000000000 +0200
+++ new/pyserial-3.1.1/serial/serialwin32.py 2016-06-02 21:18:44.000000000 +0200
@@ -270,7 +270,7 @@
flags = win32.DWORD()
comstat = win32.COMSTAT()
if not win32.ClearCommError(self._port_handle, ctypes.byref(flags), ctypes.byref(comstat)):
- raise SerialException('call to ClearCommError failed')
+ raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
n = min(comstat.cbInQue, size) if self.timeout == 0 else size
if n > 0:
buf = ctypes.create_string_buffer(n)
@@ -283,11 +283,14 @@
ctypes.byref(self._overlapped_read))
if not read_ok and win32.GetLastError() not in (win32.ERROR_SUCCESS, win32.ERROR_IO_PENDING):
raise SerialException("ReadFile failed ({!r})".format(ctypes.WinError()))
- win32.GetOverlappedResult(
+ result_ok = win32.GetOverlappedResult(
self._port_handle,
ctypes.byref(self._overlapped_read),
ctypes.byref(rc),
True)
+ if not result_ok:
+ if win32.GetLastError() != win32.ERROR_OPERATION_ABORTED:
+ raise SerialException("GetOverlappedResult failed ({!r})".format(ctypes.WinError()))
read = buf.raw[:rc.value]
else:
read = bytes()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/threaded/__init__.py new/pyserial-3.1.1/serial/threaded/__init__.py
--- old/pyserial-3.1/serial/threaded/__init__.py 2016-05-20 00:10:31.000000000 +0200
+++ new/pyserial-3.1.1/serial/threaded/__init__.py 2016-06-02 21:18:44.000000000 +0200
@@ -102,7 +102,7 @@
self.in_packet = True
elif byte == self.STOP:
self.in_packet = False
- self.handle_packet(packet)
+ self.handle_packet(self.packet)
del self.packet[:]
elif self.in_packet:
self.packet.append(byte)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/tools/hexlify_codec.py new/pyserial-3.1.1/serial/tools/hexlify_codec.py
--- old/pyserial-3.1/serial/tools/hexlify_codec.py 2016-03-08 22:52:44.000000000 +0100
+++ new/pyserial-3.1.1/serial/tools/hexlify_codec.py 2016-06-08 06:05:48.000000000 +0200
@@ -91,7 +91,7 @@
state = 0
else:
if self.errors == 'strict':
- raise UnicodeError('non-hex digit found: %r' % c)
+ raise UnicodeError('non-hex digit found: {!r}'.format(c))
self.state = state
return serial.to_bytes(encoded)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/tools/list_ports.py new/pyserial-3.1.1/serial/tools/list_ports.py
--- old/pyserial-3.1/serial/tools/list_ports.py 2016-02-10 03:28:20.000000000 +0100
+++ new/pyserial-3.1.1/serial/tools/list_ports.py 2016-06-08 06:05:48.000000000 +0200
@@ -29,7 +29,7 @@
from serial.tools.list_ports_posix import comports
#~ elif os.name == 'java':
else:
- raise ImportError("Sorry: no implementation for your platform ('%s') available" % (os.name,))
+ raise ImportError("Sorry: no implementation for your platform ('{}') available".format(os.name))
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -79,7 +79,7 @@
# get iteraror w/ or w/o filter
if args.regexp:
if not args.quiet:
- sys.stderr.write("Filtered list with regexp: %r\n" % (args.regexp,))
+ sys.stderr.write("Filtered list with regexp: {!r}\n".format(args.regexp))
iterator = sorted(grep(args.regexp))
else:
iterator = sorted(comports())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/tools/list_ports_linux.py new/pyserial-3.1.1/serial/tools/list_ports_linux.py
--- old/pyserial-3.1/serial/tools/list_ports_linux.py 2015-12-16 22:57:58.000000000 +0100
+++ new/pyserial-3.1.1/serial/tools/list_ports_linux.py 2016-06-08 06:05:48.000000000 +0200
@@ -20,8 +20,8 @@
super(SysFS, self).__init__(device)
self.name = os.path.basename(device)
self.usb_device_path = None
- if os.path.exists('/sys/class/tty/%s/device' % (self.name,)):
- self.device_path = os.path.realpath('/sys/class/tty/%s/device' % (self.name,))
+ if os.path.exists('/sys/class/tty/{}/device'.format(self.name)):
+ self.device_path = os.path.realpath('/sys/class/tty/{}/device'.format(self.name))
self.subsystem = os.path.basename(os.path.realpath(os.path.join(self.device_path, 'subsystem')))
else:
self.device_path = None
@@ -81,4 +81,4 @@
# test
if __name__ == '__main__':
for port, desc, hwid in sorted(comports()):
- print("%s: %s [%s]" % (port, desc, hwid))
+ print("{}: {} [{}]".format(port, desc, hwid))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/tools/list_ports_osx.py new/pyserial-3.1.1/serial/tools/list_ports_osx.py
--- old/pyserial-3.1/serial/tools/list_ports_osx.py 2016-03-21 23:18:51.000000000 +0100
+++ new/pyserial-3.1.1/serial/tools/list_ports_osx.py 2016-06-08 06:05:48.000000000 +0200
@@ -256,4 +256,4 @@
# test
if __name__ == '__main__':
for port, desc, hwid in sorted(comports()):
- print("%s: %s [%s]" % (port, desc, hwid))
+ print("{}: {} [{}]".format(port, desc, hwid))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/tools/list_ports_posix.py new/pyserial-3.1.1/serial/tools/list_ports_posix.py
--- old/pyserial-3.1/serial/tools/list_ports_posix.py 2016-02-06 23:29:44.000000000 +0100
+++ new/pyserial-3.1.1/serial/tools/list_ports_posix.py 2016-06-08 06:05:48.000000000 +0200
@@ -86,16 +86,16 @@
! I you know how the serial ports are named send this information to
! the author of this module:
-sys.platform = %r
-os.name = %r
-pySerial version = %s
+sys.platform = {!r}
+os.name = {!r}
+pySerial version = {}
also add the naming scheme of the serial ports and with a bit luck you can get
this module running...
-""" % (sys.platform, os.name, serial.VERSION))
- raise ImportError("Sorry: no implementation for your platform ('%s') available" % (os.name,))
+""".format(sys.platform, os.name, serial.VERSION))
+ raise ImportError("Sorry: no implementation for your platform ('{}') available".format(os.name))
# test
if __name__ == '__main__':
for port, desc, hwid in sorted(comports()):
- print("%s: %s [%s]" % (port, desc, hwid))
+ print("{}: {} [{}]".format(port, desc, hwid))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/tools/list_ports_windows.py new/pyserial-3.1.1/serial/tools/list_ports_windows.py
--- old/pyserial-3.1/serial/tools/list_ports_windows.py 2016-04-10 23:06:41.000000000 +0200
+++ new/pyserial-3.1.1/serial/tools/list_ports_windows.py 2016-06-08 06:05:48.000000000 +0200
@@ -66,12 +66,12 @@
]
def __str__(self):
- return "{%08x-%04x-%04x-%s-%s}" % (
+ return "{{{:08x}-{:04x}-{:04x}-{}-{}}}".format(
self.Data1,
self.Data2,
self.Data3,
- ''.join(["%02x" % d for d in self.Data4[:2]]),
- ''.join(["%02x" % d for d in self.Data4[2:]]),
+ ''.join(["{:02x}".format(d) for d in self.Data4[:2]]),
+ ''.join(["{:02x}".format(d) for d in self.Data4[2:]]),
)
@@ -84,7 +84,7 @@
]
def __str__(self):
- return "ClassGuid:%s DevInst:%s" % (self.ClassGuid, self.DevInst)
+ return "ClassGuid:{} DevInst:{}".format(self.ClassGuid, self.DevInst)
PSP_DEVINFO_DATA = ctypes.POINTER(SP_DEVINFO_DATA)
@@ -246,7 +246,7 @@
location = []
for g in m:
if g.group(1):
- location.append('%d' % (int(g.group(1)) + 1))
+ location.append('{:d}'.format(int(g.group(1)) + 1))
else:
if len(location) > 1:
location.append('.')
@@ -297,4 +297,4 @@
# test
if __name__ == '__main__':
for port, desc, hwid in sorted(comports()):
- print("%s: %s [%s]" % (port, desc, hwid))
+ print("{}: {} [{}]".format(port, desc, hwid))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/tools/miniterm.py new/pyserial-3.1.1/serial/tools/miniterm.py
--- old/pyserial-3.1/serial/tools/miniterm.py 2016-05-15 21:47:56.000000000 +0200
+++ new/pyserial-3.1.1/serial/tools/miniterm.py 2016-06-08 06:05:48.000000000 +0200
@@ -32,7 +32,7 @@
"""generate a readable description for a key"""
ascii_code = ord(character)
if ascii_code < 32:
- return 'Ctrl+%c' % (ord('@') + ascii_code)
+ return 'Ctrl+{:c}'.format(ord('@') + ascii_code)
else:
return repr(character)
@@ -322,7 +322,6 @@
sys.stderr.write('\n--- Available ports:\n')
ports = []
for n, (port, desc, hwid) in enumerate(sorted(comports()), 1):
- #~ sys.stderr.write('--- %-20s %s [%s]\n' % (port, desc, hwid))
sys.stderr.write('--- {:2}: {:20} {}\n'.format(n, port, desc))
ports.append(port)
while True:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/urlhandler/protocol_alt.py new/pyserial-3.1.1/serial/urlhandler/protocol_alt.py
--- old/pyserial-3.1/serial/urlhandler/protocol_alt.py 2016-02-12 23:28:39.000000000 +0100
+++ new/pyserial-3.1.1/serial/urlhandler/protocol_alt.py 2016-06-08 06:05:48.000000000 +0200
@@ -30,23 +30,23 @@
if parts.scheme != 'alt':
raise serial.SerialException(
'expected a string in the form "alt://port[?option[=value][&option[=value]]]": '
- 'not starting with alt:// (%r)' % (parts.scheme,))
+ 'not starting with alt:// ({!r})'.format(parts.scheme))
class_name = 'Serial'
try:
for option, values in urlparse.parse_qs(parts.query, True).items():
if option == 'class':
class_name = values[0]
else:
- raise ValueError('unknown option: %r' % (option,))
+ raise ValueError('unknown option: {!r}'.format(option))
except ValueError as e:
raise serial.SerialException(
'expected a string in the form '
- '"alt://port[?option[=value][&option[=value]]]": %s' % e)
+ '"alt://port[?option[=value][&option[=value]]]": {!r}'.format(e))
if not hasattr(serial, class_name):
- raise ValueError('unknown class: %r' % (class_name,))
+ raise ValueError('unknown class: {!r}'.format(class_name))
cls = getattr(serial, class_name)
if not issubclass(cls, serial.Serial):
- raise ValueError('class %r is not an instance of Serial' % (class_name,))
+ raise ValueError('class {!r} is not an instance of Serial'.format(class_name))
return (''.join([parts.netloc, parts.path]), cls)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/urlhandler/protocol_hwgrep.py new/pyserial-3.1.1/serial/urlhandler/protocol_hwgrep.py
--- old/pyserial-3.1/serial/urlhandler/protocol_hwgrep.py 2016-02-10 03:21:39.000000000 +0100
+++ new/pyserial-3.1.1/serial/urlhandler/protocol_hwgrep.py 2016-06-08 06:05:48.000000000 +0200
@@ -59,12 +59,12 @@
# pick n'th element
n = int(value) - 1
if n < 1:
- raise ValueError('option "n" expects a positive integer larger than 1: %r' % (value,))
+ raise ValueError('option "n" expects a positive integer larger than 1: {!r}'.format(value))
elif option == 'skip_busy':
# open to test if port is available. not the nicest way..
test_open = True
else:
- raise ValueError('unknown option: %r' % (option,))
+ raise ValueError('unknown option: {!r}'.format(option))
# use a for loop to get the 1st element from the generator
for port, desc, hwid in sorted(serial.tools.list_ports.grep(regexp)):
if test_open:
@@ -80,7 +80,7 @@
continue
return port
else:
- raise serial.SerialException('no ports found matching regexp %r' % (url,))
+ raise serial.SerialException('no ports found matching regexp {!r}'.format(url))
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/urlhandler/protocol_loop.py new/pyserial-3.1.1/serial/urlhandler/protocol_loop.py
--- old/pyserial-3.1/serial/urlhandler/protocol_loop.py 2016-02-09 22:55:31.000000000 +0100
+++ new/pyserial-3.1.1/serial/urlhandler/protocol_loop.py 2016-06-08 06:05:48.000000000 +0200
@@ -91,7 +91,7 @@
"""
# not that's it of any real use, but it helps in the unit tests
if not isinstance(self._baudrate, numbers.Integral) or not 0 < self._baudrate < 2 ** 32:
- raise ValueError("invalid baudrate: %r" % (self._baudrate))
+ raise ValueError("invalid baudrate: {!r}".format(self._baudrate))
if self.logger:
self.logger.info('_reconfigure_port()')
@@ -99,7 +99,10 @@
"""extract host and port from an URL string"""
parts = urlparse.urlsplit(url)
if parts.scheme != "loop":
- raise SerialException('expected a string in the form "loop://[?logging={debug|info|warning|error}]": not starting with loop:// (%r)' % (parts.scheme,))
+ raise SerialException(
+ 'expected a string in the form '
+ '"loop://[?logging={debug|info|warning|error}]": not starting '
+ 'with loop:// ({!r})'.format(parts.scheme))
try:
# process options now, directly altering self
for option, values in urlparse.parse_qs(parts.query, True).items():
@@ -109,9 +112,11 @@
self.logger.setLevel(LOGGER_LEVELS[values[0]])
self.logger.debug('enabled logging')
else:
- raise ValueError('unknown option: %r' % (option,))
+ raise ValueError('unknown option: {!r}'.format(option))
except ValueError as e:
- raise SerialException('expected a string in the form "loop://[?logging={debug|info|warning|error}]": %s' % e)
+ raise SerialException(
+ 'expected a string in the form '
+ '"loop://[?logging={debug|info|warning|error}]": {}'.format(e))
# - - - - - - - - - - - - - - - - - - - - - - - -
@@ -123,7 +128,7 @@
if self.logger:
# attention the logged value can differ from return value in
# threaded environments...
- self.logger.debug('in_waiting -> %d' % (self.queue.qsize(),))
+ self.logger.debug('in_waiting -> {:d}'.format(self.queue.qsize()))
return self.queue.qsize()
def read(self, size=1):
@@ -212,17 +217,17 @@
possible.
"""
if self.logger:
- self.logger.info('_update_break_state(%r)' % (self._break_state,))
+ self.logger.info('_update_break_state({!r})'.format(self._break_state))
def _update_rts_state(self):
"""Set terminal status line: Request To Send"""
if self.logger:
- self.logger.info('_update_rts_state(%r) -> state of CTS' % (self._rts_state,))
+ self.logger.info('_update_rts_state({!r}) -> state of CTS'.format(self._rts_state))
def _update_dtr_state(self):
"""Set terminal status line: Data Terminal Ready"""
if self.logger:
- self.logger.info('_update_dtr_state(%r) -> state of DSR' % (self._dtr_state,))
+ self.logger.info('_update_dtr_state({!r}) -> state of DSR'.format(self._dtr_state))
@property
def cts(self):
@@ -230,14 +235,14 @@
if not self.is_open:
raise portNotOpenError
if self.logger:
- self.logger.info('CTS -> state of RTS (%r)' % (self._rts_state,))
+ self.logger.info('CTS -> state of RTS ({!r})'.format(self._rts_state))
return self._rts_state
@property
def dsr(self):
"""Read terminal status line: Data Set Ready"""
if self.logger:
- self.logger.info('DSR -> state of DTR (%r)' % (self._dtr_state,))
+ self.logger.info('DSR -> state of DTR ({!r})'.format(self._dtr_state))
return self._dtr_state
@property
@@ -266,11 +271,11 @@
if __name__ == '__main__':
import sys
s = Serial('loop://')
- sys.stdout.write('%s\n' % s)
+ sys.stdout.write('{}\n'.format(s))
sys.stdout.write("write...\n")
s.write("hello\n")
s.flush()
- sys.stdout.write("read: %s\n" % s.read(5))
+ sys.stdout.write("read: {!r}\n".format(s.read(5)))
s.close()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyserial-3.1/serial/urlhandler/protocol_serve-rfc2217.py new/pyserial-3.1.1/serial/urlhandler/protocol_serve-rfc2217.py
--- old/pyserial-3.1/serial/urlhandler/protocol_serve-rfc2217.py 1970-01-01 01:00:00.000000000 +0100
+++ new/pyserial-3.1.1/serial/urlhandler/protocol_serve-rfc2217.py 2016-02-02 03:57:59.000000000 +0100
@@ -0,0 +1,10 @@
+#! python
+#
+# This is a thin wrapper to load the rfc2271 implementation.
+#
+# This file is part of pySerial. https://github.com/pyserial/pyserial
+# (C) 2011 Chris Liechti