From 87585d57d70c10ae8eb9264bfca5931646ec6fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 9 Oct 2018 20:56:41 +0200 Subject: removed broken pytest config from setup.cfg Gbp-Pq: Name 0001-removed-broken-pytest-config-from-setup.cfg.patch --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index a0e8d5b..936c8da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,9 +4,6 @@ test=pytest [metadata] license_file = LICENSE.txt -[tool:pytest] -addopts = -v --timeout=300 --cov=can --cov-config=setup.cfg - [coverage:run] # we could also use branch coverage branch = False -- cgit v1.2.3 From e3f14435e28106276be1d4e20573d5c457fd414c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 10 Sep 2019 15:19:19 +0200 Subject: temporarily disable script tests Forwarded: not-needed Last-Update: 2019-02-11 Last-Update: 2019-02-11 Gbp-Pq: Name 0002-disable-broken-tests.patch --- test/test_scripts.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_scripts.py b/test/test_scripts.py index 9504cf7..4560210 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -71,10 +71,10 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.logger --help", - "python scripts/can_logger.py --help", +# "python scripts/can_logger.py --help", ] - if IS_UNIX: - commands += ["can_logger.py --help"] +# if IS_UNIX: +# commands += ["can_logger.py --help"] return commands def _import(self): @@ -87,10 +87,10 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.player --help", - "python scripts/can_player.py --help", +# "python scripts/can_player.py --help", ] - if IS_UNIX: - commands += ["can_player.py --help"] +# if IS_UNIX: +# commands += ["can_player.py --help"] return commands def _import(self): -- cgit v1.2.3 From dfc7f249b3b73d86220cdf12576427c4f87b3324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 10 Sep 2019 15:19:19 +0200 Subject: Use 'enum' library rather than 'aenum' Last-Update: 2019-09-10 On Debian we only ship python3-can with python>3.7... Last-Update: 2019-09-10 Gbp-Pq: Name 0003-aenum-enum.patch --- can/bus.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/can/bus.py b/can/bus.py index e22bf61..f62a9da 100644 --- a/can/bus.py +++ b/can/bus.py @@ -13,7 +13,10 @@ import can import logging import threading from time import time -from aenum import Enum, auto +try: + from aenum import Enum, auto +except ImportError: + from enum import Enum, auto from can.broadcastmanager import ThreadBasedCyclicSendTask from can.message import Message -- cgit v1.2.3 From 9a13d2d659b6725d170fff7de358b6dcb5b101b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 10 Sep 2019 15:19:19 +0200 Subject: Remove dependency on python3-sphinx-autodoc-typehints Origin: Debian Forwarded: not-needed Last-Update: 2019-09-10 as this is currently only available in experimental. Once the autodoc-typehints patckage hits unstable, disable this patch Last-Update: 2019-09-10 Gbp-Pq: Name 0004-sphinx-autodoc-typehints.patch --- doc/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 62fd649..b95aa65 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -43,7 +43,6 @@ extensions = [ "sphinx.ext.viewcode", "sphinx.ext.graphviz", "sphinxcontrib.programoutput", - "sphinx_autodoc_typehints", ] # Now, you can use the alias name as a new role, e.g. :issue:`123`. -- cgit v1.2.3 From c1e8a6589fb0ae2d4392c3e8e1764eeb01f64776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 10 Sep 2019 15:19:19 +0200 Subject: use 'python3' instead of 'python' when calling scripts Origin: Debian Forwarded: not-needed Last-Update: 2019-09-10 also in the documentation Last-Update: 2019-09-10 Gbp-Pq: Name 0005-python3.patch --- can/logger.py | 2 +- can/player.py | 2 +- can/viewer.py | 12 ++++++------ doc/scripts.rst | 8 ++++---- test/test_scripts.py | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/can/logger.py b/can/logger.py index 00f6679..d5a0b4c 100644 --- a/can/logger.py +++ b/can/logger.py @@ -27,7 +27,7 @@ from can import Bus, BusState, Logger def main(): parser = argparse.ArgumentParser( - "python -m can.logger", + "python3 -m can.logger", description="Log CAN traffic, printing messages to stdout or to a given file.", ) diff --git a/can/player.py b/can/player.py index 34be486..83ced37 100644 --- a/can/player.py +++ b/can/player.py @@ -17,7 +17,7 @@ from can import Bus, LogReader, MessageSync def main(): parser = argparse.ArgumentParser( - "python -m can.player", description="Replay CAN traffic." + "python3 -m can.player", description="Replay CAN traffic." ) parser.add_argument( diff --git a/can/viewer.py b/can/viewer.py index 7071925..86d377d 100644 --- a/can/viewer.py +++ b/can/viewer.py @@ -341,7 +341,7 @@ def parse_args(args): # Parse command line arguments parser = argparse.ArgumentParser( - "python -m can.viewer", + "python3 -m can.viewer", description="A simple CAN viewer terminal application written in Python", epilog="R|Shortcuts: " "\n +---------+-------------------------+" @@ -414,7 +414,7 @@ def parse_args(args): "\n q = int64_t, Q = uint64_t" "\n f = float (32-bits), d = double (64-bits)" "\nFx to convert six bytes with ID 0x100 into uint8_t, uint16 and uint32_t:" - '\n $ python -m can.viewer -d "100:: (matches when & mask == can_id & mask)" "\n ~ (matches when & mask != can_id & mask)" "\nFx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F:" - "\n python -m can.viewer -f 100:7FC 200:7F0" + "\n python3 -m can.viewer -f 100:7FC 200:7F0" "\nNote that the ID and mask are alway interpreted as hex values", metavar="{:,~}", nargs=argparse.ONE_OR_MORE, diff --git a/doc/scripts.rst b/doc/scripts.rst index a63f1b1..d61efc2 100644 --- a/doc/scripts.rst +++ b/doc/scripts.rst @@ -3,7 +3,7 @@ Scripts The following modules are callable from python-can. -They can be called for example by ``python -m can.logger`` or ``can_logger.py`` (if installed using pip). +They can be called for example by ``python3 -m can.logger`` or ``can_logger.py`` (if installed using pip). can.logger ---------- @@ -11,13 +11,13 @@ can.logger Command line help, called with ``--help``: -.. command-output:: python -m can.logger -h +.. command-output:: python3 -m can.logger -h can.player ---------- -.. command-output:: python -m can.player -h +.. command-output:: python3 -m can.player -h can.viewer @@ -37,5 +37,5 @@ By default the ``can.viewer`` uses the :doc:`/interfaces/socketcan` interface. A The full usage page can be seen below: -.. command-output:: python -m can.viewer -h +.. command-output:: python3 -m can.viewer -h diff --git a/test/test_scripts.py b/test/test_scripts.py index 4560210..117b236 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -70,8 +70,8 @@ class CanScriptTest(unittest.TestCase, metaclass=ABCMeta): class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.logger --help", -# "python scripts/can_logger.py --help", + "python3 -m can.logger --help", +# "python3 scripts/can_logger.py --help", ] # if IS_UNIX: # commands += ["can_logger.py --help"] @@ -86,8 +86,8 @@ class TestLoggerScript(CanScriptTest): class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.player --help", -# "python scripts/can_player.py --help", + "python3 -m can.player --help", +# "python3 scripts/can_player.py --help", ] # if IS_UNIX: # commands += ["can_player.py --help"] -- cgit v1.2.3 From 31da1629630f263a6cb9b6130faf7fb16726e00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 10 Sep 2019 15:19:19 +0200 Subject: Commit patch to update .gitignore [dgit (9.7) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 88 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 89 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..e7e2497 --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,88 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (9.7) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +deleted file mode 100644 +index 258ca73..0000000 +--- a/.gitignore ++++ /dev/null +@@ -1,74 +0,0 @@ +-test/__tempdir__/ +-.pytest_cache/ +-.mypy_cache/ +-.dmypy.json +-dmypy.json +- +-# ------------------------- +-# below: https://github.com/github/gitignore/blob/da00310ccba9de9a988cc973ef5238ad2c1460e9/Python.gitignore +- +-# Byte-compiled / optimized / DLL files +-__pycache__/ +-*.py[cod] +-*$py.class +- +-# C extensions +-*.so +- +-# Distribution / packaging +-.Python +-env/ +-venv/ +-build/ +-develop-eggs/ +-dist/ +-downloads/ +-eggs/ +-.eggs/ +-lib/ +-lib64/ +-parts/ +-sdist/ +-var/ +-*.egg-info/ +-.installed.cfg +-*.egg +- +-# PyInstaller +-# Usually these files are written by a python script from a template +-# before PyInstaller builds the exe, so as to inject date/other infos into it. +-*.manifest +-*.spec +- +-# Installer logs +-pip-log.txt +-pip-delete-this-directory.txt +- +-# Unit test / coverage reports +-htmlcov/ +-.tox/ +-.coverage +-.coverage.* +-.cache +-nosetests.xml +-coverage.xml +-*,cover +-.hypothesis/ +-test.* +- +-# Translations +-*.mo +-*.pot +- +-# Django stuff: +-*.log +- +-# Sphinx documentation +-doc/_build/ +- +-# PyBuilder +-target/ +- +-# IDEs +-.vscode/ +-.idea/ diff --git a/debian/patches/series b/debian/patches/series index c3f8761..3c1455a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ 0003-aenum-enum.patch 0004-sphinx-autodoc-typehints.patch 0005-python3.patch +auto-gitignore -- cgit v1.2.3 From 30607902a9f513c6bb13a37ff45ad228184b5f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 9 Oct 2018 20:56:41 +0200 Subject: removed broken pytest config from setup.cfg Gbp-Pq: Name 0001-removed-broken-pytest-config-from-setup.cfg.patch --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 49177e6..00caef6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,9 +7,6 @@ test=pytest [metadata] license_file = LICENSE.txt -[tool:pytest] -addopts = -v --timeout=300 --cov=can --cov-config=setup.cfg - [coverage:run] # we could also use branch coverage branch = False -- cgit v1.2.3 From 9f4c3f404271a7e660b8cf83f5e390fa68c49df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 16 Sep 2019 11:36:36 +0200 Subject: temporarily disable script tests Forwarded: not-needed Last-Update: 2019-02-11 Last-Update: 2019-02-11 Gbp-Pq: Name 0002-disable-broken-tests.patch --- test/test_scripts.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/test_scripts.py b/test/test_scripts.py index 74ae714..260a69f 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -73,10 +73,7 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.logger --help", - "python scripts/can_logger.py --help" ] - if IS_UNIX: - commands += ["can_logger.py --help"] return commands def _import(self): @@ -89,10 +86,7 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.player --help", - "python scripts/can_player.py --help" ] - if IS_UNIX: - commands += ["can_player.py --help"] return commands def _import(self): -- cgit v1.2.3 From e1f25cb02b88df3109de37aac73ee278da95c0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 16 Sep 2019 11:36:36 +0200 Subject: Use 'enum' library rather than 'aenum' Last-Update: 2019-09-10 On Debian we only ship python3-can with python>3.7... Last-Update: 2019-09-10 Gbp-Pq: Name 0003-aenum-enum.patch --- can/bus.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/can/bus.py b/can/bus.py index 2b36b3c..5af9465 100644 --- a/can/bus.py +++ b/can/bus.py @@ -11,7 +11,10 @@ import logging import threading from time import time from collections import namedtuple -from aenum import Enum, auto +try: + from aenum import Enum, auto +except ImportError: + from enum import Enum, auto from .broadcastmanager import ThreadBasedCyclicSendTask -- cgit v1.2.3 From 0c3a8ab9340d4221d62997ff24ae7417c2ed7708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 16 Sep 2019 11:36:36 +0200 Subject: use 'python3' instead of 'python' when calling scripts Origin: Debian Forwarded: not-needed Last-Update: 2019-09-10 also in the documentation Last-Update: 2019-09-10 Gbp-Pq: Name 0004-python3.patch --- can/logger.py | 2 +- can/player.py | 2 +- can/viewer.py | 12 ++++++------ doc/scripts.rst | 8 ++++---- test/test_scripts.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/can/logger.py b/can/logger.py index 204eb8d..3ac9ef9 100644 --- a/can/logger.py +++ b/can/logger.py @@ -29,7 +29,7 @@ from can import Bus, BusState, Logger def main(): parser = argparse.ArgumentParser( - "python -m can.logger", + "python3 -m can.logger", description="Log CAN traffic, printing messages to stdout or to a given file.") parser.add_argument("-f", "--file_name", dest="log_file", diff --git a/can/player.py b/can/player.py index c712f17..61e5d03 100644 --- a/can/player.py +++ b/can/player.py @@ -19,7 +19,7 @@ from can import Bus, LogReader, MessageSync def main(): parser = argparse.ArgumentParser( - "python -m can.player", + "python3 -m can.player", description="Replay CAN traffic.") parser.add_argument("-f", "--file_name", dest="log_file", diff --git a/can/viewer.py b/can/viewer.py index 316d3e3..16de2a6 100644 --- a/can/viewer.py +++ b/can/viewer.py @@ -326,7 +326,7 @@ def parse_args(args): kwargs = {'allow_abbrev': False} # Parse command line arguments - parser = argparse.ArgumentParser('python -m can.viewer', + parser = argparse.ArgumentParser('python3 -m can.viewer', description='A simple CAN viewer terminal application written in Python', epilog='R|Shortcuts: ' '\n +---------+-------------------------+' @@ -370,7 +370,7 @@ def parse_args(args): '\n q = int64_t, Q = uint64_t' '\n f = float (32-bits), d = double (64-bits)' '\nFx to convert six bytes with ID 0x100 into uint8_t, uint16 and uint32_t:' - '\n $ python -m can.viewer -d "100:: (matches when & mask == can_id & mask)' '\n ~ (matches when & mask != can_id & mask)' '\nFx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F:' - '\n python -m can.viewer -f 100:7FC 200:7F0' + '\n python3 -m can.viewer -f 100:7FC 200:7F0' '\nNote that the ID and mask are alway interpreted as hex values', metavar='{:,~}', nargs=argparse.ONE_OR_MORE, default='') diff --git a/doc/scripts.rst b/doc/scripts.rst index a63f1b1..d61efc2 100644 --- a/doc/scripts.rst +++ b/doc/scripts.rst @@ -3,7 +3,7 @@ Scripts The following modules are callable from python-can. -They can be called for example by ``python -m can.logger`` or ``can_logger.py`` (if installed using pip). +They can be called for example by ``python3 -m can.logger`` or ``can_logger.py`` (if installed using pip). can.logger ---------- @@ -11,13 +11,13 @@ can.logger Command line help, called with ``--help``: -.. command-output:: python -m can.logger -h +.. command-output:: python3 -m can.logger -h can.player ---------- -.. command-output:: python -m can.player -h +.. command-output:: python3 -m can.player -h can.viewer @@ -37,5 +37,5 @@ By default the ``can.viewer`` uses the :doc:`/interfaces/socketcan` interface. A The full usage page can be seen below: -.. command-output:: python -m can.viewer -h +.. command-output:: python3 -m can.viewer -h diff --git a/test/test_scripts.py b/test/test_scripts.py index 260a69f..c4a4f5a 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -72,7 +72,7 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.logger --help", + "python3 -m can.logger --help", ] return commands @@ -85,7 +85,7 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.player --help", + "python3 -m can.player --help", ] return commands -- cgit v1.2.3 From ae946a5fc0b217992dea3b9842b85c8eef5360c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 16 Sep 2019 11:36:36 +0200 Subject: Commit patch to update .gitignore [dgit (9.8) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 85 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 86 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..51073ea --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,85 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (9.8) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +deleted file mode 100644 +index 6b81342..0000000 +--- a/.gitignore ++++ /dev/null +@@ -1,71 +0,0 @@ +-test/__tempdir__/ +-.pytest_cache/ +- +-# ------------------------- +-# below: https://github.com/github/gitignore/blob/da00310ccba9de9a988cc973ef5238ad2c1460e9/Python.gitignore +- +-# Byte-compiled / optimized / DLL files +-__pycache__/ +-*.py[cod] +-*$py.class +- +-# C extensions +-*.so +- +-# Distribution / packaging +-.Python +-env/ +-venv/ +-build/ +-develop-eggs/ +-dist/ +-downloads/ +-eggs/ +-.eggs/ +-lib/ +-lib64/ +-parts/ +-sdist/ +-var/ +-*.egg-info/ +-.installed.cfg +-*.egg +- +-# PyInstaller +-# Usually these files are written by a python script from a template +-# before PyInstaller builds the exe, so as to inject date/other infos into it. +-*.manifest +-*.spec +- +-# Installer logs +-pip-log.txt +-pip-delete-this-directory.txt +- +-# Unit test / coverage reports +-htmlcov/ +-.tox/ +-.coverage +-.coverage.* +-.cache +-nosetests.xml +-coverage.xml +-*,cover +-.hypothesis/ +-test.* +- +-# Translations +-*.mo +-*.pot +- +-# Django stuff: +-*.log +- +-# Sphinx documentation +-doc/_build/ +- +-# PyBuilder +-target/ +- +-# IDEs +-.vscode/ +-.idea/ diff --git a/debian/patches/series b/debian/patches/series index eb1f623..4ff4650 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ 0002-disable-broken-tests.patch 0003-aenum-enum.patch 0004-python3.patch +auto-gitignore -- cgit v1.2.3 From 3717095a9c34f5a9895e0041c5721e038bdba686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 9 Oct 2018 20:56:41 +0200 Subject: removed broken pytest config from setup.cfg Gbp-Pq: Name 0001-removed-broken-pytest-config-from-setup.cfg.patch --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 49177e6..00caef6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,9 +7,6 @@ test=pytest [metadata] license_file = LICENSE.txt -[tool:pytest] -addopts = -v --timeout=300 --cov=can --cov-config=setup.cfg - [coverage:run] # we could also use branch coverage branch = False -- cgit v1.2.3 From 33c638fe74694988a3326158ca876eb1b887f43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 13 Jan 2020 11:22:58 +0100 Subject: temporarily disable script tests Forwarded: not-needed Last-Update: 2019-02-11 Last-Update: 2019-02-11 Gbp-Pq: Name 0002-disable-broken-tests.patch --- test/test_scripts.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/test_scripts.py b/test/test_scripts.py index 74ae714..260a69f 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -73,10 +73,7 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.logger --help", - "python scripts/can_logger.py --help" ] - if IS_UNIX: - commands += ["can_logger.py --help"] return commands def _import(self): @@ -89,10 +86,7 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.player --help", - "python scripts/can_player.py --help" ] - if IS_UNIX: - commands += ["can_player.py --help"] return commands def _import(self): -- cgit v1.2.3 From 50494c6deecbdeaf369c7bf8d8e9921990a7e1ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 13 Jan 2020 11:22:58 +0100 Subject: Use 'enum' library rather than 'aenum' Last-Update: 2019-09-10 On Debian we only ship python3-can with python>3.7... Last-Update: 2019-09-10 Gbp-Pq: Name 0003-aenum-enum.patch --- can/bus.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/can/bus.py b/can/bus.py index 2b36b3c..5af9465 100644 --- a/can/bus.py +++ b/can/bus.py @@ -11,7 +11,10 @@ import logging import threading from time import time from collections import namedtuple -from aenum import Enum, auto +try: + from aenum import Enum, auto +except ImportError: + from enum import Enum, auto from .broadcastmanager import ThreadBasedCyclicSendTask -- cgit v1.2.3 From c57d9b2ffc7326c1bc960c4808ccfaaa1dbec0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 13 Jan 2020 11:22:58 +0100 Subject: use 'python3' instead of 'python' when calling scripts Origin: Debian Forwarded: not-needed Last-Update: 2019-09-10 also in the documentation Last-Update: 2019-09-10 Gbp-Pq: Name 0004-python3.patch --- can/logger.py | 2 +- can/player.py | 2 +- can/viewer.py | 12 ++++++------ doc/scripts.rst | 8 ++++---- test/test_scripts.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/can/logger.py b/can/logger.py index 204eb8d..3ac9ef9 100644 --- a/can/logger.py +++ b/can/logger.py @@ -29,7 +29,7 @@ from can import Bus, BusState, Logger def main(): parser = argparse.ArgumentParser( - "python -m can.logger", + "python3 -m can.logger", description="Log CAN traffic, printing messages to stdout or to a given file.") parser.add_argument("-f", "--file_name", dest="log_file", diff --git a/can/player.py b/can/player.py index c712f17..61e5d03 100644 --- a/can/player.py +++ b/can/player.py @@ -19,7 +19,7 @@ from can import Bus, LogReader, MessageSync def main(): parser = argparse.ArgumentParser( - "python -m can.player", + "python3 -m can.player", description="Replay CAN traffic.") parser.add_argument("-f", "--file_name", dest="log_file", diff --git a/can/viewer.py b/can/viewer.py index 316d3e3..16de2a6 100644 --- a/can/viewer.py +++ b/can/viewer.py @@ -326,7 +326,7 @@ def parse_args(args): kwargs = {'allow_abbrev': False} # Parse command line arguments - parser = argparse.ArgumentParser('python -m can.viewer', + parser = argparse.ArgumentParser('python3 -m can.viewer', description='A simple CAN viewer terminal application written in Python', epilog='R|Shortcuts: ' '\n +---------+-------------------------+' @@ -370,7 +370,7 @@ def parse_args(args): '\n q = int64_t, Q = uint64_t' '\n f = float (32-bits), d = double (64-bits)' '\nFx to convert six bytes with ID 0x100 into uint8_t, uint16 and uint32_t:' - '\n $ python -m can.viewer -d "100:: (matches when & mask == can_id & mask)' '\n ~ (matches when & mask != can_id & mask)' '\nFx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F:' - '\n python -m can.viewer -f 100:7FC 200:7F0' + '\n python3 -m can.viewer -f 100:7FC 200:7F0' '\nNote that the ID and mask are alway interpreted as hex values', metavar='{:,~}', nargs=argparse.ONE_OR_MORE, default='') diff --git a/doc/scripts.rst b/doc/scripts.rst index a63f1b1..d61efc2 100644 --- a/doc/scripts.rst +++ b/doc/scripts.rst @@ -3,7 +3,7 @@ Scripts The following modules are callable from python-can. -They can be called for example by ``python -m can.logger`` or ``can_logger.py`` (if installed using pip). +They can be called for example by ``python3 -m can.logger`` or ``can_logger.py`` (if installed using pip). can.logger ---------- @@ -11,13 +11,13 @@ can.logger Command line help, called with ``--help``: -.. command-output:: python -m can.logger -h +.. command-output:: python3 -m can.logger -h can.player ---------- -.. command-output:: python -m can.player -h +.. command-output:: python3 -m can.player -h can.viewer @@ -37,5 +37,5 @@ By default the ``can.viewer`` uses the :doc:`/interfaces/socketcan` interface. A The full usage page can be seen below: -.. command-output:: python -m can.viewer -h +.. command-output:: python3 -m can.viewer -h diff --git a/test/test_scripts.py b/test/test_scripts.py index 260a69f..c4a4f5a 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -72,7 +72,7 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.logger --help", + "python3 -m can.logger --help", ] return commands @@ -85,7 +85,7 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.player --help", + "python3 -m can.player --help", ] return commands -- cgit v1.2.3 From 6789bc4bb098e20bf6b74117c49fc83b79ce2dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 13 Jan 2020 11:22:58 +0100 Subject: Commit patch to update .gitignore [dgit (9.9) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 85 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 86 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..02310ac --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,85 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (9.9) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +deleted file mode 100644 +index 6b81342..0000000 +--- a/.gitignore ++++ /dev/null +@@ -1,71 +0,0 @@ +-test/__tempdir__/ +-.pytest_cache/ +- +-# ------------------------- +-# below: https://github.com/github/gitignore/blob/da00310ccba9de9a988cc973ef5238ad2c1460e9/Python.gitignore +- +-# Byte-compiled / optimized / DLL files +-__pycache__/ +-*.py[cod] +-*$py.class +- +-# C extensions +-*.so +- +-# Distribution / packaging +-.Python +-env/ +-venv/ +-build/ +-develop-eggs/ +-dist/ +-downloads/ +-eggs/ +-.eggs/ +-lib/ +-lib64/ +-parts/ +-sdist/ +-var/ +-*.egg-info/ +-.installed.cfg +-*.egg +- +-# PyInstaller +-# Usually these files are written by a python script from a template +-# before PyInstaller builds the exe, so as to inject date/other infos into it. +-*.manifest +-*.spec +- +-# Installer logs +-pip-log.txt +-pip-delete-this-directory.txt +- +-# Unit test / coverage reports +-htmlcov/ +-.tox/ +-.coverage +-.coverage.* +-.cache +-nosetests.xml +-coverage.xml +-*,cover +-.hypothesis/ +-test.* +- +-# Translations +-*.mo +-*.pot +- +-# Django stuff: +-*.log +- +-# Sphinx documentation +-doc/_build/ +- +-# PyBuilder +-target/ +- +-# IDEs +-.vscode/ +-.idea/ diff --git a/debian/patches/series b/debian/patches/series index eb1f623..4ff4650 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ 0002-disable-broken-tests.patch 0003-aenum-enum.patch 0004-python3.patch +auto-gitignore -- cgit v1.2.3 From c6c4eb02b63ee5f1724a2a49d10e7714f6959ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Tue, 9 Oct 2018 20:56:41 +0200 Subject: removed broken pytest config from setup.cfg Gbp-Pq: Name 0001-removed-broken-pytest-config-from-setup.cfg.patch --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 49177e6..6d3531b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,7 +8,6 @@ test=pytest license_file = LICENSE.txt [tool:pytest] -addopts = -v --timeout=300 --cov=can --cov-config=setup.cfg [coverage:run] # we could also use branch coverage -- cgit v1.2.3 From f9a8f9696b366fc7839d96fb6d6621dc317844c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Fri, 27 Mar 2020 20:57:21 +0100 Subject: temporarily disable script tests Forwarded: not-needed Last-Update: 2019-02-11 Last-Update: 2019-02-11 Gbp-Pq: Name 0002-disable-broken-tests.patch --- test/test_scripts.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/test_scripts.py b/test/test_scripts.py index 74ae714..260a69f 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -73,10 +73,7 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.logger --help", - "python scripts/can_logger.py --help" ] - if IS_UNIX: - commands += ["can_logger.py --help"] return commands def _import(self): @@ -89,10 +86,7 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.player --help", - "python scripts/can_player.py --help" ] - if IS_UNIX: - commands += ["can_player.py --help"] return commands def _import(self): -- cgit v1.2.3 From 35c315043530909243169a29346c93067f884ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Fri, 27 Mar 2020 20:57:21 +0100 Subject: Use 'enum' library rather than 'aenum' Last-Update: 2019-09-10 On Debian we only ship python3-can with python>3.7... Last-Update: 2019-09-10 Gbp-Pq: Name 0003-aenum-enum.patch --- can/bus.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/can/bus.py b/can/bus.py index 2b36b3c..5af9465 100644 --- a/can/bus.py +++ b/can/bus.py @@ -11,7 +11,10 @@ import logging import threading from time import time from collections import namedtuple -from aenum import Enum, auto +try: + from aenum import Enum, auto +except ImportError: + from enum import Enum, auto from .broadcastmanager import ThreadBasedCyclicSendTask -- cgit v1.2.3 From 94534f1466e3e394002608ba28e0b620880d4e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Fri, 27 Mar 2020 20:57:21 +0100 Subject: use 'python3' instead of 'python' when calling scripts Origin: Debian Forwarded: not-needed Last-Update: 2019-09-10 also in the documentation Last-Update: 2019-09-10 Gbp-Pq: Name 0004-python3.patch --- can/logger.py | 2 +- can/player.py | 2 +- can/viewer.py | 12 ++++++------ doc/scripts.rst | 8 ++++---- test/test_scripts.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/can/logger.py b/can/logger.py index 204eb8d..3ac9ef9 100644 --- a/can/logger.py +++ b/can/logger.py @@ -29,7 +29,7 @@ from can import Bus, BusState, Logger def main(): parser = argparse.ArgumentParser( - "python -m can.logger", + "python3 -m can.logger", description="Log CAN traffic, printing messages to stdout or to a given file.") parser.add_argument("-f", "--file_name", dest="log_file", diff --git a/can/player.py b/can/player.py index c712f17..61e5d03 100644 --- a/can/player.py +++ b/can/player.py @@ -19,7 +19,7 @@ from can import Bus, LogReader, MessageSync def main(): parser = argparse.ArgumentParser( - "python -m can.player", + "python3 -m can.player", description="Replay CAN traffic.") parser.add_argument("-f", "--file_name", dest="log_file", diff --git a/can/viewer.py b/can/viewer.py index 316d3e3..16de2a6 100644 --- a/can/viewer.py +++ b/can/viewer.py @@ -326,7 +326,7 @@ def parse_args(args): kwargs = {'allow_abbrev': False} # Parse command line arguments - parser = argparse.ArgumentParser('python -m can.viewer', + parser = argparse.ArgumentParser('python3 -m can.viewer', description='A simple CAN viewer terminal application written in Python', epilog='R|Shortcuts: ' '\n +---------+-------------------------+' @@ -370,7 +370,7 @@ def parse_args(args): '\n q = int64_t, Q = uint64_t' '\n f = float (32-bits), d = double (64-bits)' '\nFx to convert six bytes with ID 0x100 into uint8_t, uint16 and uint32_t:' - '\n $ python -m can.viewer -d "100:: (matches when & mask == can_id & mask)' '\n ~ (matches when & mask != can_id & mask)' '\nFx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F:' - '\n python -m can.viewer -f 100:7FC 200:7F0' + '\n python3 -m can.viewer -f 100:7FC 200:7F0' '\nNote that the ID and mask are alway interpreted as hex values', metavar='{:,~}', nargs=argparse.ONE_OR_MORE, default='') diff --git a/doc/scripts.rst b/doc/scripts.rst index a63f1b1..d61efc2 100644 --- a/doc/scripts.rst +++ b/doc/scripts.rst @@ -3,7 +3,7 @@ Scripts The following modules are callable from python-can. -They can be called for example by ``python -m can.logger`` or ``can_logger.py`` (if installed using pip). +They can be called for example by ``python3 -m can.logger`` or ``can_logger.py`` (if installed using pip). can.logger ---------- @@ -11,13 +11,13 @@ can.logger Command line help, called with ``--help``: -.. command-output:: python -m can.logger -h +.. command-output:: python3 -m can.logger -h can.player ---------- -.. command-output:: python -m can.player -h +.. command-output:: python3 -m can.player -h can.viewer @@ -37,5 +37,5 @@ By default the ``can.viewer`` uses the :doc:`/interfaces/socketcan` interface. A The full usage page can be seen below: -.. command-output:: python -m can.viewer -h +.. command-output:: python3 -m can.viewer -h diff --git a/test/test_scripts.py b/test/test_scripts.py index 260a69f..c4a4f5a 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -72,7 +72,7 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.logger --help", + "python3 -m can.logger --help", ] return commands @@ -85,7 +85,7 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ - "python -m can.player --help", + "python3 -m can.player --help", ] return commands -- cgit v1.2.3 From f220faf0002f23c2f27a24d10b507fa182198146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 10 Jan 2022 09:50:03 +0100 Subject: Python3.10 compat Origin: Debian Forwarded: not-needed Last-Update: 2022-01-10 with Py3.10, the asyncio.Queue() no longer has a 'loop' argument if we encoutner one, we through a bug fat warning Last-Update: 2022-01-10 Gbp-Pq: Name 0005-python310.patch --- can/listener.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/can/listener.py b/can/listener.py index a91b1da..8e3f73e 100644 --- a/can/listener.py +++ b/can/listener.py @@ -147,7 +147,13 @@ if asyncio is not None: def __init__(self, loop=None): # set to "infinite" size - self.buffer = asyncio.Queue(loop=loop) + try: + self.buffer = asyncio.Queue(loop=loop) + except TypeError: # Python3.10 has removed the 'loop' argument + if loop != None: + import logging + logging.getLogger(__name__).fatal("ignoring loop-argument to %s for Python>=3.10" % (self,)) + self.buffer = asyncio.Queue() def on_message_received(self, msg): """Append a message to the buffer. -- cgit v1.2.3 From 7b9694c1112ab6390b8a658375997c993545c14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Mon, 10 Jan 2022 13:41:39 +0100 Subject: Commit patch to update .gitignore [dgit (9.15) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 85 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 86 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..131d69a --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,85 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (9.15) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +deleted file mode 100644 +index 6b81342..0000000 +--- a/.gitignore ++++ /dev/null +@@ -1,71 +0,0 @@ +-test/__tempdir__/ +-.pytest_cache/ +- +-# ------------------------- +-# below: https://github.com/github/gitignore/blob/da00310ccba9de9a988cc973ef5238ad2c1460e9/Python.gitignore +- +-# Byte-compiled / optimized / DLL files +-__pycache__/ +-*.py[cod] +-*$py.class +- +-# C extensions +-*.so +- +-# Distribution / packaging +-.Python +-env/ +-venv/ +-build/ +-develop-eggs/ +-dist/ +-downloads/ +-eggs/ +-.eggs/ +-lib/ +-lib64/ +-parts/ +-sdist/ +-var/ +-*.egg-info/ +-.installed.cfg +-*.egg +- +-# PyInstaller +-# Usually these files are written by a python script from a template +-# before PyInstaller builds the exe, so as to inject date/other infos into it. +-*.manifest +-*.spec +- +-# Installer logs +-pip-log.txt +-pip-delete-this-directory.txt +- +-# Unit test / coverage reports +-htmlcov/ +-.tox/ +-.coverage +-.coverage.* +-.cache +-nosetests.xml +-coverage.xml +-*,cover +-.hypothesis/ +-test.* +- +-# Translations +-*.mo +-*.pot +- +-# Django stuff: +-*.log +- +-# Sphinx documentation +-doc/_build/ +- +-# PyBuilder +-target/ +- +-# IDEs +-.vscode/ +-.idea/ diff --git a/debian/patches/series b/debian/patches/series index db06ec3..b126f81 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ 0003-aenum-enum.patch 0004-python3.patch 0005-python310.patch +auto-gitignore -- cgit v1.2.3 From 6c758ba4491e557afdeec1adc1db492397664e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Thu, 7 Jul 2022 12:16:10 +0200 Subject: removed broken pytest config Origin: Debian Forwarded: not-needed Last-Update: 2022-07-06 we don't do coverage testing on Debian Last-Update: 2022-07-06 Gbp-Pq: Name 0001-remove-broken-pytest-config.patch --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 6b407df..b2650ce 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ commands_post = [pytest] testpaths = test -addopts = -v --timeout=300 --cov=can --cov-config=tox.ini --cov-report=xml --cov-report=term +addopts = -v --timeout=300 [coverage:run] -- cgit v1.2.3 From b99a9ba058bbab7016572b24581226274b9f470d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Fri, 27 Mar 2020 20:57:21 +0100 Subject: temporarily disable script tests Forwarded: not-needed Last-Update: 2019-02-11 Last-Update: 2019-02-11 Gbp-Pq: Name 0002-disable-broken-tests.patch --- test/test_scripts.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/test_scripts.py b/test/test_scripts.py index a22820b..4a5b1f1 100644 --- a/test/test_scripts.py +++ b/test/test_scripts.py @@ -74,10 +74,7 @@ class TestLoggerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.logger --help", - "python scripts/can_logger.py --help", ] - if IS_UNIX: - commands += ["can_logger.py --help"] return commands def _import(self): @@ -90,10 +87,7 @@ class TestPlayerScript(CanScriptTest): def _commands(self): commands = [ "python -m can.player --help", - "python scripts/can_player.py --help", ] - if IS_UNIX: - commands += ["can_player.py --help"] return commands def _import(self): @@ -106,10 +100,7 @@ class TestLogconvertScript(CanScriptTest): def _commands(self): commands = [ "python -m can.logconvert --help", - "python scripts/can_logconvert.py --help", ] - if IS_UNIX: - commands += ["can_logconvert.py --help"] return commands def _import(self): -- cgit v1.2.3 From 5aea7ff08401c775733405c3ab5378e41fcb9729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Thu, 7 Jul 2022 12:16:10 +0200 Subject: Fix assertions with pytest.approx() Origin: upstream Applied-Upstream: 1693c27ea751958260a9c162727af1790c28b006 Last-Update: 2022-07-06 Last-Update: 2022-07-06 Gbp-Pq: Name 0003-fix-pytest-approxassertion.patch --- test/test_viewer.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/test_viewer.py b/test/test_viewer.py index 20c3d2f..73cb9be 100644 --- a/test/test_viewer.py +++ b/test/test_viewer.py @@ -251,8 +251,7 @@ class CanViewerTest(unittest.TestCase): if _id["dt"] == 0: self.assertEqual(_id["count"], 1) else: - self.assertTrue( - pytest.approx(_id["dt"], 0.1) + assert _id["dt"] == pytest.approx(0.1, abs=5e-2 ) # dt should be ~0.1 s self.assertEqual(_id["count"], 2) else: @@ -347,7 +346,7 @@ class CanViewerTest(unittest.TestCase): raw_data = self.pack_data(CANOPEN_TPDO2 + 1, data_structs, 12.34, 4.5, 6) parsed_data = CanViewer.unpack_data(CANOPEN_TPDO2 + 1, data_structs, raw_data) - self.assertTrue(pytest.approx(parsed_data, [12.34, 4.5, 6])) + assert parsed_data == pytest.approx([12.34, 4.5, 6]) self.assertTrue( isinstance(parsed_data[0], float) and isinstance(parsed_data[1], float) @@ -356,14 +355,14 @@ class CanViewerTest(unittest.TestCase): raw_data = self.pack_data(CANOPEN_TPDO3 + 1, data_structs, 123.45, 67.89) parsed_data = CanViewer.unpack_data(CANOPEN_TPDO3 + 1, data_structs, raw_data) - self.assertTrue(pytest.approx(parsed_data, [123.45, 67.89])) + assert parsed_data == pytest.approx([123.45, 67.89]) self.assertTrue(all(isinstance(d, float) for d in parsed_data)) raw_data = self.pack_data( CANOPEN_TPDO4 + 1, data_structs, math.pi / 2.0, math.pi ) parsed_data = CanViewer.unpack_data(CANOPEN_TPDO4 + 1, data_structs, raw_data) - self.assertTrue(pytest.approx(parsed_data, [math.pi / 2.0, math.pi])) + assert parsed_data == pytest.approx([math.pi / 2.0, math.pi]) self.assertTrue(all(isinstance(d, float) for d in parsed_data)) raw_data = self.pack_data(CANOPEN_TPDO1 + 2, data_structs) -- cgit v1.2.3 From bc15b0f8b0a9d8e5d96bf4b77ea62d5c997dc8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Fri, 27 Mar 2020 20:57:21 +0100 Subject: use 'python3' instead of 'python' when calling scripts Origin: Debian Forwarded: not-needed Last-Update: 2019-09-10 also in the documentation Last-Update: 2019-09-10 Gbp-Pq: Name 0004-python3.patch --- can/logger.py | 2 +- can/viewer.py | 10 +++++----- doc/scripts.rst | 10 +++++----- test/test_scripts.py | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/can/logger.py b/can/logger.py index 0530019..07818a4 100644 --- a/can/logger.py +++ b/can/logger.py @@ -85,7 +85,7 @@ def _append_filter_argument( "\n : (matches when & mask == can_id & mask)" "\n ~ (matches when & mask != can_id & mask)" "\nFx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F:" - "\n python -m can.viewer -f 100:7FC 200:7F0" + "\n python3 -m can.viewer -f 100:7FC 200:7F0" "\nNote that the ID and mask are always interpreted as hex values", metavar="{:,~}", nargs=argparse.ONE_OR_MORE, diff --git a/can/viewer.py b/can/viewer.py index a84c865..b12319e 100644 --- a/can/viewer.py +++ b/can/viewer.py @@ -393,7 +393,7 @@ class SmartFormatter(argparse.HelpFormatter): def parse_args(args): # Parse command line arguments parser = argparse.ArgumentParser( - "python -m can.viewer", + "python3 -m can.viewer", description="A simple CAN viewer terminal application written in Python", epilog="R|Shortcuts: " "\n +---------+-------------------------------+" @@ -446,7 +446,7 @@ def parse_args(args): "\n q = int64_t, Q = uint64_t" "\n f = float (32-bits), d = double (64-bits)" "\nFx to convert six bytes with ID 0x100 into uint8_t, uint16 and uint32_t:" - '\n $ python -m can.viewer -d "100: Date: Thu, 7 Jul 2022 12:16:10 +0200 Subject: sort VALID_INTERFACES Bug: https://github.com/hardbyte/python-can/pull/1342 Last-Update: 2022-07-07 VALID_INTERFACES are an unordered set, but the list ends up in the documentation. to make the docs reproducible, we order the names before displaying them. Last-Update: 2022-07-07 Gbp-Pq: Name 0005-reproducible-interfaces.patch --- can/logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/can/logger.py b/can/logger.py index 07818a4..7b33049 100644 --- a/can/logger.py +++ b/can/logger.py @@ -42,7 +42,7 @@ def _create_base_argument_parser(parser: argparse.ArgumentParser) -> None: dest="interface", help="""Specify the backend CAN interface to use. If left blank, fall back to reading from configuration files.""", - choices=can.VALID_INTERFACES, + choices=sorted(can.VALID_INTERFACES), ) parser.add_argument( -- cgit v1.2.3 From 0418839b19106ea595b0158b1257f46946a44033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Thu, 7 Jul 2022 12:16:10 +0200 Subject: Drop 'canalystii' depending tests,... Origin: Debian Forwarded: not-needed Last-Update: 2022-07-06 Once python-canalystii is packaged, consider re-adding them Last-Update: 2022-07-06 Gbp-Pq: Name 0010-canalystii.patch --- test/test_interface_canalystii.py | 103 -------------------------------------- 1 file changed, 103 deletions(-) delete mode 100755 test/test_interface_canalystii.py diff --git a/test/test_interface_canalystii.py b/test/test_interface_canalystii.py deleted file mode 100755 index 4674736..0000000 --- a/test/test_interface_canalystii.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python - -""" -""" - -import time -import unittest -from unittest.mock import Mock, patch, call -from ctypes import c_ubyte - -import canalystii as driver # low-level driver module, mock out this layer -import can -from can.interfaces.canalystii import CANalystIIBus - - -def create_mock_device(): - return patch("canalystii.CanalystDevice") - - -class CanalystIITest(unittest.TestCase): - def test_initialize_from_constructor(self): - with create_mock_device() as mock_device: - instance = mock_device.return_value - bus = CANalystIIBus(bitrate=1000000) - instance.init.assert_has_calls( - [ - call(0, bitrate=1000000), - call(1, bitrate=1000000), - ] - ) - - def test_initialize_single_channel_only(self): - for channel in 0, 1: - with create_mock_device() as mock_device: - instance = mock_device.return_value - bus = CANalystIIBus(channel, bitrate=1000000) - instance.init.assert_called_once_with(channel, bitrate=1000000) - - def test_initialize_with_timing_registers(self): - with create_mock_device() as mock_device: - instance = mock_device.return_value - timing = can.BitTiming(btr0=0x03, btr1=0x6F) - bus = CANalystIIBus(bitrate=None, bit_timing=timing) - instance.init.assert_has_calls( - [ - call(0, timing0=0x03, timing1=0x6F), - call(1, timing0=0x03, timing1=0x6F), - ] - ) - - def test_missing_bitrate(self): - with self.assertRaises(ValueError) as cm: - bus = CANalystIIBus(0, bitrate=None, bit_timing=None) - self.assertIn("bitrate", str(cm.exception)) - - def test_invalid_bit_timing(self): - with create_mock_device() as mock_device: - with self.assertRaises(ValueError) as cm: - invalid_timings = can.BitTiming() - CANalystIIBus(0, bit_timing=invalid_timings) - - def test_receive_message(self): - driver_message = driver.Message( - can_id=0x333, - timestamp=1000000, - time_flag=1, - send_type=0, - remote=False, - extended=False, - data_len=8, - data=(c_ubyte * 8)(*range(8)), - ) - - with create_mock_device() as mock_device: - instance = mock_device.return_value - instance.receive.return_value = [driver_message] - bus = CANalystIIBus(bitrate=1000000) - msg = bus.recv(0) - self.assertEqual(driver_message.can_id, msg.arbitration_id) - self.assertEqual(bytearray(driver_message.data), msg.data) - - def test_send_message(self): - message = can.Message(arbitration_id=0x123, data=[3] * 8, is_extended_id=False) - - with create_mock_device() as mock_device: - instance = mock_device.return_value - bus = CANalystIIBus(channel=0, bitrate=5000000) - bus.send(message) - instance.send.assert_called_once() - - (channel, driver_messages, _timeout), _kwargs = instance.send.call_args - self.assertEqual(0, channel) - - self.assertEqual(1, len(driver_messages)) - - driver_message = driver_messages[0] - self.assertEqual(message.arbitration_id, driver_message.can_id) - self.assertEqual(message.data, bytearray(driver_message.data)) - self.assertEqual(8, driver_message.data_len) - - -if __name__ == "__main__": - unittest.main() -- cgit v1.2.3 From dfdacd815f25d9f9557a8cb1117831a9288f3fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?= Date: Thu, 7 Jul 2022 12:16:10 +0200 Subject: Commit patch to update .gitignore [dgit (9.16) update-gitignore-quilt-fixup] --- debian/patches/auto-gitignore | 88 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 89 insertions(+) create mode 100644 debian/patches/auto-gitignore diff --git a/debian/patches/auto-gitignore b/debian/patches/auto-gitignore new file mode 100644 index 0000000..560cd3d --- /dev/null +++ b/debian/patches/auto-gitignore @@ -0,0 +1,88 @@ +Subject: Update .gitignore from Debian packaging branch + +The Debian packaging git branch contains these updates to the upstream +.gitignore file(s). This patch is autogenerated, to provide these +updates to users of the official Debian archive view of the package. + +[dgit (9.16) update-gitignore] +--- +diff --git a/.gitignore b/.gitignore +deleted file mode 100644 +index 258ca73..0000000 +--- a/.gitignore ++++ /dev/null +@@ -1,74 +0,0 @@ +-test/__tempdir__/ +-.pytest_cache/ +-.mypy_cache/ +-.dmypy.json +-dmypy.json +- +-# ------------------------- +-# below: https://github.com/github/gitignore/blob/da00310ccba9de9a988cc973ef5238ad2c1460e9/Python.gitignore +- +-# Byte-compiled / optimized / DLL files +-__pycache__/ +-*.py[cod] +-*$py.class +- +-# C extensions +-*.so +- +-# Distribution / packaging +-.Python +-env/ +-venv/ +-build/ +-develop-eggs/ +-dist/ +-downloads/ +-eggs/ +-.eggs/ +-lib/ +-lib64/ +-parts/ +-sdist/ +-var/ +-*.egg-info/ +-.installed.cfg +-*.egg +- +-# PyInstaller +-# Usually these files are written by a python script from a template +-# before PyInstaller builds the exe, so as to inject date/other infos into it. +-*.manifest +-*.spec +- +-# Installer logs +-pip-log.txt +-pip-delete-this-directory.txt +- +-# Unit test / coverage reports +-htmlcov/ +-.tox/ +-.coverage +-.coverage.* +-.cache +-nosetests.xml +-coverage.xml +-*,cover +-.hypothesis/ +-test.* +- +-# Translations +-*.mo +-*.pot +- +-# Django stuff: +-*.log +- +-# Sphinx documentation +-doc/_build/ +- +-# PyBuilder +-target/ +- +-# IDEs +-.vscode/ +-.idea/ diff --git a/debian/patches/series b/debian/patches/series index be7b467..d8d8914 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ 0004-python3.patch 0005-reproducible-interfaces.patch 0010-canalystii.patch +auto-gitignore -- cgit v1.2.3