;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2019, 2020 Tobias Geerinckx-Rice ;;; Copyright © 2021 Ryan Prior ;;; Copyright © 2021, 2022 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages digest) #:use-module (guix gexp) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (guix build-system pyproject) #:use-module (guix build-system python) #:use-module (guix build-system trivial) #:use-module (guix utils) #:use-module (gnu packages python-build) #:use-module (ice-9 match)) (define-public wyhash (package (name "wyhash") (version "5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/wangyi-fudan/wyhash") (commit (string-append "wyhash_v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "03ljs5iw9zrm3bydwggjvpwrcwmsd75h3dv1j4am4hw3h22cjdjc")))) (build-system trivial-build-system) ;; source-only package (arguments `(#
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-pypi)
  #:use-module (guix import pypi)
  #:use-module (guix base32)
  #:use-module (guix memoization)
  #:use-module (guix utils)
  #:use-module ((guix base16) #:select (base16-string->bytevector))
  #:use-module (guix upstream)
  #:use-module (gcrypt hash)
  #:use-module (guix tests)
  #:use-module (guix tests http)
  #:use-module ((guix download) #:select (url-fetch))
  #:use-module (guix build-system python)
  #:use-module ((guix build utils)
                #:select (delete-file-recursively
                          which mkdir-p dump-port
                          with-directory-excursion))
  #:use-module ((guix diagnostics) #:select (guix-warning-port))
  #:use-module ((guix build syscalls) #:select (mkdtemp!))
  #:use-module (json)
  #:use-module (srfi srfi-26)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-35)
  #:use-module (srfi srfi-64)
  #:use-module (ice-9 match)
  #:use-module (ice-9 optargs))

(define default-sha256
  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
(define default-sha256/base32
  (bytevector->nix-base32-string
   (base16-string->bytevector default-sha256)))

(define* (foo-json #:key (name "foo") (name-in-url #f))
  "Create a JSON description of an example pypi package, named @var{name},
optionally using a different @var{name in its URL}."
  (scm->json-string
   `((info
      . ((version . "1.0.0")
         (name . ,name)
         (license . "GNU LGPL")
         (summary . "summary")
         (home_page . "http://example.com")
         (classifiers . #())
         (download_url . "")))
     (urls . #())
     (releases
      . ((1.0.0
          . #(((url . ,(format #f "~a/~a-1.0.0.egg"
                               (%local-url #:path "")
                               (or name-in-url name)))
               (packagetype . "bdist_egg"))
              ((url . ,(format #f "~a/~a-1.0.0.tar.gz"
                               (%local-url #:path "")
                               (or name-in-url name)))
               (pa