From 5179b5cbe94eabd2d47a5c66fb79244d1904d090 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 3 Apr 2020 11:16:51 -0400 Subject: [PATCH] gnu: Add python-cantools. * gnu/packages/python-xyz.scm (python-cantools): New variable. --- gnu/packages/python-xyz.scm | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index cd431e401f..d98b38411f 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -1247,6 +1247,68 @@ (define-public python-bitstruct bits instead of primitive data types like @code{char}, @code{int}, etc.") (license license:expat))) +(define-public python-cantools + (package + (name "python-cantools") + (version "33.1.1") + (source + (origin + ;; We take the sources from the Git repository as the documentation is + ;; not included with the PyPI archive. + (method git-fetch) + (uri (git-reference + (url "https://github.com/eerimoq/cantools.git") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1aad137yd8b4jkfvlv812qsxmxcgra7g1p4wbxfsjy1cbf8fbq9q")))) + (build-system python-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'build 'build-doc + (lambda _ + ;; See: https://github.com/eerimoq/cantools/issues/190. + (substitute* "README.rst" + (("https://github.com/eerimoq/cantools/raw/master\ +/docs/monitor.png") + "monitor.png")) + (with-directory-excursion "docs" + (invoke "make" "man" "info")))) + (add-after 'install 'install-doc + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (info (string-append out "/share/info")) + (man1 (string-append out "/share/man/man1"))) + (format #t "CWD: ~s~%" (getcwd)) + (install-file "docs/_build/texinfo/cantools.info" info) + (install-file "docs/_build/man/cantools.1" man1) + #t)))))) + (native-inputs + `(("sphinx" ,python-sphinx) + ("texinfo" ,texinfo))) + (propagated-inputs + `(("python-bitstruct" ,python-bitstruct) + ("python-can" ,python-can) + ("python-diskcache" ,python-diskcache) + ("python-textparser" ,python-textparser))) + (home-page "https://github.com/eerimoq/cantools") + (synopsis "Tools for the Controller Area Network (CAN) bus protocol") + (description "This package includes Controller Area Network (CAN) related +tools that can be used to: +@itemize +@item parse DBC, KCD, SYM, ARXML 4 and CDD files +@item encode and decode CAN messages +@item multiplex simple and extended signals +@item diagnose DID encoding and decoding +@item dump the CAN decoder output +@item test CAN nodes +@item generate C source code +@item monitor the CAN bus +@end itemize") + (license license:expat))) + (define-public python-capturer (package (name "python-capturer")