From patchwork Wed Feb 5 18:45:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Maja_K=C4=85dzio=C5=82ka?= X-Patchwork-Id: 20140 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 576FB168D1; Wed, 5 Feb 2020 18:46:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id D058F168CB for ; Wed, 5 Feb 2020 18:46:13 +0000 (GMT) Received: from localhost ([::1]:55078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izPgj-0005zd-Bl for patchwork@mira.cbaines.net; Wed, 05 Feb 2020 13:46:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58736) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izPgZ-0005zV-De for guix-patches@gnu.org; Wed, 05 Feb 2020 13:46:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izPgY-00068N-Am for guix-patches@gnu.org; Wed, 05 Feb 2020 13:46:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40748) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izPgY-00067p-6b for guix-patches@gnu.org; Wed, 05 Feb 2020 13:46:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1izPgY-0002yC-4i for guix-patches@gnu.org; Wed, 05 Feb 2020 13:46:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#39443] [PATCH] import: pypi: Support exporting packages with .zip source. Resent-From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 05 Feb 2020 18:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39443 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39443@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158092833711382 (code B ref -1); Wed, 05 Feb 2020 18:46:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2020 18:45:37 +0000 Received: from localhost ([127.0.0.1]:46721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1izPg9-0002xW-I5 for submit@debbugs.gnu.org; Wed, 05 Feb 2020 13:45:37 -0500 Received: from lists.gnu.org ([209.51.188.17]:43392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1izPg6-0002xN-3B for submit@debbugs.gnu.org; Wed, 05 Feb 2020 13:45:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58329) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izPg4-0005wJ-Uf for guix-patches@gnu.org; Wed, 05 Feb 2020 13:45:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izPg3-000440-SN for guix-patches@gnu.org; Wed, 05 Feb 2020 13:45:32 -0500 Received: from pat.zlotemysli.pl ([37.59.186.212]:57776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1izPg3-0003M1-JF for guix-patches@gnu.org; Wed, 05 Feb 2020 13:45:31 -0500 Received: (qmail 18469 invoked by uid 1009); 5 Feb 2020 19:45:22 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25716. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.01068 secs); 05 Feb 2020 18:45:22 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 5 Feb 2020 19:45:22 +0100 From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Date: Wed, 5 Feb 2020 19:45:48 +0100 Message-Id: <20200205184548.6555-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-Qmailux-2.08st: added fake Content-Type header X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/import/pypi.scm (make-pypi-sexp): Rename test-inputs to native-inputs. Restructure the way pypi-uri parameters are generated. Use pypi-uri's extension parameter when required. Add "unzip" to native inputs when the package source is a zip file. --- guix/import/pypi.scm | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index 354cae9c4c..a02644ff55 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -363,7 +363,11 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." (receive (guix-dependencies upstream-dependencies) (compute-inputs source-url wheel-url temp) (match guix-dependencies - ((required-inputs test-inputs) + ((required-inputs native-inputs) + (when (string-suffix? ".zip" source-url) + (set! native-inputs (cons + '("unzip" ,unzip) + native-inputs))) (values `(package (name ,(python->package-name name)) @@ -371,20 +375,29 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." (source (origin (method url-fetch) - ;; PyPI URL are case sensitive, but sometimes a project - ;; named using mixed case has a URL using lower case, so - ;; we must work around this inconsistency. For actual - ;; 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))) + (uri (pypi-uri + ;; PyPI URL are case sensitive, but sometimes + ;; a project named using mixed case has a URL + ;; using lower case, so we must work around this + ;; inconsistency. For actual examples, compare + ;; the URLs of the "Deprecated" and "uWSGI" PyPI + ;; packages. + ,(if (string-contains source-url name) + name + (string-downcase name)) + version + ;; Some packages have been released as `.zip` + ;; instead of the more common `.tar.gz`. For + ;; example, see "path-and-address". + ,@(if (string-suffix? ".zip" source-url) + '(".zip") + '()))) (sha256 (base32 ,(guix-hash-url temp))))) (build-system python-build-system) ,@(maybe-inputs required-inputs 'propagated-inputs) - ,@(maybe-inputs test-inputs 'native-inputs) + ,@(maybe-inputs native-inputs 'native-inputs) (home-page ,home-page) (synopsis ,synopsis) (description ,description)