diff options
| author | Romain GARBAGE <romain.garbage@inria.fr> | 2026-01-15 16:14:22 +0100 |
|---|---|---|
| committer | Romain GARBAGE <romain.garbage@inria.fr> | 2026-01-19 10:00:36 +0100 |
| commit | ece86fa4ddfb7b26dd11f4d41d7e976d302e8733 (patch) | |
| tree | faa233a7db64b093e0072513135fa15d8d2141a6 | |
| parent | 884f8912a3ff18beca3eb4f197b817eb05be8229 (diff) | |
cpp: Add cpp-docopt.
* guix-science/packages/cpp.scm (cpp-docopt): New variable.
| -rw-r--r-- | guix-science/packages/cpp.scm | 40 | ||||
| -rw-r--r-- | patches/cpp-docopt-python3-support-for-tests.patch | 53 |
2 files changed, 93 insertions, 0 deletions
diff --git a/guix-science/packages/cpp.scm b/guix-science/packages/cpp.scm index 03be237..3e9481d 100644 --- a/guix-science/packages/cpp.scm +++ b/guix-science/packages/cpp.scm | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #:use-module (guix build-system cmake) | 10 | #:use-module (guix build-system cmake) |
| 11 | #:use-module (guix-science packages algebra) | 11 | #:use-module (guix-science packages algebra) |
| 12 | #:use-module (guix-science packages serialization) | 12 | #:use-module (guix-science packages serialization) |
| 13 | #:use-module (gnu packages) | ||
| 13 | #:use-module (gnu packages algebra) | 14 | #:use-module (gnu packages algebra) |
| 14 | #:use-module (gnu packages bash) | 15 | #:use-module (gnu packages bash) |
| 15 | #:use-module (gnu packages benchmark) | 16 | #:use-module (gnu packages benchmark) |
| @@ -56,6 +57,45 @@ | |||
| 56 | argument handling library for C++11/14/17 contained in a single header file.") | 57 | argument handling library for C++11/14/17 contained in a single header file.") |
| 57 | (license license:expat)))) | 58 | (license license:expat)))) |
| 58 | 59 | ||
| 60 | (define-public cpp-docopt | ||
| 61 | (package | ||
| 62 | (name "cpp-docopt") | ||
| 63 | (version "0.6.3") | ||
| 64 | (home-page "https://github.com/docopt/docopt.cpp") | ||
| 65 | (source | ||
| 66 | (origin | ||
| 67 | (method git-fetch) | ||
| 68 | (uri (git-reference | ||
| 69 | (url home-page) | ||
| 70 | (commit (string-append "v" version)))) | ||
| 71 | (file-name (git-file-name name version)) | ||
| 72 | (sha256 | ||
| 73 | (base32 "0cz3vv7g5snfbsqcf3q8bmd6kv5qp84gj3avwkn4vl00krw13bl7")) | ||
| 74 | (patches | ||
| 75 | (search-patches "patches/cpp-docopt-python3-support-for-tests.patch")))) | ||
| 76 | (build-system cmake-build-system) | ||
| 77 | (arguments | ||
| 78 | (list #:configure-flags | ||
| 79 | #~(list "-DWITH_TESTS=ON") | ||
| 80 | #:phases | ||
| 81 | #~(modify-phases %standard-phases | ||
| 82 | (replace 'check | ||
| 83 | (lambda* (#:key tests? #:allow-other-keys) | ||
| 84 | (when tests? | ||
| 85 | (invoke "./run_tests"))))))) | ||
| 86 | (native-inputs | ||
| 87 | (list python)) | ||
| 88 | (synopsis "C++11 port of docopt, a Python command-line interface library") | ||
| 89 | (description | ||
| 90 | "cpp-docopt helps you: | ||
| 91 | @itemize | ||
| 92 | @item define the interface for your command-line app, and | ||
| 93 | @item automatically generate a parser for it. | ||
| 94 | @end itemize | ||
| 95 | cpp-docopt is based on conventions that have been used for decades in help messages | ||
| 96 | and man pages for describing a program's interface.") | ||
| 97 | (license (list license:expat license:boost1.0)))) | ||
| 98 | |||
| 59 | (define-public cpp-member-accessor | 99 | (define-public cpp-member-accessor |
| 60 | (package | 100 | (package |
| 61 | (name "cpp-member-accessor") | 101 | (name "cpp-member-accessor") |
diff --git a/patches/cpp-docopt-python3-support-for-tests.patch b/patches/cpp-docopt-python3-support-for-tests.patch new file mode 100644 index 0000000..614d6d0 --- /dev/null +++ b/patches/cpp-docopt-python3-support-for-tests.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | From 400e6dd8e59196c914dcc2c56caf7dae7efa5eb3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Petr Mensik <pemensik@redhat.com> | ||
| 3 | Date: Fri, 12 Nov 2021 14:05:32 +0100 | ||
| 4 | Subject: [PATCH] Support python3 for running tests | ||
| 5 | |||
| 6 | Simple change done by 2to3 python tool. Make prints compatible with both | ||
| 7 | python3 and python2. | ||
| 8 | |||
| 9 | Change default version to python3. Still can be run by python2 | ||
| 10 | run_tests.py. | ||
| 11 | |||
| 12 | Signed-off-by: Petr Mensik <pemensik@redhat.com> | ||
| 13 | --- | ||
| 14 | run_tests.py | 20 ++++++++++---------- | ||
| 15 | 1 file changed, 10 insertions(+), 10 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/run_tests.py b/run_tests.py | ||
| 18 | index ef723b4..b75e176 100755 | ||
| 19 | --- a/run_tests.py | ||
| 20 | +++ b/run_tests.py | ||
| 21 | @@ -1,4 +1,4 @@ | ||
| 22 | -#!/usr/bin/env python2 | ||
| 23 | +#!/usr/bin/env python3 | ||
| 24 | |||
| 25 | import re | ||
| 26 | import sys | ||
| 27 | @@ -56,17 +56,17 @@ def parse_test(raw): | ||
| 28 | |||
| 29 | failures += 1 | ||
| 30 | |||
| 31 | - print "="*40 | ||
| 32 | - print doc | ||
| 33 | - print ':'*20 | ||
| 34 | - print prog, argv | ||
| 35 | - print '-'*20 | ||
| 36 | + print("="*40) | ||
| 37 | + print(doc) | ||
| 38 | + print(':'*20) | ||
| 39 | + print(prog, argv) | ||
| 40 | + print('-'*20) | ||
| 41 | if out: | ||
| 42 | - print out | ||
| 43 | - print error | ||
| 44 | + print(out) | ||
| 45 | + print(error) | ||
| 46 | |||
| 47 | if failures: | ||
| 48 | - print "%d failures" % failures | ||
| 49 | + print("%d failures" % failures) | ||
| 50 | sys.exit(1) | ||
| 51 | else: | ||
| 52 | - print "PASS (%d)" % passes | ||
| 53 | + print("PASS (%d)" % passes) | ||
