@@ -410,6 +410,11 @@ def make_project_static_library(source_path: pathlib.Path, project: str):
410
410
def convert_to_static_library (source_path : pathlib .Path , extension : str , entry : dict ):
411
411
"""Converts an extension to a static library."""
412
412
413
+ proj_path = source_path / "PCbuild" / ("%s.vcxproj" % extension )
414
+
415
+ if not proj_path .exists () and entry .get ("ignore_missing" ):
416
+ return False
417
+
413
418
# Make the extension's project emit a static library so we can link
414
419
# against libpython.
415
420
make_project_static_library (source_path , extension )
@@ -418,8 +423,6 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
418
423
for project in entry .get ("static_depends" , []):
419
424
make_project_static_library (source_path , project )
420
425
421
- proj_path = source_path / "PCbuild" / ("%s.vcxproj" % extension )
422
-
423
426
copy_link_to_lib (proj_path )
424
427
425
428
lines = []
@@ -626,6 +629,8 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
626
629
with pcbuild_sln_path .open ("w" , encoding = "utf8" ) as fh :
627
630
fh .write ("\n " .join (lines ))
628
631
632
+ return True
633
+
629
634
630
635
def copy_link_to_lib (p : pathlib .Path ):
631
636
"""Copy the contents of a <Link> section to a <Lib> section."""
@@ -911,8 +916,8 @@ def hack_project_files(
911
916
912
917
init_fn = entry .get ("init" , "PyInit_%s" % extension )
913
918
914
- add_to_config_c (cpython_source_path , extension , init_fn )
915
- convert_to_static_library (cpython_source_path , extension , entry )
919
+ if convert_to_static_library (cpython_source_path , extension , entry ):
920
+ add_to_config_c (cpython_source_path , extension , init_fn )
916
921
917
922
# pythoncore.vcxproj produces libpython. Typically pythonXY.dll. We change
918
923
# it to produce a static library.
0 commit comments