spdx_checker 0.1.6__cp312-cp312-macosx_14_0_arm64.whl → 0.1.7__cp312-cp312-macosx_14_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
builder.py CHANGED
@@ -10,11 +10,80 @@ INCLUDE_DIR = sysconfig.get_config_var("INCLUDEPY")
10
10
  PYTHON_VERSION = sysconfig.get_config_var("py_version_short")
11
11
  PACKAGE_NAME = "spdx_checker"
12
12
 
13
-
14
13
  if LIB_DIR is None:
15
14
  # WINODWS only, workaround for Python versions < 3.13.
16
15
  LIB_DIR = os.path.join(INSTALL_BASE, "libs")
17
16
 
17
+ # Zig Targets to build for different platforms
18
+ # <cpu-arch>-<os>-<abi>
19
+ CIBW_BUILD = os.getenv("CIBW_BUILD")
20
+ # CIBW_PLATFORM = os.getenv("CIBW_PLATFORM")
21
+
22
+
23
+ def get_zig_target_triple_from_CIBW(cibw_build: str) -> str:
24
+ """
25
+ Get the Zig target triple from the CIBW_BUILD environment variable.
26
+ This is used to determine the target architecture and OS for building.
27
+
28
+ CIBW_BUILD is expected to be in the format:
29
+ cp<pyver>-<os>_<arch>
30
+ where <pyver> is the Python version, <os> is the operating system, and <arch> is the architecture.
31
+ E.g. "cp36-macosx_x86_64" or "cp311-macosx_arm64".
32
+
33
+ Zig target triples are in the format:
34
+ <cpu-arch>-<os>-gnu
35
+ where <cpu-arch> is the architecture (e.g., x86_64, aarch64) and <os> is the operating system (e.g., linux, macos, windows).
36
+ E.g. "x86_64-macos-gnu" or "aarch64-linux-gnu".
37
+
38
+ This function will translate the CIBW_BUILD format to the Zig target triple format.
39
+ E.g. "cp311-macosx_arm64" -> "aarch64-macos-gnu".
40
+
41
+
42
+ Returns
43
+ -------
44
+ str: The Zig target triple in the format <cpu-arch>-<os>-gnu.
45
+
46
+ Raises
47
+ -------
48
+ ValueError: If the CIBW_BUILD format is invalid.
49
+ """
50
+ if not cibw_build:
51
+ raise ValueError("CIBW_BUILD is not set or empty")
52
+
53
+ # Match patterns like cp311-macosx_arm64 or cp36-manylinux_x86_64
54
+ # Split based on '-' and then '_'
55
+ try:
56
+ _, os_arch = cibw_build.split("-", 1)
57
+ os_part, arch_part = os_arch.split("_", 1)
58
+ except ValueError:
59
+ raise ValueError(f"Invalid CIBW_BUILD format: {cibw_build}")
60
+
61
+ # Map CIBW arch to Zig arch
62
+ arch_map = {
63
+ "x86_64": "x86_64",
64
+ "amd64": "x86_64",
65
+ "i686": "x86",
66
+ "arm64": "aarch64",
67
+ "aarch64": "aarch64",
68
+ }
69
+ # Map CIBW OS to Zig OS
70
+ os_map = {
71
+ "manylinux": "linux",
72
+ "linux": "linux",
73
+ "macosx": "macos",
74
+ "win": "windows",
75
+ "windows": "windows",
76
+ }
77
+
78
+ if arch_part not in arch_map:
79
+ raise ValueError(f"Unknown architecture: {arch_part}")
80
+ if os_part not in os_map:
81
+ raise ValueError(f"Unknown OS: {os_part}")
82
+
83
+ zig_arch = arch_map[arch_part]
84
+ zig_os = os_map[os_part]
85
+
86
+ return f"{zig_arch}-{zig_os}"
18
87
 
19
88
 
20
89
  class ZigBuilder(build_ext):
@@ -36,6 +105,15 @@ class ZigBuilder(build_ext):
36
105
  f"-femit-bin={self.get_ext_fullpath(ext.name)}",
37
106
  ]
38
107
 
108
+ if CIBW_BUILD:
109
+ # CIBW_BUILD is set, so we are building in a CI environment
110
+ cmd += ["-target", get_zig_target_triple_from_CIBW(cibw_build=CIBW_BUILD)]
111
+ else:
112
+ raise ValueError(
113
+ "CIBW_BUILD environment variable is not set. "
114
+ "This script is intended to be run in a CI environment."
115
+ )
116
+
39
117
  if is_windows:
40
118
  cmd += ["-l", "python3"]
41
119
  elif is_macos:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spdx_checker
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Fast SPDX License Checker for Source Code
5
5
  Author-email: Tobias Stach <tobias.stach@gmail.com>
6
6
  Requires-Python: >=3.11
@@ -0,0 +1,9 @@
1
+ spdx_checker.cpython-312-darwin.so,sha256=vZzAK6Xo3Lpj8dUThrFXzqb0rGd6RBOE3rhrnaELlcU,1455504
2
+ builder.py,sha256=zgGnTWOcQZ6NAfJwMeQEG31dgT2XAtlAn7VGq9lCFHM,3746
3
+ spdx_checker.cpython-312-darwin.so.o,sha256=NJ4mSS9pX_YWfKtqHY9-rZ3vpy7SQ8gXCn14ZfLa_hE,2341080
4
+ spdx_checker.dylibs/Python,sha256=POlqArdXdDeilwUzclqjakWJwLJ-XWgGoVPUzbeSSak,16238064
5
+ spdx_checker-0.1.7.dist-info/RECORD,,
6
+ spdx_checker-0.1.7.dist-info/WHEEL,sha256=VrhWOWJdu4wN9IKhAFBqWPMo6yuww-SFg9GbWc0qbmI,136
7
+ spdx_checker-0.1.7.dist-info/top_level.txt,sha256=0CKwo5BsnFVH1L_s6lYyGScwWHuA6KQlGNPddOwxQ6k,21
8
+ spdx_checker-0.1.7.dist-info/METADATA,sha256=wpfztxQZvOdr0i9xk1dnyXjZ43SNnmH4Jgdx1dW-3Qo,984
9
+ spdx_checker-0.1.7.dist-info/licenses/LICENSE,sha256=3Z6usZRRE9Iq4bA3UAarnC8cLpvF655eNYvSJsjIoP8,1063
Binary file
Binary file
@@ -1,9 +0,0 @@
1
- spdx_checker.cpython-312-darwin.so,sha256=-xkFhTyydkEwSg0eLdjhuJ2JngK2MyB3Y333FDgMDLU,1455504
2
- builder.py,sha256=RUZ2YGRvhi-r2KRm5__yAAT0uKb9DXIrA18Vmk2ihzU,1150
3
- spdx_checker.cpython-312-darwin.so.o,sha256=Np6inzH89D9r54zDgDny0QMw_XVNC88zKu8s4S7wGRM,2341080
4
- spdx_checker-0.1.6.dist-info/RECORD,,
5
- spdx_checker-0.1.6.dist-info/WHEEL,sha256=VrhWOWJdu4wN9IKhAFBqWPMo6yuww-SFg9GbWc0qbmI,136
6
- spdx_checker-0.1.6.dist-info/top_level.txt,sha256=0CKwo5BsnFVH1L_s6lYyGScwWHuA6KQlGNPddOwxQ6k,21
7
- spdx_checker-0.1.6.dist-info/METADATA,sha256=oe0csKpetrXyiGfjkv-yKlrOO0Zk1Q95MNSjdgikHkU,984
8
- spdx_checker-0.1.6.dist-info/licenses/LICENSE,sha256=3Z6usZRRE9Iq4bA3UAarnC8cLpvF655eNYvSJsjIoP8,1063
9
- spdx_checker.dylibs/Python,sha256=POlqArdXdDeilwUzclqjakWJwLJ-XWgGoVPUzbeSSak,16238064