Merge branch 'core-updates'
[jackhill/guix/guix.git] / gnu / packages / time.scm
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 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 Tobias Geerinckx-Rice <me@tobias.gr>
13 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
14 ;;; Copyright © 2017 ng0 <ng0@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 ;;;
21 ;;; This file is part of GNU Guix.
22 ;;;
23 ;;; GNU Guix is free software; you can redistribute it and/or modify it
24 ;;; under the terms of the GNU General Public License as published by
25 ;;; the Free Software Foundation; either version 3 of the License, or (at
26 ;;; your option) any later version.
27 ;;;
28 ;;; GNU Guix is distributed in the hope that it will be useful, but
29 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 ;;; GNU General Public License for more details.
32 ;;;
33 ;;; You should have received a copy of the GNU General Public License
34 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35
36 (define-module (gnu packages time)
37 #:use-module (guix licenses)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system python)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages python-xyz))
49
50 (define-public time
51 (package
52 (name "time")
53 (version "1.9")
54 (source
55 (origin
56 (method url-fetch)
57 (uri (string-append "mirror://gnu/time/time-"
58 version ".tar.gz"))
59 (sha256
60 (base32
61 "07jj7cz6lc13iqrpgn81ivqh8rkm73p4rnivwgrrshk23v4g1b7v"))))
62 (build-system gnu-build-system)
63 (home-page "https://www.gnu.org/software/time/")
64 (synopsis "Run a command, then display its resource usage")
65 (description
66 "Time is a command that displays information about the resources that a
67 program uses. The display output of the program can be customized or saved
68 to a file.")
69 (license gpl3+)))
70
71 (define-public python-pytimeparse
72 (package
73 (name "python-pytimeparse")
74 (version "1.1.8")
75 (source
76 (origin
77 (method url-fetch)
78 (uri (pypi-uri "pytimeparse" version))
79 (sha256
80 (base32
81 "02kaambsgpjx3zi42j6l11rwms2p35b9hsk4f3kdf979gd3kcqg8"))))
82 (native-inputs
83 `(("python-nose" ,python-nose)))
84 (build-system python-build-system)
85 (home-page "https://github.com/wroberts/pytimeparse")
86 (synopsis "Time expression parser")
87 (description "This small Python module parses various kinds of time
88 expressions.")
89 (license expat)))
90
91 (define-public python-pytzdata
92 (package
93 (name "python-pytzdata")
94 (version "2019.3")
95 (source
96 (origin
97 (method url-fetch)
98 (uri (pypi-uri "pytzdata" version))
99 (sha256
100 (base32
101 "0ppfc6kz4p41mxyqxq1g1zp6gvns99g6b344qj6ih0x9vxy6zh7s"))))
102 (build-system python-build-system)
103 ;; XXX: The PyPI distribution contains no tests, and the upstream
104 ;; repository lacks a setup.py! How to build from git?
105 (arguments '(#:tests? #f))
106 (propagated-inputs
107 `(("python-cleo" ,python-cleo)))
108 (home-page "https://github.com/sdispater/pytzdata")
109 (synopsis "Timezone database for Python")
110 (description
111 "This library provides a timezone database for Python.")
112 (license expat)))
113
114 (define-public python2-tzdata
115 (package-with-python2 python-pytzdata))
116
117 (define-public python-pytz
118 (package
119 (name "python-pytz")
120 (version "2019.1")
121 (source
122 (origin
123 (method url-fetch)
124 (uri (pypi-uri "pytz" version))
125 (sha256
126 (base32
127 "0hg1r2c41gnmljdsdmdgy6kb1zkfmxsf49imd96g8znp4cyxsiyp"))))
128 (build-system python-build-system)
129 (home-page "http://pythonhosted.org/pytz")
130 (synopsis "Python timezone library")
131 (description "This library brings the Olson tz database into Python. It
132 allows accurate and cross platform timezone calculations using Python 2.4 or
133 higher. It also solves the issue of ambiguous times at the end of daylight
134 saving time. Almost all of the Olson timezones are supported.")
135 (license expat)))
136
137 (define-public python2-pytz
138 (package-with-python2 python-pytz))
139
140 (define-public python-pendulum
141 (package
142 (name "python-pendulum")
143 (version "2.1.0")
144 (source
145 (origin
146 (method url-fetch)
147 (uri (pypi-uri "pendulum" version))
148 (sha256
149 (base32
150 "1zhzk0ai8is8zclw4v73dllf0hx0l5nmm4sbwrh6cl8h5qsang09"))))
151 (build-system python-build-system)
152 ;; XXX: The PyPI distribution lacks tests, and the upstream repository
153 ;; lacks a setup.py!
154 (arguments '(#:tests? #f))
155 (propagated-inputs
156 `(("python-dateutil" ,python-dateutil)
157 ("python-pytzdata" ,python-pytzdata)))
158 (home-page "https://github.com/sdispater/pendulum")
159 (synopsis "Alternate API for Python datetimes")
160 (description "Pendulum is a drop-in replacement for the standard
161 @{datetime} class, providing an alternative API. As it inherits from the
162 standard @code{datetime} all @code{datetime} instances can be replaced by
163 Pendulum instances.")
164 (license expat)))
165
166 (define-public python2-pendulum
167 (package-with-python2 python-pendulum))
168
169 (define-public python-dateutil
170 (package
171 (name "python-dateutil")
172 (version "2.8.1")
173 (source
174 (origin
175 (method url-fetch)
176 (uri (pypi-uri "python-dateutil" version))
177 (sha256
178 (base32
179 "0g42w7k5007iv9dam6gnja2ry8ydwirh99mgdll35s12pyfzxsvk"))))
180 (build-system python-build-system)
181 (arguments
182 `(#:phases (modify-phases %standard-phases
183 (replace 'check
184 (lambda _
185 ;; Delete tests that depend on "freezegun" to avoid a
186 ;; circular dependency.
187 (delete-file "dateutil/test/test_utils.py")
188 (delete-file "dateutil/test/test_rrule.py")
189
190 ;; XXX: Fails to get timezone from /etc/localtime.
191 (delete-file "dateutil/test/test_tz.py")
192
193 (invoke "pytest" "-vv"))))))
194 (native-inputs
195 `(("python-pytest" ,python-pytest)
196 ("python-pytest-cov" ,python-pytest-cov)
197 ("python-setuptools-scm" ,python-setuptools-scm)))
198 (propagated-inputs
199 `(("python-six" ,python-six)))
200 (home-page "https://dateutil.readthedocs.io/en/stable/")
201 (synopsis "Extensions to the standard datetime module")
202 (description
203 "The dateutil module provides powerful extensions to the standard
204 datetime module, available in Python 2.3+.")
205 ;; The license was changed from the three-clause BSD license to a dual
206 ;; Apache 2.0/BSD-3 variant at 2017-12-01. Some code is only available as
207 ;; BSD-3 still; but all new code is dual licensed (the user can choose).
208 (license (list bsd-3 asl2.0))))
209
210 (define-public python2-dateutil
211 (package-with-python2 python-dateutil))
212
213 (define-public python-parsedatetime
214 (package
215 (name "python-parsedatetime")
216 (version "2.4")
217 (source
218 (origin
219 (method url-fetch)
220 (uri (pypi-uri "parsedatetime" version))
221 (sha256
222 (base32
223 "0jxqkjks7z9dn222cqgvskp4wr6d92aglinxq7pd2w4mzdc7r09x"))))
224 (build-system python-build-system)
225 (native-inputs
226 `(("python-nose" ,python-nose)
227 ("python-pyicu" ,python-pyicu)
228 ("python-pytest" ,python-pytest)
229 ("python-pytest-runner" ,python-pytest-runner)))
230 (propagated-inputs
231 `(("python-future" ,python-future)))
232 (home-page "https://github.com/bear/parsedatetime/")
233 (synopsis "Parse human-readable date/time text")
234 (description
235 "Parse human-readable date/time text.")
236 (license asl2.0)))
237
238 (define-public python2-parsedatetime
239 (package-with-python2 python-parsedatetime))
240
241 (define-public python-ciso8601
242 (package
243 (name "python-ciso8601")
244 (version "2.1.3")
245 (source
246 (origin
247 (method git-fetch)
248 ;; The PyPi distribution doesn't include the tests.
249 (uri (git-reference
250 (url "https://github.com/closeio/ciso8601.git")
251 (commit (string-append "v" version))))
252 (file-name (git-file-name name version))
253 (sha256
254 (base32
255 "0g1aiyc1ayh0rnibyy416m5mmck38ksgdm3jsy0z3rxgmgb24951"))))
256 (build-system python-build-system)
257 ;; Pytz should only be required for Python 2, but the test suite fails
258 ;; without it.
259 (native-inputs
260 `(("python-pytz" ,python-pytz)))
261 (home-page "https://github.com/closeio/ciso8601")
262 (synopsis
263 "Fast ISO8601 date time parser")
264 (description
265 "The package ciso8601 converts ISO 8601 or RFC 3339 date time strings into
266 Python datetime objects.")
267 (license expat)))
268
269 (define-public python-tzlocal
270 (package
271 (name "python-tzlocal")
272 (version "1.5.1")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (pypi-uri "tzlocal" version))
277 (sha256
278 (base32
279 "0kiciwiqx0bv0fbc913idxibc4ygg4cb7f8rcpd9ij2shi4bigjf"))))
280 (build-system python-build-system)
281 (arguments
282 `(#:phases
283 (modify-phases %standard-phases
284 (add-before 'check 'fix-symlink-test
285 ;; see: https://github.com/regebro/tzlocal/issues/53
286 (lambda _
287 (delete-file "tzlocal/test_data/symlink_localtime/etc/localtime")
288 (symlink "../usr/share/zoneinfo/Africa/Harare"
289 "tzlocal/test_data/symlink_localtime/etc/localtime")
290 #t)))))
291 (propagated-inputs
292 `(("python-pytz" ,python-pytz)))
293 (native-inputs
294 `(("python-mock" ,python-mock)))
295 (home-page "https://github.com/regebro/tzlocal")
296 (synopsis "Local timezone information for Python")
297 (description
298 "Tzlocal returns a tzinfo object with the local timezone information.
299 This module attempts to fix a glaring hole in pytz, that there is no way to
300 get the local timezone information, unless you know the zoneinfo name, and
301 under several distributions that's hard or impossible to figure out.")
302 (license expat)))
303
304 (define-public python-isodate
305 (package
306 (name "python-isodate")
307 (version "0.6.0")
308 (source
309 (origin
310 (method url-fetch)
311 (uri (pypi-uri "isodate" version))
312 (sha256
313 (base32
314 "1n7jkz68kk5pwni540pr5zdh99bf6ywydk1p5pdrqisrawylldif"))))
315 (build-system python-build-system)
316 (native-inputs
317 `(("python-six" ,python-six)))
318 (home-page "https://github.com/gweis/isodate/")
319 (synopsis "Python date parser and formatter")
320 (description
321 "Python-isodate is a python module for parsing and formatting
322 ISO 8601 dates, time and duration.")
323 (license bsd-3)))
324
325 (define-public python2-isodate
326 (package-with-python2 python-isodate))
327
328 (define-public python-iso8601
329 (package
330 (name "python-iso8601")
331 (version "0.1.12")
332 (source
333 (origin
334 (method url-fetch)
335 (uri (pypi-uri "iso8601" version))
336 (sha256
337 (base32
338 "10nyvvnrhw2w3p09v1ica4lgj6f4g9j3kkfx17qmraiq3w7b5i29"))))
339 (build-system python-build-system)
340 (native-inputs
341 `(("python-pytest" ,python-pytest)))
342 (home-page "https://bitbucket.org/micktwomey/pyiso8601")
343 (synopsis "Module to parse ISO 8601 dates")
344 (description
345 "This module parses the most common forms of ISO 8601 date strings (e.g.
346 @code{2007-01-14T20:34:22+00:00}) into @code{datetime} objects.")
347 (license expat)))
348
349 (define-public python2-iso8601
350 (package-with-python2 python-iso8601))
351
352 (define-public python-monotonic
353 (package
354 (name "python-monotonic")
355 (version "1.5")
356 (source
357 (origin
358 (method url-fetch)
359 (uri (pypi-uri "monotonic" version))
360 (sha256
361 (base32
362 "1c6z46yb600klbfhqadyl7vq0jdjdxkm72k43ra3iw3d0xakv593"))))
363 (build-system python-build-system)
364 (arguments '(#:tests? #f)) ; no tests
365 (home-page "https://github.com/atdt/monotonic")
366 (synopsis "Implementation of time.monotonic() for Python 2 & < 3.3")
367 (description
368 "This module provides a @code{monotonic()} function which returns the
369 value (in fractional seconds) of a clock which never goes backwards.")
370 (license asl2.0)))
371
372 (define-public python2-monotonic
373 (package-with-python2 python-monotonic))
374
375 (define-public python-pyrfc3339
376 (package
377 (name "python-pyrfc3339")
378 (version "1.1")
379 (source
380 (origin
381 (method url-fetch)
382 (uri (pypi-uri "pyRFC3339" version))
383 (sha256
384 (base32
385 "06jv7ar7lpvvk0dixzwdr3wgm0g1lipxs429s2z7knwwa7hwpf41"))))
386 (build-system python-build-system)
387 (propagated-inputs
388 `(("python-pytz" ,python-pytz)))
389 (native-inputs
390 `(("python-nose" ,python-nose)))
391 (home-page "https://github.com/kurtraschke/pyRFC3339")
392 (synopsis "Python timestamp library")
393 (description "Python library for generating and parsing RFC 3339-compliant
394 timestamps.")
395 (license expat)))
396
397 (define-public python2-pyrfc3339
398 (package-with-python2 python-pyrfc3339))
399
400 (define-public python-arrow
401 (package
402 (name "python-arrow")
403 (version "0.10.0")
404 (source (origin
405 (method url-fetch)
406 (uri (pypi-uri "arrow" version))
407 (sha256
408 (base32
409 "08n7q2l69hlainds1byd4lxhwrq7zsw7s640zkqc3bs5jkq0cnc0"))))
410 (build-system python-build-system)
411 (native-inputs
412 `(;; For testing
413 ("python-chai" ,python-chai)
414 ("python-simplejson" ,python-simplejson)))
415 (propagated-inputs
416 `(("python-dateutil" ,python-dateutil)))
417 (home-page "https://github.com/crsmithdev/arrow/")
418 (synopsis "Dates and times for Python")
419 (description
420 "Arrow is a Python library to creating, manipulating, formatting and
421 converting dates, times, and timestamps. It implements and updates the
422 datetime type.")
423 (license asl2.0)))
424
425 (define-public python2-arrow
426 (package-with-python2 python-arrow))
427
428 (define-public python-aniso8601
429 (package
430 (name "python-aniso8601")
431 (version "1.3.0")
432 (source
433 (origin
434 (method url-fetch)
435 (uri (pypi-uri "aniso8601" version))
436 (sha256
437 (base32
438 "1waj54iv3n3lw1fapbz8a93yjgrybgpc86wif5baxdh1arpj9df3"))))
439 (build-system python-build-system)
440 (propagated-inputs
441 `(("python-dateutil" ,python-dateutil)))
442 (home-page "https://bitbucket.org/nielsenb/aniso8601")
443 (synopsis "Python library for parsing ISO 8601 strings")
444 (description
445 "This package contains a library for parsing ISO 8601 datetime strings.")
446 (license bsd-3)))
447
448 (define-public python2-aniso8601
449 (package-with-python2 python-aniso8601))
450
451 (define-public datefudge
452 (package
453 (name "datefudge")
454 (version "1.23")
455 (source (origin
456 ;; Source code is available from
457 ;; <https://salsa.debian.org/debian/datefudge.git>. However,
458 ;; for bootstrapping reasons, we do not rely on 'git-fetch' here
459 ;; (since Git -> GnuTLS -> datefudge).
460 (method url-fetch)
461 (uri (string-append
462 "mirror://debian/pool/main/d/datefudge/datefudge_"
463 version ".tar.xz"))
464 (sha256
465 (base32
466 "0ifnlb0mc8qc2kb5042pbz0ns6rwcb7201di8wyrsphl0yhnhxiv"))
467 (patches (search-patches "datefudge-gettimeofday.patch"))))
468 (build-system gnu-build-system)
469 (arguments
470 `(#:test-target "test"
471 #:make-flags (list "CC=gcc"
472 (string-append "prefix=" (assoc-ref %outputs "out")))
473 #:phases
474 (modify-phases %standard-phases
475 (add-after 'unpack 'patch-makefile
476 (lambda _
477 (substitute* "Makefile"
478 ((" -o root -g root") "")
479 (("VERSION := \\$\\(shell dpkg-parsechangelog .*")
480 (string-append "VERSION = " ,version)))
481 #t))
482 (delete 'configure))))
483 (native-inputs
484 `(("perl" ,perl)))
485 (home-page "https://salsa.debian.org/debian/datefudge")
486 (synopsis "Pretend the system date is different")
487 (description
488 "Utility that fakes the system time by pre-loading a small library that
489 modifies the @code{time}, @code{gettimeofday} and @code{clock_gettime} system
490 calls.")
491 (license gpl2)))