From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Cournoyer Subject: bug#33046: [PATCH v2] bug#33046: pypi importer doesn't print the correct source Date: Sun, 31 Mar 2019 20:14:46 -0400 Message-ID: <874l7i37k9.fsf_-_@gmail.com> References: <87a7hb2jb9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAkbQ-00039j-1Z for bug-guix@gnu.org; Sun, 31 Mar 2019 20:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAkbO-0004JP-Th for bug-guix@gnu.org; Sun, 31 Mar 2019 20:15:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53339) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAkbO-0004JI-HG for bug-guix@gnu.org; Sun, 31 Mar 2019 20:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hAkbO-0000iz-8k for bug-guix@gnu.org; Sun, 31 Mar 2019 20:15:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87a7hb2jb9.fsf@gmail.com> (Maxim Cournoyer's message of "Sun, 31 Mar 2019 10:46:18 -0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Julien Lepiller Cc: 33046@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hello, I just noticed that by changing the PyPI URL, the PyPI updater coverage had gone from 15.3% to 0%! Luckily, the fix was trivial and is included in my v2 patch (attached). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-v2-import-pypi-Preserve-package-name-case-when-forming-.patch Content-Transfer-Encoding: quoted-printable From=203c9c4229c460b6fdf0da804dddcd3d2cdd3aec4b Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sat, 30 Mar 2019 20:27:35 -0400 Subject: [PATCH] import: pypi: Preserve package name case when forming pypi-uri. Fixes issue: #33046. * guix/build-system/python.scm (pypi-uri): Update the host URI to "files.pythonhosted.org". * guix/import/pypi.scm (make-pypi-sexp): Preserve the package name case when the source URL calls for it. (pypi-package?): Augment to include new PyPI URL. =2D-- guix/build-system/python.scm | 2 +- guix/import/pypi.scm | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm index b753940bad..e39c06528e 100644 =2D-- a/guix/build-system/python.scm +++ b/guix/build-system/python.scm @@ -50,7 +50,7 @@ "Return a URI string for the Python package hosted on the Python Package Index (PyPI) corresponding to NAME and VERSION. EXTENSION is the file name extension, such as '.tar.gz'." =2D (string-append "https://pypi.org/packages/source/" + (string-append "https://files.pythonhosted.org/packages/source/" (string-take name 1) "/" name "/" name "-" version extension)) =20 diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index a2ce14b192..a02b718d39 100644 =2D-- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -371,15 +371,20 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION= , and LICENSE." `(package (name ,(python->package-name name)) (version ,version) =2D (source (origin =2D (method url-fetch) =2D ;; Sometimes 'pypi-uri' doesn't quite work = due to mixed =2D ;; cases in NAME, for instance, as is the c= ase with =2D ;; "uwsgi". In that case, fall back to a f= ull URL. =2D (uri (pypi-uri ,(string-downcase name) vers= ion)) =2D (sha256 =2D (base32 =2D ,(guix-hash-url temp))))) + (source + (origin + (method url-fetch) + ;; PyPI URL are case sensitive, but sometimes a proj= ect + ;; named using mixed case has a URL using lower case= , so + ;; we must work around this inconsistency. For actu= al + ;; examples, compare the URLs of the "Deprecated" and + ;; "uWSGI" PyPI packages. + (uri ,(if (string-contains source-url name) + `(pypi-uri ,name version) + `(pypi-uri ,(string-downcase name) version= ))) + (sha256 + (base32 + ,(guix-hash-url temp))))) (build-system python-build-system) ,@(maybe-inputs required-inputs 'propagated-inputs) ,@(maybe-inputs test-inputs 'native-inputs) @@ -437,7 +442,8 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, = and LICENSE." (define (pypi-url? url) (or (string-prefix? "https://pypi.org/" url) (string-prefix? "https://pypi.python.org/" url) =2D (string-prefix? "https://pypi.org/packages" url))) + (string-prefix? "https://pypi.org/packages" url) + (string-prefix? "https://files.pythonhosted.org" url))) =20 (let ((source-url (and=3D> (package-source package) origin-uri)) (fetch-method (and=3D> (package-source package) origin-method))) =2D-=20 2.20.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJ9WGpPiQCFQyn/CfEmDkZILmNWIFAlyhV/YACgkQEmDkZILm NWIEmRAAkvxEpyijUdX2p1XQwpPlNzvDt53ckZq27jxeDYpOuoQxoJbBidLtWJe9 9wpzytySLjnigPLM3wlf5b9tHXXA2DLKXPSHaBdMk/7WP6p/PMnXRVcBbYL9w2yK O7uATab+gbj5iHccsVX8c2IWe/ikt2xb2G4BcsFkaYBr3tC9zunMuS+aLP4cIQcu sV9ANM2ScSuKCvA/6AywHHc1IQlIsifJRv2ZPSmArjh56hcFHuiPE1DuwDYDmolq faZx6Y51EoFpJ8CaRBYRUxSdfjkOTjTHz2ZY/G+9z4lc9ywJOwuL3RSxU1JtesX6 LdSfk+/f58OSvYtJ/6b+WKR/q4zWPKf/luw8wcTYsQw8GwZ4BkZxlqfGeF/tdvBL 93LfihOJum1lMKolD4hgvcPKTeif5O8IGUJvIZECSKVPRznQ8MJYQfQjd8Nyechi 2AqLGFm1Ftax1t0JkGtIJUnhjN24yLZfzioLyaslWgAi8EaT5bYZKGIC8AsGt6Q2 iGSJfEq2KO4YHbrTDPD9sUeWsk4s4ymJIF9o8v6T6QAEPP8o82hERrZEGzPJ4kjF DdZ71z7PIF3Wjfvmda8hNz3PkAzULtAmQSYbNA6AoBKdXkTwt4u1x4mfIYwHC9g8 GeX47jScvJBCiln6lcbnXeQFlplmCIsJAuoPPmH2hRGbD5H0oVw= =XhQH -----END PGP SIGNATURE----- --==-=-=--