From 1e5c28f36b0fd2d5ac1683c88d48e3d7c243e993 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 22:18:22 +0200 Subject: Adding upstream version 0.1.28. Signed-off-by: Daniel Baumann --- coverage-report/d_9ae9c81fc31f2694_numpy3_py.html | 161 ++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 coverage-report/d_9ae9c81fc31f2694_numpy3_py.html (limited to 'coverage-report/d_9ae9c81fc31f2694_numpy3_py.html') diff --git a/coverage-report/d_9ae9c81fc31f2694_numpy3_py.html b/coverage-report/d_9ae9c81fc31f2694_numpy3_py.html new file mode 100644 index 0000000..03e18e1 --- /dev/null +++ b/coverage-report/d_9ae9c81fc31f2694_numpy3_py.html @@ -0,0 +1,161 @@ + + + + + Coverage for debputy/plugins/numpy3.py: 86% + + + + + +
+
+

+ Coverage for debputy/plugins/numpy3.py: + 86% +

+ +

+ 34 statements   + + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.7, + created at 2024-04-07 12:14 +0200 +

+ +
+
+
+

1import functools 

+

2import os 

+

3from typing import Any, Tuple 

+

4 

+

5from debputy.plugin.api import ( 

+

6 DebputyPluginInitializer, 

+

7 BinaryCtrlAccessor, 

+

8 PackageProcessingContext, 

+

9) 

+

10from debputy.util import _error 

+

11 

+

12 

+

13def initialize(api: DebputyPluginInitializer) -> None: 

+

14 api.metadata_or_maintscript_detector( 

+

15 "numpy-depends", 

+

16 numpy3_versions, 

+

17 # Probably not necessary, but this is the most faithful conversion 

+

18 package_type=["deb", "udeb"], 

+

19 ) 

+

20 

+

21 

+

22@functools.lru_cache 

+

23def _parse_numpy3_versions(versions_file: str) -> Tuple[str, str]: 

+

24 attributes = {} 

+

25 try: 

+

26 with open(versions_file, "rt", encoding="utf-8") as fd: 

+

27 for line in fd: 

+

28 if line.startswith("#") or line.isspace(): 

+

29 continue 

+

30 k, v = line.split() 

+

31 attributes[k] = v 

+

32 except FileNotFoundError: 

+

33 _error( 

+

34 f"Missing Build-Dependency on python3-numpy to ensure {versions_file}" 

+

35 " is present." 

+

36 ) 

+

37 

+

38 try: 

+

39 api_min_version = attributes["api-min-version"] 

+

40 abi_version = attributes["abi"] 

+

41 except KeyError as e: 

+

42 k = e.args[0] 

+

43 _error(f'Expected {versions_file} to contain the key "{k}"') 

+

44 assert False 

+

45 

+

46 return api_min_version, abi_version 

+

47 

+

48 

+

49def numpy3_versions( 

+

50 _unused: Any, 

+

51 ctrl: BinaryCtrlAccessor, 

+

52 context: PackageProcessingContext, 

+

53) -> None: 

+

54 if context.binary_package.is_arch_all: 

+

55 dep = "python3-numpy" 

+

56 else: 

+

57 # Note we do not support --strict; codesearch.d.n suggests it is not used 

+

58 # anywhere and this saves us figuring out how to support it here. 

+

59 versions_file = os.environ.get("_NUMPY_TEST_PATH", "/usr/share/numpy3/versions") 

+

60 api_min_version, abi_version = _parse_numpy3_versions(versions_file) 

+

61 dep = f"python3-numpy (>= {api_min_version}), python3-numpy-abi{abi_version}" 

+

62 ctrl.substvars.add_dependency("python3:Depends", dep) 

+
+ + + -- cgit v1.2.3