aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2019-04-01 22:39:45 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2019-04-19 20:27:27 -0400
commitb979028527add840175336b8f7b165caf60ec793 (patch)
tree2d48aab7841dee8f48515f47049f3e676dcbeb9e
parentc0c0bb3823418812c999472bc6334bfa454f148a (diff)
downloadguix-b979028527add840175336b8f7b165caf60ec793.tar
guix-b979028527add840175336b8f7b165caf60ec793.tar.gz
gnu: Add python-robotframework.
* gnu/packages/python-xyz.scm (python-robotframework): New variable. * gnu/packages/patches/python-robotframework-honor-source-date-epoch.patch: Add patch. * gnu/local.mk (dist_patch_DATA): Register it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/python-robotframework-honor-source-date-epoch.patch62
-rw-r--r--gnu/packages/python-xyz.scm45
3 files changed, 108 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index a3cfee9649..5c03066853 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1206,6 +1206,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-pycrypto-CVE-2013-7459.patch \
%D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \
%D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch \
+ %D%/packages/patches/python-robotframework-honor-source-date-epoch.patch \
%D%/packages/patches/python2-subprocess32-disable-input-test.patch \
%D%/packages/patches/python-unittest2-python3-compat.patch \
%D%/packages/patches/python-unittest2-remove-argparse.patch \
diff --git a/gnu/packages/patches/python-robotframework-honor-source-date-epoch.patch b/gnu/packages/patches/python-robotframework-honor-source-date-epoch.patch
new file mode 100644
index 0000000000..ccd87911d8
--- /dev/null
+++ b/gnu/packages/patches/python-robotframework-honor-source-date-epoch.patch
@@ -0,0 +1,62 @@
+From 3cc41c05fad5601c0dd1832f64a6e9efca017727 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Mon, 1 Apr 2019 11:36:04 -0400
+Subject: [PATCH] robottime: Honor the SOURCE_DATE_EPOCH environment variable.
+
+Honoring the SOURCE_DATE_EPOCH environment variable allows building
+the documentation using libdoc reproducibly, by setting the generated
+timestamp to a fixed value.
+
+For more background on reproducible builds and the SOURCE_DATE_EPOCH
+environment variable, see:
+https://reproducible-builds.org/specs/source-date-epoch/.
+
+* src/robot/utils/robottime.py: import `os'.
+(TimestampCache._get_epoch): Retrieve date from SOURCE_DATE_EPOCH if
+it is defined, otherwise from time.time().
+* utest/output/test_logger.py (TestLogger.test_write_to_one_logger):
+Check for the existance of a timestamp attribute instead of checking
+for its content as the later is easy to break when using the
+SOURCE_DATE_EPOCH environment variable.
+---
+ src/robot/utils/robottime.py | 3 +++
+ utest/output/test_logger.py | 2 +-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/robot/utils/robottime.py b/src/robot/utils/robottime.py
+index 06432a4a6..91526f826 100644
+--- a/src/robot/utils/robottime.py
++++ b/src/robot/utils/robottime.py
+@@ -14,6 +14,7 @@
+ # limitations under the License.
+
+ import datetime
++import os
+ import time
+ import re
+
+@@ -395,6 +396,8 @@ class TimestampCache(object):
+
+ # Seam for mocking
+ def _get_epoch(self):
++ if os.getenv('SOURCE_DATE_EPOCH'):
++ return float(os.getenv('SOURCE_DATE_EPOCH'))
+ return time.time()
+
+ def _use_cache(self, secs, *separators):
+diff --git a/utest/output/test_logger.py b/utest/output/test_logger.py
+index 92fe6d77d..e980227aa 100644
+--- a/utest/output/test_logger.py
++++ b/utest/output/test_logger.py
+@@ -46,7 +46,7 @@ class TestLogger(unittest.TestCase):
+ logger = LoggerMock(('Hello, world!', 'INFO'))
+ self.logger.register_logger(logger)
+ self.logger.write('Hello, world!', 'INFO')
+- assert_true(logger.msg.timestamp.startswith('20'))
++ assert_true(hasattr(logger.msg, 'timestamp'))
+
+ def test_write_to_one_logger_with_trace_level(self):
+ logger = LoggerMock(('expected message', 'TRACE'))
+--
+2.20.1
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index bebb7c5cb2..efc36662e0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -2752,6 +2752,51 @@ designed to be used by Robot Framework and tools and libraries in its
ecosystem, but can naturally be used also by other projects.")
(license license:asl2.0)))
+(define-public python-robotframework
+ (package
+ (name "python-robotframework")
+ (version "3.1.1")
+ ;; There are no tests in the PyPI archive.
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/robotframework/robotframework.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1aaiamc9l35m5sf7xl2qc5q9308v7sz3p1qgzcslsjxzddphyn4v"))
+ (patches (search-patches
+ "python-robotframework-honor-source-date-epoch.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"))
+ #t)))
+ (replace 'check
+ (lambda _
+ (invoke "python" "utest/run.py"))))))
+ (native-inputs
+ `(("python-invoke" ,python-invoke)
+ ("python-rellu" ,python-rellu)
+ ("python:tk" ,python "tk"))) ;used when building the HTML doc
+ (outputs '("out" "doc"))
+ (home-page "https://robotframework.org")
+ (synopsis "Generic automation framework")
+ (description "Robot Framework is a generic automation framework for
+acceptance testing, acceptance test driven development (ATDD), and robotic
+process automation (RPA).")
+ (license license:asl2.0)))
+
(define-public python-scp
(package
(name "python-scp")