File: Catch-packagenotfound-error-when-trying-to-get-optional-d.patch

package info (click to toggle)
sunpy 7.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,208 kB
  • sloc: python: 40,753; ansic: 1,710; makefile: 36
file content (24 lines) | stat: -rw-r--r-- 906 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From: Ole Streicher <olebole@debian.org>
Date: Thu, 22 Aug 2024 16:57:27 +0200
Subject: Catch packagenotfound error when trying to get optional dependencies

---
 sunpy/util/sysinfo.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sunpy/util/sysinfo.py b/sunpy/util/sysinfo.py
index b852a5e..a645a8f 100644
--- a/sunpy/util/sysinfo.py
+++ b/sunpy/util/sysinfo.py
@@ -46,7 +46,10 @@ def get_requirements(package, *, expand_groups=False):
         The values are a nested dictionary with keys being the package names and
         values being the `packaging.requirements.Requirement` objects.
     """
-    requirements: list = requires(package)
+    try:
+        requirements: list = requires(package)
+    except PackageNotFoundError:
+        requirements = []
     requires_dict = defaultdict(dict)
     for requirement in requirements:
         req = Requirement(requirement)