WIP: bees service
[jackhill/guix/guix.git] / gnu / packages / time.scm
CommitLineData
233e7676
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
ac83dc82 3;;; Copyright © 2013, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
33dc54b0 4;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
08d81afa 5;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
33dc54b0
RW
6;;; Copyright © 2015, 2017 Leo Famulari <leo@famulari.name>
7;;; Copyright © 2015, 2017 Cyril Roelandt <tipecaml@gmail.com>
8;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
9;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
10;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
463e9835 11;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
626bc647 12;;; Copyright © 2016, 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5d20e1ec 13;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
3c986a7d 14;;; Copyright © 2017 Nikita <nikita@n0.is>
33dc54b0 15;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
f8460d26 16;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
3ef29c00 17;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
0d5b7ea1 18;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
0ab3a8c2 19;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
e86ed845 20;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
efe7a174 21;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>
b147f59f 22;;;
233e7676 23;;; This file is part of GNU Guix.
b147f59f 24;;;
233e7676 25;;; GNU Guix is free software; you can redistribute it and/or modify it
b147f59f
NK
26;;; under the terms of the GNU General Public License as published by
27;;; the Free Software Foundation; either version 3 of the License, or (at
28;;; your option) any later version.
29;;;
233e7676 30;;; GNU Guix is distributed in the hope that it will be useful, but
b147f59f
NK
31;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33;;; GNU General Public License for more details.
34;;;
35;;; You should have received a copy of the GNU General Public License
233e7676 36;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
b147f59f 37
1ffa7090 38(define-module (gnu packages time)
ac257f12 39 #:use-module (gnu packages check)
33dc54b0 40 #:use-module (gnu packages compression)
efe7a174 41 #:use-module (gnu packages golang)
3ef29c00 42 #:use-module (gnu packages perl)
44d10b1f 43 #:use-module (gnu packages python)
efe7a174
RPG
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages terminals)
46 #:use-module (gnu packages textutils)
47 #:use-module (gnu packages)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix build-system go)
50 #:use-module (guix build-system python)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module (guix licenses)
54 #:use-module (guix packages))
b147f59f
NK
55
56(define-public time
57 (package
58 (name "time")
64f925cb 59 (version "1.9")
b147f59f
NK
60 (source
61 (origin
62 (method url-fetch)
63 (uri (string-append "mirror://gnu/time/time-"
64 version ".tar.gz"))
65 (sha256
66 (base32
64f925cb 67 "07jj7cz6lc13iqrpgn81ivqh8rkm73p4rnivwgrrshk23v4g1b7v"))))
b147f59f 68 (build-system gnu-build-system)
6fd52309 69 (home-page "https://www.gnu.org/software/time/")
f50d2669 70 (synopsis "Run a command, then display its resource usage")
b147f59f 71 (description
a22dc0c4
LC
72 "Time is a command that displays information about the resources that a
73program uses. The display output of the program can be customized or saved
74to a file.")
c8b38f8e 75 (license gpl3+)))
5d20e1ec 76
0d5b7ea1
PL
77(define-public python-pytimeparse
78 (package
79 (name "python-pytimeparse")
80 (version "1.1.8")
81 (source
82 (origin
83 (method url-fetch)
84 (uri (pypi-uri "pytimeparse" version))
85 (sha256
86 (base32
87 "02kaambsgpjx3zi42j6l11rwms2p35b9hsk4f3kdf979gd3kcqg8"))))
88 (native-inputs
89 `(("python-nose" ,python-nose)))
90 (build-system python-build-system)
91 (home-page "https://github.com/wroberts/pytimeparse")
92 (synopsis "Time expression parser")
93 (description "This small Python module parses various kinds of time
94expressions.")
95 (license expat)))
96
5d20e1ec
BW
97(define-public python-pytzdata
98 (package
99 (name "python-pytzdata")
b05edb8c 100 (version "2020.1")
5d20e1ec
BW
101 (source
102 (origin
103 (method url-fetch)
104 (uri (pypi-uri "pytzdata" version))
105 (sha256
106 (base32
b05edb8c 107 "0h0md0ldhb8ghlwjslkzh3wcj4fxg3n43bj5sghqs2m06nri7yiy"))))
5d20e1ec 108 (build-system python-build-system)
463e9835
MB
109 ;; XXX: The PyPI distribution contains no tests, and the upstream
110 ;; repository lacks a setup.py! How to build from git?
111 (arguments '(#:tests? #f))
112 (propagated-inputs
113 `(("python-cleo" ,python-cleo)))
5d20e1ec
BW
114 (home-page "https://github.com/sdispater/pytzdata")
115 (synopsis "Timezone database for Python")
116 (description
117 "This library provides a timezone database for Python.")
118 (license expat)))
119
120(define-public python2-tzdata
121 (package-with-python2 python-pytzdata))
89c3eaaa 122
33dc54b0
RW
123(define-public python-pytz
124 (package
125 (name "python-pytz")
e8337f1e
LF
126 ;; This package should be kept in sync with tzdata in (gnu packages base).
127 (version "2021.1")
33dc54b0
RW
128 (source
129 (origin
130 (method url-fetch)
4c97f959 131 (uri (pypi-uri "pytz" version))
33dc54b0
RW
132 (sha256
133 (base32
e8337f1e 134 "1nn459q7zg20n75akxl3ljkykgw1ydc8nb05rx1y4f5zjh4ak943"))))
33dc54b0 135 (build-system python-build-system)
33dc54b0
RW
136 (home-page "http://pythonhosted.org/pytz")
137 (synopsis "Python timezone library")
138 (description "This library brings the Olson tz database into Python. It
139allows accurate and cross platform timezone calculations using Python 2.4 or
140higher. It also solves the issue of ambiguous times at the end of daylight
141saving time. Almost all of the Olson timezones are supported.")
142 (license expat)))
143
144(define-public python2-pytz
145 (package-with-python2 python-pytz))
146
89c3eaaa
BW
147(define-public python-pendulum
148 (package
149 (name "python-pendulum")
5e7fa528 150 (version "2.1.2")
89c3eaaa
BW
151 (source
152 (origin
153 (method url-fetch)
154 (uri (pypi-uri "pendulum" version))
155 (sha256
5e7fa528 156 (base32 "01zjc245w08j0xryrgrq9vng59q1cl5ry0hcpw5rj774pyhhqsmh"))))
89c3eaaa 157 (build-system python-build-system)
e5023bfd
MB
158 ;; XXX: The PyPI distribution lacks tests, and the upstream repository
159 ;; lacks a setup.py!
160 (arguments '(#:tests? #f))
89c3eaaa
BW
161 (propagated-inputs
162 `(("python-dateutil" ,python-dateutil)
e5023bfd 163 ("python-pytzdata" ,python-pytzdata)))
89c3eaaa
BW
164 (home-page "https://github.com/sdispater/pendulum")
165 (synopsis "Alternate API for Python datetimes")
166 (description "Pendulum is a drop-in replacement for the standard
167@{datetime} class, providing an alternative API. As it inherits from the
168standard @code{datetime} all @code{datetime} instances can be replaced by
169Pendulum instances.")
170 (license expat)))
171
172(define-public python2-pendulum
173 (package-with-python2 python-pendulum))
33dc54b0
RW
174
175(define-public python-dateutil
176 (package
177 (name "python-dateutil")
4255efda 178 (version "2.8.1")
33dc54b0
RW
179 (source
180 (origin
181 (method url-fetch)
182 (uri (pypi-uri "python-dateutil" version))
183 (sha256
184 (base32
4255efda 185 "0g42w7k5007iv9dam6gnja2ry8ydwirh99mgdll35s12pyfzxsvk"))))
33dc54b0 186 (build-system python-build-system)
de92ab21
MB
187 (arguments
188 `(#:phases (modify-phases %standard-phases
189 (replace 'check
190 (lambda _
191 ;; Delete tests that depend on "freezegun" to avoid a
192 ;; circular dependency.
193 (delete-file "dateutil/test/test_utils.py")
194 (delete-file "dateutil/test/test_rrule.py")
195
196 ;; XXX: Fails to get timezone from /etc/localtime.
197 (delete-file "dateutil/test/test_tz.py")
198
199 (invoke "pytest" "-vv"))))))
e30fc546 200 (native-inputs
de92ab21 201 `(("python-pytest" ,python-pytest)
40d97db7 202 ("python-pytest-cov" ,python-pytest-cov)
de92ab21 203 ("python-setuptools-scm" ,python-setuptools-scm)))
33dc54b0
RW
204 (propagated-inputs
205 `(("python-six" ,python-six)))
206 (home-page "https://dateutil.readthedocs.io/en/stable/")
207 (synopsis "Extensions to the standard datetime module")
208 (description
209 "The dateutil module provides powerful extensions to the standard
210datetime module, available in Python 2.3+.")
e30fc546
MB
211 ;; The license was changed from the three-clause BSD license to a dual
212 ;; Apache 2.0/BSD-3 variant at 2017-12-01. Some code is only available as
213 ;; BSD-3 still; but all new code is dual licensed (the user can choose).
214 (license (list bsd-3 asl2.0))))
33dc54b0
RW
215
216(define-public python2-dateutil
217 (package-with-python2 python-dateutil))
218
219(define-public python-parsedatetime
220 (package
221 (name "python-parsedatetime")
222 (version "2.4")
223 (source
224 (origin
225 (method url-fetch)
226 (uri (pypi-uri "parsedatetime" version))
227 (sha256
228 (base32
229 "0jxqkjks7z9dn222cqgvskp4wr6d92aglinxq7pd2w4mzdc7r09x"))))
230 (build-system python-build-system)
231 (native-inputs
232 `(("python-nose" ,python-nose)
233 ("python-pyicu" ,python-pyicu)
234 ("python-pytest" ,python-pytest)
235 ("python-pytest-runner" ,python-pytest-runner)))
236 (propagated-inputs
237 `(("python-future" ,python-future)))
238 (home-page "https://github.com/bear/parsedatetime/")
239 (synopsis "Parse human-readable date/time text")
240 (description
241 "Parse human-readable date/time text.")
242 (license asl2.0)))
243
244(define-public python2-parsedatetime
245 (package-with-python2 python-parsedatetime))
246
0ab3a8c2
LDB
247(define-public python-ciso8601
248 (package
249 (name "python-ciso8601")
250 (version "2.1.3")
251 (source
252 (origin
253 (method git-fetch)
254 ;; The PyPi distribution doesn't include the tests.
255 (uri (git-reference
b0e7b699 256 (url "https://github.com/closeio/ciso8601")
0ab3a8c2
LDB
257 (commit (string-append "v" version))))
258 (file-name (git-file-name name version))
259 (sha256
260 (base32
261 "0g1aiyc1ayh0rnibyy416m5mmck38ksgdm3jsy0z3rxgmgb24951"))))
262 (build-system python-build-system)
263 ;; Pytz should only be required for Python 2, but the test suite fails
264 ;; without it.
265 (native-inputs
266 `(("python-pytz" ,python-pytz)))
267 (home-page "https://github.com/closeio/ciso8601")
268 (synopsis
269 "Fast ISO8601 date time parser")
270 (description
271 "The package ciso8601 converts ISO 8601 or RFC 3339 date time strings into
272Python datetime objects.")
273 (license expat)))
274
33dc54b0
RW
275(define-public python-tzlocal
276 (package
277 (name "python-tzlocal")
8af48c14 278 (version "2.1")
33dc54b0
RW
279 (source
280 (origin
281 (method url-fetch)
282 (uri (pypi-uri "tzlocal" version))
283 (sha256
284 (base32
8af48c14 285 "0i1fm4sl04y65qnaqki0w75j34w863gxjj8ag0vwgvaa572rfg34"))))
33dc54b0 286 (build-system python-build-system)
d1e75921
EF
287 (arguments
288 `(#:phases
289 (modify-phases %standard-phases
290 (add-before 'check 'fix-symlink-test
291 ;; see: https://github.com/regebro/tzlocal/issues/53
292 (lambda _
8af48c14 293 (delete-file "tests/test_data/symlink_localtime/etc/localtime")
d1e75921 294 (symlink "../usr/share/zoneinfo/Africa/Harare"
8af48c14
EF
295 "tests/test_data/symlink_localtime/etc/localtime")
296 ;; And skip the test_fail test, it is known to fail
297 (substitute* "tests/tests.py"
298 (("def test_fail") "def _test_fail"))
d1e75921 299 #t)))))
33dc54b0
RW
300 (propagated-inputs
301 `(("python-pytz" ,python-pytz)))
d1e75921
EF
302 (native-inputs
303 `(("python-mock" ,python-mock)))
33dc54b0
RW
304 (home-page "https://github.com/regebro/tzlocal")
305 (synopsis "Local timezone information for Python")
306 (description
307 "Tzlocal returns a tzinfo object with the local timezone information.
308This module attempts to fix a glaring hole in pytz, that there is no way to
309get the local timezone information, unless you know the zoneinfo name, and
310under several distributions that's hard or impossible to figure out.")
d1e75921 311 (license expat)))
33dc54b0
RW
312
313(define-public python-isodate
314 (package
315 (name "python-isodate")
e4be1faa 316 (version "0.6.0")
33dc54b0
RW
317 (source
318 (origin
319 (method url-fetch)
320 (uri (pypi-uri "isodate" version))
321 (sha256
322 (base32
e4be1faa 323 "1n7jkz68kk5pwni540pr5zdh99bf6ywydk1p5pdrqisrawylldif"))))
33dc54b0 324 (build-system python-build-system)
e4be1faa
EF
325 (native-inputs
326 `(("python-six" ,python-six)))
327 (home-page "https://github.com/gweis/isodate/")
33dc54b0
RW
328 (synopsis "Python date parser and formatter")
329 (description
330 "Python-isodate is a python module for parsing and formatting
331ISO 8601 dates, time and duration.")
332 (license bsd-3)))
333
334(define-public python2-isodate
335 (package-with-python2 python-isodate))
336
337(define-public python-iso8601
338 (package
339 (name "python-iso8601")
5f321292 340 (version "0.1.13")
33dc54b0
RW
341 (source
342 (origin
343 (method url-fetch)
344 (uri (pypi-uri "iso8601" version))
345 (sha256
346 (base32
5f321292 347 "1cgfj91khil4ii5gb8s6nxwm73vx7hqc2k79dd9d8990ylmc5ppp"))))
33dc54b0 348 (build-system python-build-system)
5f321292
MB
349 (arguments
350 '(#:phases (modify-phases %standard-phases
351 (replace 'check
352 (lambda _
353 (invoke "pytest" "-vv" "iso8601"))))))
33dc54b0
RW
354 (native-inputs
355 `(("python-pytest" ,python-pytest)))
356 (home-page "https://bitbucket.org/micktwomey/pyiso8601")
357 (synopsis "Module to parse ISO 8601 dates")
358 (description
359 "This module parses the most common forms of ISO 8601 date strings (e.g.
360@code{2007-01-14T20:34:22+00:00}) into @code{datetime} objects.")
361 (license expat)))
362
363(define-public python2-iso8601
364 (package-with-python2 python-iso8601))
365
366(define-public python-monotonic
367 (package
368 (name "python-monotonic")
33fdde8d 369 (version "1.5")
33dc54b0
RW
370 (source
371 (origin
372 (method url-fetch)
db3e631d 373 (uri (pypi-uri "monotonic" version))
33dc54b0
RW
374 (sha256
375 (base32
33fdde8d 376 "1c6z46yb600klbfhqadyl7vq0jdjdxkm72k43ra3iw3d0xakv593"))))
33dc54b0 377 (build-system python-build-system)
33fdde8d 378 (arguments '(#:tests? #f)) ; no tests
33dc54b0
RW
379 (home-page "https://github.com/atdt/monotonic")
380 (synopsis "Implementation of time.monotonic() for Python 2 & < 3.3")
381 (description
382 "This module provides a @code{monotonic()} function which returns the
383value (in fractional seconds) of a clock which never goes backwards.")
384 (license asl2.0)))
385
386(define-public python2-monotonic
387 (package-with-python2 python-monotonic))
388
389(define-public python-pyrfc3339
390 (package
391 (name "python-pyrfc3339")
0ce92d74 392 (version "1.1")
33dc54b0
RW
393 (source
394 (origin
395 (method url-fetch)
396 (uri (pypi-uri "pyRFC3339" version))
397 (sha256
398 (base32
0ce92d74 399 "06jv7ar7lpvvk0dixzwdr3wgm0g1lipxs429s2z7knwwa7hwpf41"))))
33dc54b0
RW
400 (build-system python-build-system)
401 (propagated-inputs
402 `(("python-pytz" ,python-pytz)))
403 (native-inputs
404 `(("python-nose" ,python-nose)))
405 (home-page "https://github.com/kurtraschke/pyRFC3339")
406 (synopsis "Python timestamp library")
407 (description "Python library for generating and parsing RFC 3339-compliant
408timestamps.")
409 (license expat)))
410
411(define-public python2-pyrfc3339
412 (package-with-python2 python-pyrfc3339))
413
414(define-public python-arrow
415 (package
416 (name "python-arrow")
e86ed845 417 (version "0.17.0")
33dc54b0
RW
418 (source (origin
419 (method url-fetch)
420 (uri (pypi-uri "arrow" version))
421 (sha256
422 (base32
e86ed845 423 "1m3fpz96w3g08i9x9cpqh3cr795y9zbj1bfnay3ccdhxv86d227z"))))
33dc54b0 424 (build-system python-build-system)
e86ed845
TLC
425 (arguments
426 `(#:phases
427 (modify-phases %standard-phases
428 (replace 'check
429 (lambda _
08d81afa
EF
430 (invoke "pytest" "-vv" "tests"
431 ;; python-dateutil doesn't recognize America/Nuuk.
432 ;; Remove when python-dateutil > 2.8.1.
433 "-k" "not test_parse_tz_name_zzz"))))))
33dc54b0
RW
434 (native-inputs
435 `(;; For testing
436 ("python-chai" ,python-chai)
e86ed845
TLC
437 ("python-pytest" ,python-pytest)
438 ("python-pytest-cov" ,python-pytest-cov)
439 ("python-pytest-mock" ,python-pytest-mock)
33dc54b0
RW
440 ("python-simplejson" ,python-simplejson)))
441 (propagated-inputs
e86ed845
TLC
442 `(("python-dateutil" ,python-dateutil)
443 ("python-pytz" ,python-pytz)))
444 (home-page "https://github.com/arrow-py/arrow")
33dc54b0
RW
445 (synopsis "Dates and times for Python")
446 (description
447 "Arrow is a Python library to creating, manipulating, formatting and
448converting dates, times, and timestamps. It implements and updates the
449datetime type.")
450 (license asl2.0)))
451
33dc54b0
RW
452(define-public python-aniso8601
453 (package
454 (name "python-aniso8601")
455 (version "1.3.0")
456 (source
457 (origin
458 (method url-fetch)
459 (uri (pypi-uri "aniso8601" version))
460 (sha256
461 (base32
462 "1waj54iv3n3lw1fapbz8a93yjgrybgpc86wif5baxdh1arpj9df3"))))
463 (build-system python-build-system)
464 (propagated-inputs
465 `(("python-dateutil" ,python-dateutil)))
466 (home-page "https://bitbucket.org/nielsenb/aniso8601")
467 (synopsis "Python library for parsing ISO 8601 strings")
468 (description
469 "This package contains a library for parsing ISO 8601 datetime strings.")
470 (license bsd-3)))
471
472(define-public python2-aniso8601
473 (package-with-python2 python-aniso8601))
3ef29c00
KM
474
475(define-public datefudge
476 (package
477 (name "datefudge")
69dc3e52 478 (version "1.23")
3ef29c00 479 (source (origin
ac83dc82
LC
480 ;; Source code is available from
481 ;; <https://salsa.debian.org/debian/datefudge.git>. However,
482 ;; for bootstrapping reasons, we do not rely on 'git-fetch' here
483 ;; (since Git -> GnuTLS -> datefudge).
484 (method url-fetch)
485 (uri (string-append
486 "mirror://debian/pool/main/d/datefudge/datefudge_"
487 version ".tar.xz"))
3ef29c00
KM
488 (sha256
489 (base32
ac83dc82 490 "0ifnlb0mc8qc2kb5042pbz0ns6rwcb7201di8wyrsphl0yhnhxiv"))
eb07edab 491 (patches (search-patches "datefudge-gettimeofday.patch"))))
3ef29c00
KM
492 (build-system gnu-build-system)
493 (arguments
494 `(#:test-target "test"
495 #:make-flags (list "CC=gcc"
496 (string-append "prefix=" (assoc-ref %outputs "out")))
497 #:phases
498 (modify-phases %standard-phases
499 (add-after 'unpack 'patch-makefile
500 (lambda _
501 (substitute* "Makefile"
502 ((" -o root -g root") "")
503 (("VERSION := \\$\\(shell dpkg-parsechangelog .*")
504 (string-append "VERSION = " ,version)))
505 #t))
506 (delete 'configure))))
507 (native-inputs
508 `(("perl" ,perl)))
509 (home-page "https://salsa.debian.org/debian/datefudge")
510 (synopsis "Pretend the system date is different")
511 (description
512 "Utility that fakes the system time by pre-loading a small library that
513modifies the @code{time}, @code{gettimeofday} and @code{clock_gettime} system
514calls.")
515 (license gpl2)))
efe7a174
RPG
516
517(define-public countdown
518 (package
519 (name "countdown")
520 (version "1.0.0")
521 (source
522 (origin
523 (method git-fetch)
524 (uri (git-reference
525 (url "https://github.com/antonmedv/countdown")
526 (commit (string-append "v" version))))
527 (file-name (git-file-name name version))
528 (sha256
529 (base32 "0pdaw1krr0bsl4amhwx03v2b02iznvwvqn7af5zp4fkzjaj14cdw"))))
530 (build-system go-build-system)
531 (arguments
532 '(#:import-path "github.com/antonmedv/countdown"))
533 (native-inputs
534 `(("runewidth" ,go-github.com-mattn-go-runewidth)
535 ("termbox" ,go-github.com-nsf-termbox-go)))
536 (home-page "https://github.com/antonmedv/countdown")
537 (synopsis "Counts to zero with a text user interface")
538 (description
539 "Countdown provides a fancy text display while it counts down to zero
540from a starting point you provide. The user can pause and resume the
541countdown from the text user interface.")
542 (license expat)))