Skip to content

Commit 2cce5f9

Browse files
committed
Update patch
1 parent 121a0b8 commit 2cce5f9

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed
Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
diff -ruN python-igraph-0.11.9/setup.py python-igraph-0.11.9-patch/setup.py
22
--- python-igraph-0.11.9/setup.py 2025-06-11 02:02:53.000000000 +0200
3-
+++ python-igraph-0.11.9-patch/setup.py 2025-10-13 15:31:02.911638088 +0200
4-
@@ -742,6 +742,21 @@
3+
+++ python-igraph-0.11.9-patch/setup.py 2025-10-13 16:27:29.638189284 +0200
4+
@@ -742,6 +742,38 @@
55
self.libraries = [opt[2:] for opt in opts if opt.startswith("-l")]
66
self.library_dirs = [opt[2:] for opt in opts if opt.startswith("-L")]
77
self.include_dirs = [opt[2:] for opt in opts if opt.startswith("-I")]
@@ -11,15 +11,32 @@ diff -ruN python-igraph-0.11.9/setup.py python-igraph-0.11.9-patch/setup.py
1111
+ # pkg-config emits xml2, lzma, iconv (and sometimes z for zlib).
1212
+ # Remap these to the expected names and drop unsupported ones.
1313
+ if building_on_windows_msvc():
14+
+ # Remap common library names; handle lzma specially
15+
+ # based on availability.
1416
+ remap = {
1517
+ "xml2": "libxml2",
16-
+ "lzma": "liblzma",
1718
+ "iconv": "libiconv",
1819
+ "z": "zlib",
1920
+ }
20-
+ self.libraries = [remap.get(lib, lib) for lib in self.libraries]
21+
+ libs = [remap.get(lib, lib) for lib in self.libraries]
22+
+
23+
+ # Prefer liblzma on Windows if the import library exists;
24+
+ # otherwise keep lzma
25+
+ try:
26+
+ use_liblzma = any(
27+
+ os.path.isfile(os.path.join(d, "liblzma.lib"))
28+
+ for d in self.library_dirs
29+
+ )
30+
+ except Exception:
31+
+ use_liblzma = False
32+
+
33+
+ if use_liblzma:
34+
+ libs = ["liblzma" if lib == "lzma" else lib for lib in libs]
35+
+
2136
+ # Remove libraries not meaningful for MSVC builds if present
22-
+ self.libraries = [lib for lib in self.libraries if lib not in ("pthread", "gomp")]
37+
+ self.libraries = [
38+
+ lib for lib in libs if lib not in ("pthread", "gomp")
39+
+ ]
2340
return True
2441

2542
def print_build_info(self) -> None:

0 commit comments

Comments
 (0)