diff --git a/gnu/local.mk b/gnu/local.mk index 11e16c2a16..60ee713508 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1706,6 +1706,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-pytorch-system-libraries.patch \ %D%/packages/patches/python-pytorch-1.9.0-system-libraries.patch \ %D%/packages/patches/python-robotframework-source-date-epoch.patch \ + %D%/packages/patches/python-robotframework-ug2html.patch \ %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \ %D%/packages/patches/python-seaborn-kde-test.patch \ %D%/packages/patches/python-seaborn-2690.patch \ diff --git a/gnu/packages/patches/python-robotframework-ug2html.patch b/gnu/packages/patches/python-robotframework-ug2html.patch new file mode 100644 index 0000000000..eea88e01f3 --- /dev/null +++ b/gnu/packages/patches/python-robotframework-ug2html.patch @@ -0,0 +1,57 @@ +Do not require the obsolete robotframeworklexer. + +Submitted upstream at: https://github.com/robotframework/robotframework/pull/4265. +diff --git a/doc/userguide/ug2html.py b/doc/userguide/ug2html.py +index 43cdb31bd..033203552 100755 +--- a/doc/userguide/ug2html.py ++++ b/doc/userguide/ug2html.py +@@ -93,34 +93,26 @@ from docutils.parsers.rst import directives + from pygments import highlight, __version__ as pygments_version + from pygments.lexers import get_lexer_by_name + +-# Use latest version, not version bundled with Pygments +-import robotframeworklexer +- + + def too_old(version_string, minimum): + version = tuple(int(v) for v in version_string.split('.')[:2]) + return version < minimum + + +-if too_old(getattr(robotframeworklexer, '__version__', '1.0'), (1, 1)): +- sys.exit('robotframeworklexer >= 1.1 is required.') +-if too_old(pygments_version, (2, 1)): +- sys.exit('Pygments >= 2.1 is required.') ++if too_old(pygments_version, (2, 8)): ++ sys.exit('Pygments >= 2.8 is required.') + + + def pygments_directive(name, arguments, options, content, lineno, + content_offset, block_text, state, state_machine): + try: +- if arguments[0] == 'robotframework': +- lexer = robotframeworklexer.RobotFrameworkLexer() +- else: +- lexer = get_lexer_by_name(arguments[0]) ++ lexer = get_lexer_by_name(arguments[0]) + except ValueError as err: + raise ValueError(f'Invalid syntax highlighting language "{arguments[0]}".') + # take an arbitrary option if more than one is given + formatter = options and VARIANTS[options.keys()[0]] or DEFAULT + # possibility to read the content from an external file +- filtered = [ line for line in content if line.strip() ] ++ filtered = [line for line in content if line.strip()] + if len(filtered) == 1: + path = filtered[0].replace('/', os.sep) + if os.path.isfile(path): +diff --git a/requirements-build.txt b/requirements-build.txt +index e0f5e19a2..a2fcdcfd5 100644 +--- a/requirements-build.txt ++++ b/requirements-build.txt +@@ -5,5 +5,4 @@ rellu >= 0.7 + twine >= 1.12 + wheel + docutils +-pygments >= 2.1 +-robotframeworklexer >= 1.1 ++pygments >= 2.8 diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 860ea35959..1387f1f260 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -4689,37 +4689,50 @@ ecosystem, but can naturally be used also by other projects.") (sha256 (base32 "0j71awmfkwk7prz82kr1zbcl3nrih3396sshrygnqlrdjmgivd3p")) (patches (search-patches - "python-robotframework-source-date-epoch.patch")))) + "python-robotframework-source-date-epoch.patch" + "python-robotframework-ug2html.patch")))) (build-system python-build-system) (arguments - `(#:phases (modify-phases %standard-phases - (add-before 'build 'build-and-install-doc - (lambda* (#:key outputs #:allow-other-keys) - (let* ((doc-output (assoc-ref outputs "doc")) - (doc (string-append doc-output "/share/" - ,name "-" ,version "/"))) - (invoke "invoke" "library-docs" "all") - (mkdir-p doc) - (copy-recursively "doc/libraries" - (string-append doc "/libraries"))))) - (replace 'check - (lambda* (#:key native-inputs inputs tests? - #:allow-other-keys) - (when tests? - ;; Some tests require timezone data. Otherwise, they - ;; look up /etc/localtime, which doesn't exist, and - ;; fail with: - ;; - ;; OverflowError: mktime argument out of range - (setenv "TZDIR" - (search-input-directory - (or native-inputs inputs) "share/zoneinfo")) - (setenv "TZ" "Europe/Paris") - (invoke "python" "utest/run.py"))))))) + `(#:modules ((guix build python-build-system) + (guix build utils) + (ice-9 ftw) + (ice-9 match) + (srfi srfi-26)) + #:phases + (modify-phases %standard-phases + (add-before 'build 'build-and-install-doc + (lambda* (#:key outputs #:allow-other-keys) + (let ((doc (string-append (assoc-ref outputs "doc") + "/share/doc/robotframework"))) + (invoke "invoke" "library-docs" "all") + (invoke "doc/userguide/ug2html.py" "dist") ;user guide + (mkdir-p doc) + (with-directory-excursion "dist" + (define user-guide-dir + (match (scandir "." (cut string-prefix? + "robotframework-userguide-" <>)) + ((dir) dir) + (_ (error "could not find the user guide directory")))) + (copy-recursively user-guide-dir doc))))) + (replace 'check + (lambda* (#:key native-inputs inputs tests? + #:allow-other-keys) + (when tests? + ;; Some tests require timezone data. Otherwise, they + ;; look up /etc/localtime, which doesn't exist, and + ;; fail with: + ;; + ;; OverflowError: mktime argument out of range + (setenv "TZDIR" + (search-input-directory + (or native-inputs inputs) "share/zoneinfo")) + (setenv "TZ" "Europe/Paris") + (invoke "python" "utest/run.py"))))))) (native-inputs `(("python-docutils" ,python-docutils) ("python-jsonschema" ,python-jsonschema) ("python-invoke" ,python-invoke) + ("python-pygments" ,python-pygments) ("python-rellu" ,python-rellu) ("python:tk" ,python "tk") ;used when building the HTML doc ("tzdata" ,tzdata-for-tests)))