import: pypi: Move deduplication to final processing step.

* guix/import/pypi.scm (parse-requires.txt): Remove deduplication.
(parse-wheel-metadata): Remove deduplication.
(compute-inputs): Instead do it here on all the collected inputs.

Change-Id: I2504cc693e9bf2e4cc44fd37b5823904dbaaa925
Reviewed-by: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Lars-Dominik Braun 2024-12-15 17:02:44 +01:00 committed by Sharlatan Hellseher
parent c904350a81
commit a3ffb920f1
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -283,12 +283,7 @@ (define (section-header? line)
(let ((line (read-line port)))
(cond
((eof-object? line)
;; Duplicates can occur, since the same requirement can be
;; listed multiple times with different conditional markers, e.g.
;; pytest >= 3 ; python_version >= "3.3"
;; pytest < 3 ; python_version < "3.3"
(map (compose reverse delete-duplicates)
(list required-deps test-deps)))
(list required-deps test-deps))
((or (string-null? line) (comment? line))
(loop required-deps test-deps inside-test-section? optional?))
((section-header? line)
@ -342,8 +337,7 @@ (define (test-requirement? line)
(let ((line (read-line port)))
(cond
((eof-object? line)
(map (compose reverse delete-duplicates)
(list required-deps test-deps)))
(list required-deps test-deps))
((and (requires-dist-header? line) (not (extra? line)))
(loop (cons (specification->requirement-name
(requires-dist-value line))
@ -486,8 +480,10 @@ (define (add-missing-native-inputs inputs)
(let ((dependencies (guess-requirements source-url wheel-url archive)))
(match dependencies
((propagated native)
(append (requirements->upstream-inputs propagated 'propagated)
(requirements->upstream-inputs (add-missing-native-inputs native) 'native))))))
(append (requirements->upstream-inputs (delete-duplicates propagated)
'propagated)
(requirements->upstream-inputs (delete-duplicates (add-missing-native-inputs native))
'native))))))
(define* (pypi-package-inputs pypi-package #:optional version)
"Return the list of <upstream-input> for PYPI-PACKAGE. This procedure