WIP: bees service
[jackhill/guix/guix.git] / gnu / packages / time.scm
... / ...
CommitLineData
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3;;; Copyright © 2013, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
4;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
5;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
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>
11;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
12;;; Copyright © 2016, 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
13;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
14;;; Copyright © 2017 Nikita <nikita@n0.is>
15;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
16;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
17;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
18;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
19;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
20;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
21;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>
22;;;
23;;; This file is part of GNU Guix.
24;;;
25;;; GNU Guix is free software; you can redistribute it and/or modify it
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;;;
30;;; GNU Guix is distributed in the hope that it will be useful, but
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
36;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
37
38(define-module (gnu packages time)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages golang)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages python)
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))
55
56(define-public time
57 (package
58 (name "time")
59 (version "1.9")
60 (source
61 (origin
62 (method url-fetch)
63 (uri (string-append "mirror://gnu/time/time-"
64 version ".tar.gz"))
65 (sha256
66 (base32
67 "07jj7cz6lc13iqrpgn81ivqh8rkm73p4rnivwgrrshk23v4g1b7v"))))
68 (build-system gnu-build-system)
69 (home-page "https://www.gnu.org/software/time/")
70 (synopsis "Run a command, then display its resource usage")
71 (description
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.")
75 (license gpl3+)))
76
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
97(define-public python-pytzdata
98 (package
99 (name "python-pytzdata")
100 (version "2020.1")
101 (source
102 (origin
103 (method url-fetch)
104 (uri (pypi-uri "pytzdata" version))
105 (sha256
106 (base32
107 "0h0md0ldhb8ghlwjslkzh3wcj4fxg3n43bj5sghqs2m06nri7yiy"))))
108 (build-system python-build-system)
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)))
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))
122
123(define-public python-pytz
124 (package
125 (name "python-pytz")
126 ;; This package should be kept in sync with tzdata in (gnu packages base).
127 (version "2021.1")
128 (source
129 (origin
130 (method url-fetch)
131 (uri (pypi-uri "pytz" version))
132 (sha256
133 (base32
134 "1nn459q7zg20n75akxl3ljkykgw1ydc8nb05rx1y4f5zjh4ak943"))))
135 (build-system python-build-system)
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
147(define-public python-pendulum
148 (package
149 (name "python-pendulum")
150 (version "2.1.2")
151 (source
152 (origin
153 (method url-fetch)
154 (uri (pypi-uri "pendulum" version))
155 (sha256
156 (base32 "01zjc245w08j0xryrgrq9vng59q1cl5ry0hcpw5rj774pyhhqsmh"))))
157 (build-system python-build-system)
158 ;; XXX: The PyPI distribution lacks tests, and the upstream repository
159 ;; lacks a setup.py!
160 (arguments '(#:tests? #f))
161 (propagated-inputs
162 `(("python-dateutil" ,python-dateutil)
163 ("python-pytzdata" ,python-pytzdata)))
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))
174
175(define-public python-dateutil
176 (package
177 (name "python-dateutil")
178 (version "2.8.1")
179 (source
180 (origin
181 (method url-fetch)
182 (uri (pypi-uri "python-dateutil" version))
183 (sha256
184 (base32
185 "0g42w7k5007iv9dam6gnja2ry8ydwirh99mgdll35s12pyfzxsvk"))))
186 (build-system python-build-system)
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"))))))
200 (native-inputs
201 `(("python-pytest" ,python-pytest)
202 ("python-pytest-cov" ,python-pytest-cov)
203 ("python-setuptools-scm" ,python-setuptools-scm)))
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+.")
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))))
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
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
256 (url "https://github.com/closeio/ciso8601")
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
275(define-public python-tzlocal
276 (package
277 (name "python-tzlocal")
278 (version "2.1")
279 (source
280 (origin
281 (method url-fetch)
282 (uri (pypi-uri "tzlocal" version))
283 (sha256
284 (base32
285 "0i1fm4sl04y65qnaqki0w75j34w863gxjj8ag0vwgvaa572rfg34"))))
286 (build-system python-build-system)
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 _
293 (delete-file "tests/test_data/symlink_localtime/etc/localtime")
294 (symlink "../usr/share/zoneinfo/Africa/Harare"
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"))
299 #t)))))
300 (propagated-inputs
301 `(("python-pytz" ,python-pytz)))
302 (native-inputs
303 `(("python-mock" ,python-mock)))
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.")
311 (license expat)))
312
313(define-public python-isodate
314 (package
315 (name "python-isodate")
316 (version "0.6.0")
317 (source
318 (origin
319 (method url-fetch)
320 (uri (pypi-uri "isodate" version))
321 (sha256
322 (base32
323 "1n7jkz68kk5pwni540pr5zdh99bf6ywydk1p5pdrqisrawylldif"))))
324 (build-system python-build-system)
325 (native-inputs
326 `(("python-six" ,python-six)))
327 (home-page "https://github.com/gweis/isodate/")
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")
340 (version "0.1.13")
341 (source
342 (origin
343 (method url-fetch)
344 (uri (pypi-uri "iso8601" version))
345 (sha256
346 (base32
347 "1cgfj91khil4ii5gb8s6nxwm73vx7hqc2k79dd9d8990ylmc5ppp"))))
348 (build-system python-build-system)
349 (arguments
350 '(#:phases (modify-phases %standard-phases
351 (replace 'check
352 (lambda _
353 (invoke "pytest" "-vv" "iso8601"))))))
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")
369 (version "1.5")
370 (source
371 (origin
372 (method url-fetch)
373 (uri (pypi-uri "monotonic" version))
374 (sha256
375 (base32
376 "1c6z46yb600klbfhqadyl7vq0jdjdxkm72k43ra3iw3d0xakv593"))))
377 (build-system python-build-system)
378 (arguments '(#:tests? #f)) ; no tests
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")
392 (version "1.1")
393 (source
394 (origin
395 (method url-fetch)
396 (uri (pypi-uri "pyRFC3339" version))
397 (sha256
398 (base32
399 "06jv7ar7lpvvk0dixzwdr3wgm0g1lipxs429s2z7knwwa7hwpf41"))))
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")
417 (version "0.17.0")
418 (source (origin
419 (method url-fetch)
420 (uri (pypi-uri "arrow" version))
421 (sha256
422 (base32
423 "1m3fpz96w3g08i9x9cpqh3cr795y9zbj1bfnay3ccdhxv86d227z"))))
424 (build-system python-build-system)
425 (arguments
426 `(#:phases
427 (modify-phases %standard-phases
428 (replace 'check
429 (lambda _
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"))))))
434 (native-inputs
435 `(;; For testing
436 ("python-chai" ,python-chai)
437 ("python-pytest" ,python-pytest)
438 ("python-pytest-cov" ,python-pytest-cov)
439 ("python-pytest-mock" ,python-pytest-mock)
440 ("python-simplejson" ,python-simplejson)))
441 (propagated-inputs
442 `(("python-dateutil" ,python-dateutil)
443 ("python-pytz" ,python-pytz)))
444 (home-page "https://github.com/arrow-py/arrow")
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
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))
474
475(define-public datefudge
476 (package
477 (name "datefudge")
478 (version "1.23")
479 (source (origin
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"))
488 (sha256
489 (base32
490 "0ifnlb0mc8qc2kb5042pbz0ns6rwcb7201di8wyrsphl0yhnhxiv"))
491 (patches (search-patches "datefudge-gettimeofday.patch"))))
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)))
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)))