From 8ab434690c870deb95bfbf61adc60a6a38d084bb Mon Sep 17 00:00:00 2001 Message-ID: <8ab434690c870deb95bfbf61adc60a6a38d084bb.1734278914.git.lars@6xq.net> In-Reply-To: References: From: Lars-Dominik Braun Date: Sun, 15 Dec 2024 17:02:44 +0100 Subject: [PATCH 4/4] 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 --- guix/import/pypi.scm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index bba7361307..530b7d6879 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -283,12 +283,7 @@ (define (parse-requires.txt requires.txt) (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 (parse-wheel-metadata metadata) (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 (compute-inputs source-url wheel-url archive) (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 for PYPI-PACKAGE. This procedure -- 2.45.2