import: pypi: Deduplicate requirements.

* guix/import/pypi.scm (parse-requires.txt): Remove potential duplicates.
This commit is contained in:
Maxim Cournoyer 2019-03-28 00:26:01 -04:00
parent 803fb336d6
commit cc9a77cd39
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -177,7 +177,11 @@ (define (section-header? line)
;; (extra) requirements. Non-optional requirements must appear
;; before any section is defined.
(if (or (eof-object? line) (section-header? line))
(reverse result)
;; 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"
(reverse (delete-duplicates result))
(cond
((or (string-null? line) (comment? line))
(loop result))