package-management.scm 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
  4. ;;; Copyright © 2017 Muriithi Frederick Muriuki <fredmanglis@gmail.com>
  5. ;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages package-management)
  22. #:use-module (guix packages)
  23. #:use-module (guix download)
  24. #:use-module (guix git-download)
  25. #:use-module (guix gexp)
  26. #:use-module (guix utils)
  27. #:use-module (guix build-system gnu)
  28. #:use-module (guix build-system python)
  29. #:use-module (guix build-system emacs)
  30. #:use-module ((guix licenses) #:select (gpl2+ gpl3+ lgpl2.1+ asl2.0 bsd-3))
  31. #:use-module (gnu packages)
  32. #:use-module (gnu packages guile)
  33. #:use-module (gnu packages file)
  34. #:use-module (gnu packages backup)
  35. #:use-module (gnu packages compression)
  36. #:use-module (gnu packages gnupg)
  37. #:use-module (gnu packages databases)
  38. #:use-module (gnu packages graphviz)
  39. #:use-module (gnu packages pkg-config)
  40. #:use-module (gnu packages autotools)
  41. #:use-module (gnu packages gettext)
  42. #:use-module (gnu packages texinfo)
  43. #:use-module (gnu packages nettle)
  44. #:use-module (gnu packages perl)
  45. #:use-module (gnu packages curl)
  46. #:use-module (gnu packages web)
  47. #:use-module (gnu packages man)
  48. #:use-module (gnu packages bdw-gc)
  49. #:use-module (gnu packages patchutils)
  50. #:use-module (gnu packages python)
  51. #:use-module (gnu packages popt)
  52. #:use-module (gnu packages gnuzilla)
  53. #:use-module (gnu packages cpio)
  54. #:use-module (gnu packages tls)
  55. #:use-module (gnu packages ssh)
  56. #:use-module (gnu packages vim)
  57. #:use-module (gnu packages serialization)
  58. #:use-module (srfi srfi-1)
  59. #:use-module (ice-9 match))
  60. (define (boot-guile-uri arch)
  61. "Return the URI for the bootstrap Guile tarball for ARCH."
  62. (cond ((string=? "armhf" arch)
  63. (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
  64. arch "-linux"
  65. "/20150101/guile-2.0.11.tar.xz"))
  66. ((string=? "aarch64" arch)
  67. (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
  68. arch "-linux/20170217/guile-2.0.14.tar.xz"))
  69. (else
  70. (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
  71. arch "-linux"
  72. "/20131110/guile-2.0.9.tar.xz"))))
  73. (define-public guix
  74. ;; Latest version of Guix, which may or may not correspond to a release.
  75. ;; Note: the 'update-guix-package.scm' script expects this definition to
  76. ;; start precisely like this.
  77. (let ((version "0.13.0")
  78. (commit "8b920d707ed07a3251227f77526cf875d86a4417")
  79. (revision 7))
  80. (package
  81. (name "guix")
  82. (version (if (zero? revision)
  83. version
  84. (string-append version "-"
  85. (number->string revision)
  86. "." (string-take commit 7))))
  87. (source (origin
  88. (method git-fetch)
  89. (uri (git-reference
  90. (url "https://git.savannah.gnu.org/r/guix.git")
  91. (commit commit)))
  92. (sha256
  93. (base32
  94. "15phwcadkw44mr4hnv1dxzzw9an6x7sbdfzwy4iciqw6y2wckncd"))
  95. (file-name (string-append "guix-" version "-checkout"))))
  96. (build-system gnu-build-system)
  97. (arguments
  98. `(#:configure-flags (list
  99. "--localstatedir=/var"
  100. "--sysconfdir=/etc"
  101. (string-append "--with-bash-completion-dir="
  102. (assoc-ref %outputs "out")
  103. "/etc/bash_completion.d")
  104. (string-append "--with-libgcrypt-prefix="
  105. (assoc-ref %build-inputs
  106. "libgcrypt"))
  107. ;; Set 'DOT_USER_PROGRAM' to the empty string so
  108. ;; we don't keep a reference to Graphviz, whose
  109. ;; closure is pretty big (too big for the GuixSD
  110. ;; installation image.)
  111. "ac_cv_path_DOT_USER_PROGRAM=dot"
  112. ;; To avoid problems with the length of shebangs,
  113. ;; choose a fixed-width and short directory name
  114. ;; for tests.
  115. "ac_cv_guix_test_root=/tmp/guix-tests")
  116. #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
  117. #:modules ((guix build gnu-build-system)
  118. (guix build utils)
  119. (srfi srfi-26)
  120. (ice-9 popen)
  121. (ice-9 rdelim))
  122. #:phases (modify-phases %standard-phases
  123. (add-after 'unpack 'bootstrap
  124. (lambda _
  125. ;; Make sure 'msgmerge' can modify the PO files.
  126. (for-each (lambda (po)
  127. (chmod po #o666))
  128. (find-files "." "\\.po$"))
  129. (zero? (system* "sh" "bootstrap"))))
  130. (add-before
  131. 'configure 'copy-bootstrap-guile
  132. (lambda* (#:key system inputs #:allow-other-keys)
  133. (define (boot-guile-version arch)
  134. (cond ((string=? "armhf" arch) "2.0.11")
  135. ((string=? "aarch64" arch) "2.0.14")
  136. (else "2.0.9")))
  137. (define (copy arch)
  138. (let ((guile (assoc-ref inputs
  139. (string-append "boot-guile/"
  140. arch)))
  141. (target (string-append "gnu/packages/bootstrap/"
  142. arch "-linux/"
  143. "/guile-"
  144. (boot-guile-version arch)
  145. ".tar.xz")))
  146. (mkdir-p (dirname target)) ;XXX: eventually unneeded
  147. (copy-file guile target)))
  148. (copy "i686")
  149. (copy "x86_64")
  150. (copy "mips64el")
  151. (copy "armhf")
  152. (copy "aarch64")
  153. #t))
  154. (add-after
  155. 'unpack 'disable-container-tests
  156. ;; XXX FIXME: These tests fail within the build container.
  157. (lambda _
  158. (substitute* "tests/syscalls.scm"
  159. (("^\\(test-(assert|equal) \"(clone|setns|pivot-root)\"" all)
  160. (string-append "(test-skip 1)\n" all)))
  161. (substitute* "tests/containers.scm"
  162. (("^\\(test-(assert|equal)" all)
  163. (string-append "(test-skip 1)\n" all)))
  164. (when (file-exists? "tests/guix-environment-container.sh")
  165. (substitute* "tests/guix-environment-container.sh"
  166. (("guix environment --version")
  167. "exit 77\n")))
  168. #t))
  169. (add-before 'check 'set-SHELL
  170. (lambda _
  171. ;; 'guix environment' tests rely on 'SHELL' having a
  172. ;; correct value, so set it.
  173. (setenv "SHELL" (which "sh"))
  174. #t))
  175. (add-after 'install 'wrap-program
  176. (lambda* (#:key inputs outputs #:allow-other-keys)
  177. ;; Make sure the 'guix' command finds GnuTLS and
  178. ;; Guile-JSON automatically.
  179. (let* ((out (assoc-ref outputs "out"))
  180. (guile (assoc-ref inputs "guile"))
  181. (json (assoc-ref inputs "guile-json"))
  182. (git (assoc-ref inputs "guile-git"))
  183. (ssh (assoc-ref inputs "guile-ssh"))
  184. (gnutls (assoc-ref inputs "gnutls"))
  185. (deps (list json gnutls git ssh))
  186. (effective
  187. (read-line
  188. (open-pipe* OPEN_READ
  189. (string-append guile "/bin/guile")
  190. "-c" "(display (effective-version))")))
  191. (path (string-join
  192. (map (cut string-append <>
  193. "/share/guile/site/"
  194. effective)
  195. deps)
  196. ":"))
  197. (gopath (string-join
  198. (map (cut string-append <>
  199. "/lib/guile/" effective
  200. "/site-ccache")
  201. deps)
  202. ":")))
  203. (wrap-program (string-append out "/bin/guix")
  204. `("GUILE_LOAD_PATH" ":" prefix (,path))
  205. `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,gopath)))
  206. #t))))))
  207. (native-inputs `(("pkg-config" ,pkg-config)
  208. ;; XXX: Keep the development inputs here even though
  209. ;; they're unnecessary, just so that 'guix environment
  210. ;; guix' always contains them.
  211. ("autoconf" ,(autoconf-wrapper))
  212. ("automake" ,automake)
  213. ("gettext" ,gettext-minimal)
  214. ("texinfo" ,texinfo)
  215. ("graphviz" ,graphviz)
  216. ("help2man" ,help2man)))
  217. (inputs
  218. (let ((boot-guile (lambda (arch hash)
  219. (origin
  220. (method url-fetch)
  221. (uri (boot-guile-uri arch))
  222. (sha256 hash)))))
  223. `(("bzip2" ,bzip2)
  224. ("gzip" ,gzip)
  225. ("zlib" ,zlib) ;for 'guix publish'
  226. ("sqlite" ,sqlite)
  227. ("libgcrypt" ,libgcrypt)
  228. ("guile" ,guile-2.2)
  229. ("boot-guile/i686"
  230. ,(boot-guile "i686"
  231. (base32
  232. "0im800m30abgh7msh331pcbjvb4n02smz5cfzf1srv0kpx3csmxp")))
  233. ("boot-guile/x86_64"
  234. ,(boot-guile "x86_64"
  235. (base32
  236. "1w2p5zyrglzzniqgvyn1b55vprfzhgk8vzbzkkbdgl5248si0yq3")))
  237. ("boot-guile/mips64el"
  238. ,(boot-guile "mips64el"
  239. (base32
  240. "0fzp93lvi0hn54acc0fpvhc7bvl0yc853k62l958cihk03q80ilr")))
  241. ("boot-guile/armhf"
  242. ,(boot-guile "armhf"
  243. (base32
  244. "1mi3brl7l58aww34rawhvja84xc7l1b4hmwdmc36fp9q9mfx0lg5")))
  245. ("boot-guile/aarch64"
  246. ,(boot-guile "aarch64"
  247. (base32
  248. "1giy2aprjmn5fp9c4s9r125fljw4wv6ixy5739i5bffw4jgr0f9r"))))))
  249. (propagated-inputs
  250. `(("gnutls" ,gnutls)
  251. ("guile-json" ,guile-json)
  252. ("guile-ssh" ,guile-ssh)
  253. ("guile-git" ,guile-git)))
  254. (home-page "https://www.gnu.org/software/guix/")
  255. (synopsis "Functional package manager for installed software packages and versions")
  256. (description
  257. "GNU Guix is a functional package manager for the GNU system, and is
  258. also a distribution thereof. It includes a virtual machine image. Besides
  259. the usual package management features, it also supports transactional
  260. upgrades and roll-backs, per-user profiles, and much more. It is based on
  261. the Nix package manager.")
  262. (license gpl3+)
  263. (properties '((ftp-server . "alpha.gnu.org"))))))
  264. ;; Alias for backward compatibility.
  265. (define-public guix-devel guix)
  266. (define-public guile2.0-guix
  267. (package
  268. (inherit guix)
  269. (name "guile2.0-guix")
  270. (inputs
  271. `(("guile" ,guile-2.0)
  272. ,@(alist-delete "guile" (package-inputs guix))))
  273. (propagated-inputs
  274. `(("gnutls" ,gnutls/guile-2.0)
  275. ("guile-json" ,guile2.0-json)
  276. ("guile-ssh" ,guile2.0-ssh)
  277. ("guile-git" ,guile2.0-git)))))
  278. (define (source-file? file stat)
  279. "Return true if FILE is likely a source file, false if it is a typical
  280. generated file."
  281. (define (wrong-extension? file)
  282. (or (string-suffix? "~" file)
  283. (member (file-extension file)
  284. '("o" "a" "lo" "so" "go"))))
  285. (match (basename file)
  286. ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
  287. #f)
  288. ((? wrong-extension?)
  289. #f)
  290. (_
  291. #t)))
  292. (define-public current-guix
  293. (let* ((repository-root (canonicalize-path
  294. (string-append (current-source-directory)
  295. "/../..")))
  296. (select? (delay (or (git-predicate repository-root)
  297. source-file?))))
  298. (lambda ()
  299. "Return a package representing Guix built from the current source tree.
  300. This works by adding the current source tree to the store (after filtering it
  301. out) and returning a package that uses that as its 'source'."
  302. (package
  303. (inherit guix)
  304. (version (string-append (package-version guix) "+"))
  305. (source (local-file repository-root "guix-current"
  306. #:recursive? #t
  307. #:select? (force select?)))))))
  308. ;;;
  309. ;;; Other tools.
  310. ;;;
  311. (define-public nix
  312. (package
  313. (name "nix")
  314. (version "1.11.9")
  315. (source (origin
  316. (method url-fetch)
  317. (uri (string-append "http://nixos.org/releases/nix/nix-"
  318. version "/nix-" version ".tar.xz"))
  319. (sha256
  320. (base32
  321. "1qg7qrfr60dysmyfg3ijgani71l23p1kqadhjs8kz11pgwkkx50f"))))
  322. (build-system gnu-build-system)
  323. ;; XXX: Should we pass '--with-store-dir=/gnu/store'? But then we'd also
  324. ;; need '--localstatedir=/var'. But then! The thing would use /var/nix
  325. ;; instead of /var/guix. So in the end, we do nothing special.
  326. (arguments
  327. '(#:configure-flags
  328. ;; Set the prefixes of Perl libraries to avoid propagation.
  329. (let ((perl-libdir (lambda (p)
  330. (string-append
  331. (assoc-ref %build-inputs p)
  332. "/lib/perl5/site_perl"))))
  333. (list (string-append "--with-dbi="
  334. (perl-libdir "perl-dbi"))
  335. (string-append "--with-dbd-sqlite="
  336. (perl-libdir "perl-dbd-sqlite"))
  337. (string-append "--with-www-curl="
  338. (perl-libdir "perl-www-curl"))))))
  339. (native-inputs `(("perl" ,perl)
  340. ("pkg-config" ,pkg-config)))
  341. (inputs `(("curl" ,curl)
  342. ("openssl" ,openssl)
  343. ("libgc" ,libgc)
  344. ("sqlite" ,sqlite)
  345. ("bzip2" ,bzip2)
  346. ("perl-www-curl" ,perl-www-curl)
  347. ("perl-dbi" ,perl-dbi)
  348. ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
  349. (home-page "http://nixos.org/nix/")
  350. (synopsis "The Nix package manager")
  351. (description
  352. "Nix is a purely functional package manager. This means that it treats
  353. packages like values in purely functional programming languages such as
  354. Haskell—they are built by functions that don't have side-effects, and they
  355. never change after they have been built. Nix stores packages in the Nix
  356. store, usually the directory /nix/store, where each package has its own unique
  357. sub-directory.")
  358. (license lgpl2.1+)))
  359. (define-public emacs-nix-mode
  360. (package
  361. (inherit nix)
  362. (name "emacs-nix-mode")
  363. (build-system emacs-build-system)
  364. (arguments
  365. `(#:phases
  366. (modify-phases %standard-phases
  367. (add-after 'unpack 'chdir-elisp
  368. ;; Elisp directory is not in root of the source.
  369. (lambda _
  370. (chdir "misc/emacs"))))))
  371. (synopsis "Emacs major mode for editing Nix expressions")
  372. (description "@code{nixos-mode} provides an Emacs major mode for editing
  373. Nix expressions. It supports syntax highlighting, indenting and refilling of
  374. comments.")))
  375. (define-public stow
  376. (package
  377. (name "stow")
  378. (version "2.2.2")
  379. (source (origin
  380. (method url-fetch)
  381. (uri (string-append "mirror://gnu/stow/stow-"
  382. version ".tar.gz"))
  383. (sha256
  384. (base32
  385. "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
  386. (build-system gnu-build-system)
  387. (inputs
  388. `(("perl" ,perl)))
  389. (native-inputs
  390. `(("perl-test-simple" ,perl-test-simple)
  391. ("perl-test-output" ,perl-test-output)
  392. ("perl-capture-tiny" ,perl-capture-tiny)
  393. ("perl-io-stringy" ,perl-io-stringy)))
  394. (home-page "https://www.gnu.org/software/stow/")
  395. (synopsis "Managing installed software packages")
  396. (description
  397. "GNU Stow is a symlink manager. It generates symlinks to directories
  398. of data and makes them appear to be merged into the same directory. It is
  399. typically used for managing software packages installed from source, by
  400. letting you install them apart in distinct directories and then create
  401. symlinks to the files in a common directory such as /usr/local.")
  402. (license gpl2+)))
  403. (define-public rpm
  404. (package
  405. (name "rpm")
  406. (version "4.13.0.1")
  407. (source (origin
  408. (method url-fetch)
  409. (uri (string-append "http://ftp.rpm.org/releases/rpm-"
  410. (version-major+minor version) ".x/rpm-"
  411. version ".tar.bz2"))
  412. (sha256
  413. (base32
  414. "03cvbwbfrhm0fa02j7828k1qp05hf2m0fradwcf2nqhrsjkppz17"))))
  415. (build-system gnu-build-system)
  416. (arguments
  417. '(#:configure-flags '("--with-external-db" ;use the system's bdb
  418. "--enable-python"
  419. "--without-lua")
  420. #:phases (modify-phases %standard-phases
  421. (add-before 'configure 'set-nspr-search-path
  422. (lambda* (#:key inputs #:allow-other-keys)
  423. ;; nspr.pc contains the right -I flag pointing to
  424. ;; 'include/nspr', but unfortunately 'configure' doesn't
  425. ;; use 'pkg-config'. Thus, augment CPATH.
  426. ;; Likewise for NSS.
  427. (let ((nspr (assoc-ref inputs "nspr"))
  428. (nss (assoc-ref inputs "nss")))
  429. (setenv "CPATH"
  430. (string-append (getenv "C_INCLUDE_PATH") ":"
  431. nspr "/include/nspr:"
  432. nss "/include/nss"))
  433. (setenv "LIBRARY_PATH"
  434. (string-append (getenv "LIBRARY_PATH") ":"
  435. nss "/lib/nss"))
  436. #t)))
  437. (add-after 'install 'fix-rpm-symlinks
  438. (lambda* (#:key outputs #:allow-other-keys)
  439. ;; 'make install' gets these symlinks wrong. Fix them.
  440. (let* ((out (assoc-ref outputs "out"))
  441. (bin (string-append out "/bin")))
  442. (with-directory-excursion bin
  443. (for-each (lambda (file)
  444. (delete-file file)
  445. (symlink "rpm" file))
  446. '("rpmquery" "rpmverify"))
  447. #t)))))))
  448. (native-inputs
  449. `(("pkg-config" ,pkg-config)))
  450. (inputs
  451. `(("python" ,python-2)
  452. ("xz" ,xz)
  453. ("bdb" ,bdb)
  454. ("popt" ,popt)
  455. ("nss" ,nss)
  456. ("nspr" ,nspr)
  457. ("libarchive" ,libarchive)
  458. ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
  459. ("file" ,file)
  460. ("bzip2" ,bzip2)
  461. ("zlib" ,zlib)
  462. ("cpio" ,cpio)))
  463. (home-page "http://www.rpm.org/")
  464. (synopsis "The RPM Package Manager")
  465. (description
  466. "The RPM Package Manager (RPM) is a command-line driven package
  467. management system capable of installing, uninstalling, verifying, querying,
  468. and updating computer software packages. Each software package consists of an
  469. archive of files along with information about the package like its version, a
  470. description. There is also a library permitting developers to manage such
  471. transactions from C or Python.")
  472. ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
  473. (license gpl2+)))
  474. (define-public diffoscope
  475. (package
  476. (name "diffoscope")
  477. (version "81")
  478. (source (origin
  479. (method url-fetch)
  480. (uri (pypi-uri name version))
  481. (sha256
  482. (base32
  483. "093lxy6zj69i19fxdkj3jnai3b1ajqbksyqcvy8wqj3plaaxjna5"))))
  484. (build-system python-build-system)
  485. (arguments
  486. `(#:phases (modify-phases %standard-phases
  487. (add-before 'unpack 'n (lambda _ #t))
  488. ;; setup.py mistakenly requires python-magic from PyPi, even
  489. ;; though the Python bindings of `file` are sufficient.
  490. ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
  491. (add-after 'unpack 'dependency-on-python-magic
  492. (lambda _
  493. (substitute* "setup.py"
  494. (("'python-magic',") ""))))
  495. (add-after 'unpack 'embed-tool-references
  496. (lambda* (#:key inputs #:allow-other-keys)
  497. (substitute* "diffoscope/comparators/utils/compare.py"
  498. (("\\['xxd',")
  499. (string-append "['" (which "xxd") "',")))
  500. (substitute* "diffoscope/comparators/elf.py"
  501. (("@tool_required\\('readelf'\\)") "")
  502. (("\\['readelf',")
  503. (string-append "['" (which "readelf") "',")))
  504. #t)))))
  505. (inputs `(("rpm" ,rpm) ;for rpm-python
  506. ("python-file" ,python-file)
  507. ("python-debian" ,python-debian)
  508. ("python-libarchive-c" ,python-libarchive-c)
  509. ("python-tlsh" ,python-tlsh)
  510. ("colordiff" ,colordiff)
  511. ("xxd" ,xxd)
  512. ;; Below are modules used for tests.
  513. ("python-pytest" ,python-pytest)
  514. ("python-chardet" ,python-chardet)))
  515. (home-page "https://diffoscope.org/")
  516. (synopsis "Compare files, archives, and directories in depth")
  517. (description
  518. "Diffoscope tries to get to the bottom of what makes files or directories
  519. different. It recursively unpacks archives of many kinds and transforms
  520. various binary formats into more human readable forms to compare them. It can
  521. compare two tarballs, ISO images, or PDFs just as easily.")
  522. (license gpl3+)))
  523. (define-public python-anaconda-client
  524. (package
  525. (name "python-anaconda-client")
  526. (version "1.6.3")
  527. (source
  528. (origin
  529. (method url-fetch)
  530. (uri (string-append "https://github.com/Anaconda-Platform/"
  531. "anaconda-client/archive/" version ".tar.gz"))
  532. (file-name (string-append name "-" version ".tar.gz"))
  533. (sha256
  534. (base32
  535. "1wv4wi6k5jz7rlwfgvgfdizv77x3cr1wa2aj0k1595g7fbhkjhz2"))))
  536. (build-system python-build-system)
  537. (propagated-inputs
  538. `(("python-pyyaml" ,python-pyyaml)
  539. ("python-requests" ,python-requests)
  540. ("python-clyent" ,python-clyent)))
  541. (native-inputs
  542. `(("python-pytz" ,python-pytz)
  543. ("python-dateutil" ,python-dateutil)
  544. ("python-mock" ,python-mock)
  545. ("python-coverage" ,python-coverage)
  546. ("python-pillow" ,python-pillow)))
  547. (arguments
  548. `(#:phases
  549. (modify-phases %standard-phases
  550. ;; This is needed for some tests.
  551. (add-before 'check 'set-up-home
  552. (lambda* _ (setenv "HOME" "/tmp") #t))
  553. (add-before 'check 'remove-network-tests
  554. (lambda* _
  555. ;; Remove tests requiring a network connection
  556. (let ((network-tests '("tests/test_upload.py"
  557. "tests/test_authorizations.py"
  558. "tests/test_login.py"
  559. "tests/test_whoami.py"
  560. "utils/notebook/tests/test_data_uri.py"
  561. "utils/notebook/tests/test_base.py"
  562. "utils/notebook/tests/test_downloader.py"
  563. "inspect_package/tests/test_conda.py")))
  564. (with-directory-excursion "binstar_client"
  565. (for-each delete-file network-tests)))
  566. #t)))))
  567. (home-page "https://github.com/Anaconda-Platform/anaconda-client")
  568. (synopsis "Anaconda Cloud command line client library")
  569. (description
  570. "Anaconda Cloud command line client library provides an interface to
  571. Anaconda Cloud. Anaconda Cloud is useful for sharing packages, notebooks and
  572. environments.")
  573. (license bsd-3)))
  574. (define-public python2-anaconda-client
  575. (package-with-python2 python-anaconda-client))
  576. (define-public python-conda
  577. (package
  578. (name "python-conda")
  579. (version "4.3.16")
  580. (source
  581. (origin
  582. (method url-fetch)
  583. (uri (string-append "https://github.com/conda/conda/archive/"
  584. version ".tar.gz"))
  585. (file-name (string-append name "-" version ".tar.gz"))
  586. (sha256
  587. (base32
  588. "1jq8hyrc5npb5sf4vw6s6by4602yj8f79vzpbwdfgpkn02nfk1dv"))))
  589. (build-system python-build-system)
  590. (arguments
  591. `(#:phases
  592. (modify-phases %standard-phases
  593. (add-before 'build 'create-version-file
  594. (lambda _
  595. (with-output-to-file "conda/.version"
  596. (lambda () (display ,version)))
  597. #t))
  598. (add-before 'check 'remove-failing-tests
  599. (lambda _
  600. ;; These tests require internet/network access
  601. (let ((network-tests '("test_cli.py"
  602. "test_create.py"
  603. "test_export.py"
  604. "test_fetch.py"
  605. "test_history.py"
  606. "test_info.py"
  607. "test_install.py"
  608. "test_priority.py"
  609. "conda_env/test_cli.py"
  610. "conda_env/test_create.py"
  611. "conda_env/specs/test_notebook.py"
  612. "conda_env/utils/test_notebooks.py"
  613. "core/test_index.py"
  614. "core/test_repodata.py")))
  615. (with-directory-excursion "tests"
  616. (for-each delete-file network-tests)
  617. ;; FIXME: This test creates a file, then deletes it and tests
  618. ;; that the file was deleted. For some reason it fails when
  619. ;; building with guix, but does not when you run it in the
  620. ;; directory left when you build with the --keep-failed
  621. ;; option
  622. (delete-file "gateways/disk/test_delete.py")
  623. #t))))
  624. (replace 'check
  625. (lambda _
  626. (setenv "HOME" "/tmp")
  627. (zero? (system* "py.test")))))))
  628. (native-inputs
  629. `(("python-ruamel.yaml" ,python-ruamel.yaml)
  630. ("python-requests" ,python-requests)
  631. ("python-pycosat" ,python-pycosat)
  632. ("python-pytest" ,python-pytest)
  633. ("python-responses" ,python-responses)
  634. ("python-pyyaml" ,python-pyyaml)
  635. ("python-anaconda-client" ,python-anaconda-client)))
  636. (home-page "https://github.com/conda/conda")
  637. (synopsis "Cross-platform, OS-agnostic, system-level binary package manager")
  638. (description
  639. "Conda is a cross-platform, Python-agnostic binary package manager. It
  640. is the package manager used by Anaconda installations, but it may be used for
  641. other systems as well. Conda makes environments first-class citizens, making
  642. it easy to create independent environments even for C libraries. Conda is
  643. written entirely in Python.
  644. This package provides Conda as a library.")
  645. (license bsd-3)))
  646. (define-public python2-conda
  647. (let ((base (package-with-python2
  648. (strip-python2-variant python-conda))))
  649. (package (inherit base)
  650. (native-inputs
  651. `(("python2-enum34" ,python2-enum34)
  652. ,@(package-native-inputs base))))))
  653. (define-public conda
  654. (package (inherit python-conda)
  655. (name "conda")
  656. (arguments
  657. (substitute-keyword-arguments (package-arguments python-conda)
  658. ((#:phases phases)
  659. `(modify-phases ,phases
  660. (replace 'build
  661. (lambda* (#:key outputs #:allow-other-keys)
  662. ;; This test fails when run before installation.
  663. (delete-file "tests/test_activate.py")
  664. ;; Fix broken defaults
  665. (substitute* "conda/base/context.py"
  666. (("return sys.prefix")
  667. (string-append "return \"" (assoc-ref outputs "out") "\""))
  668. (("return (prefix_is_writable\\(self.root_prefix\\))" _ match)
  669. (string-append "return False if self.root_prefix == self.conda_prefix else "
  670. match)))
  671. ;; The util/setup-testing.py is used to build conda in
  672. ;; application form, rather than the default, library form.
  673. ;; With this, we are able to run commands like `conda --help`
  674. ;; directly on the command line
  675. (zero? (system* "python" "utils/setup-testing.py" "build_py"))))
  676. (replace 'install
  677. (lambda* (#:key inputs outputs #:allow-other-keys)
  678. (let* ((out (assoc-ref outputs "out"))
  679. (target (string-append out "/lib/python"
  680. ((@@ (guix build python-build-system)
  681. get-python-version)
  682. (assoc-ref inputs "python"))
  683. "/site-packages/")))
  684. ;; The installer aborts if the target directory is not on
  685. ;; PYTHONPATH.
  686. (setenv "PYTHONPATH"
  687. (string-append target ":" (getenv "PYTHONPATH")))
  688. ;; And it aborts if the directory doesn't exist.
  689. (mkdir-p target)
  690. (zero? (system* "python" "utils/setup-testing.py" "install"
  691. (string-append "--prefix=" out))))))))))
  692. (description
  693. "Conda is a cross-platform, Python-agnostic binary package manager. It
  694. is the package manager used by Anaconda installations, but it may be used for
  695. other systems as well. Conda makes environments first-class citizens, making
  696. it easy to create independent environments even for C libraries. Conda is
  697. written entirely in Python.")))