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