unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Lulu <me@erkin.party>
To: "guix-patches@gnu.org" <guix-patches@gnu.org>
Subject: bug#44030: [PATCH] guix: import: Add versioning syntax to pypi importer.
Date: Sun, 25 Oct 2020 22:09:41 +0300 (TRT)	[thread overview]
Message-ID: <458803687.67759.1603652981842@office.mailbox.org> (raw)
In-Reply-To: <86wnzqz3h8.fsf@gmail.com>

Use @ as the unified versioning syntax, as per crate and
hackage importers, plus minor spacing fixes.


diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 15116e349d..add2a7ed7a 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -118,13 +118,15 @@
 
 (define (pypi-fetch name)
   "Return a <pypi-project> record for package NAME, or #f on failure."
-  (and=> (json-fetch (string-append "https://pypi.org/pypi/" name "/json"))
-         json->pypi-project))
+  ;; Convert @ in package name to / to access the correct URL.
+  (let ((versioned-name (string-join (string-split name #\@) "/")))
+    (and=> (json-fetch (string-append "https://pypi.org/pypi/" name "/json"))
+           json->pypi-project)))
 
 ;; For packages found on PyPI that lack a source distribution.
 (define-condition-type &missing-source-error &error
   missing-source-error?
-  (package  missing-source-error-package))
+  (package missing-source-error-package))
 
 (define (latest-source-release pypi-package)
   "Return the latest source release for PYPI-PACKAGE."
@@ -371,7 +373,7 @@ be extracted in a temporary directory."
                  (invoke "tar" "xf" archive "-C" dir)))
            (let ((requires.txt-files
                   (find-files dir (lambda (abs-file-name _)
-		                    (string-match "\\.egg-info/requires.txt$"
+                                    (string-match "\\.egg-info/requires.txt$"
                                                   abs-file-name)))))
              (match requires.txt-files
                (()




  reply	other threads:[~2020-10-26  8:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 13:48 bug#44030: guix import pypi foo@1.2.3 breaks zimoun
2020-10-25 19:09 ` Lulu [this message]
2020-10-25 20:04   ` bug#44030: [PATCH] guix: import: Add versioning syntax to pypi importer Lulu
2020-10-26 15:49     ` zimoun
2020-10-25 20:50 ` bug#44030: guix import pypi foo@1.2.3 breaks Lulu
2020-10-26 15:58   ` zimoun
2020-10-28 19:32 ` bug#44030: [PATCH] import: pypi: Add '@' syntax for specifying the package version Lulu
2020-10-29 22:09 ` bug#44030: guix import pypi foo@1.2.3 breaks Lulu
2020-11-02 12:15   ` zimoun
2021-11-21  6:14 ` Maxim Cournoyer
2021-11-22  9:07 ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=458803687.67759.1603652981842@office.mailbox.org \
    --to=me@erkin.party \
    --cc=guix-patches@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).