From 87e40a21731bf0df112f29afc9add7719d24c886 Mon Sep 17 00:00:00 2001 From: "Martin K. Scherer" Date: Tue, 15 Oct 2024 12:14:37 +0000 Subject: [PATCH] dash to underscore --- pydeps2env/environment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pydeps2env/environment.py b/pydeps2env/environment.py index c95d381..0be4f3d 100644 --- a/pydeps2env/environment.py +++ b/pydeps2env/environment.py @@ -41,6 +41,11 @@ def add_requirement( if not isinstance(req, Requirement): req = Requirement(req) + # A pip requirement can contain dashes in their name, we need to replace them to underscores. + # https://docs.conda.io/projects/conda-build/en/latest/concepts/package-naming-conv.html#term-Package-name + if "-" in req.name: + req.name = req.replace("-", "_") + if req.name not in requirements: requirements[req.name] = req elif mode == "combine":