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