Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 4f42440

Browse files
tobiasdiezMatthias Koeppe
authored and
Matthias Koeppe
committed
sage.env.cython_aliases: Do not fail if one of the listed libraries is not known to pkgconfig
1 parent 5cb72aa commit 4f42440

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/sage/env.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,15 @@ def cython_aliases():
420420
pc = defaultdict(list, {'libraries': ['z']})
421421
libs = "-lz"
422422
else:
423-
aliases[var + "CFLAGS"] = pkgconfig.cflags(lib).split()
424-
pc = pkgconfig.parse(lib)
425-
libs = pkgconfig.libs(lib)
423+
try:
424+
aliases[var + "CFLAGS"] = pkgconfig.cflags(lib).split()
425+
pc = pkgconfig.parse(lib)
426+
libs = pkgconfig.libs(lib)
427+
except pkgconfig.PackageNotFoundError:
428+
from distutils import log
429+
log.warn('Package {0} not installed'.format(lib))
430+
continue
431+
426432
# It may seem that INCDIR is redundant because the -I options are also
427433
# passed in CFLAGS. However, "extra_compile_args" are put at the end
428434
# of the compiler command line. "include_dirs" go to the front; the
@@ -454,7 +460,9 @@ def uname_specific(name, value, alternative):
454460
# file (possibly because of confusion between CFLAGS and CXXFLAGS?).
455461
# This is not a problem in practice since LinBox depends on
456462
# fflas-ffpack and fflas-ffpack does add such a C++11 flag.
457-
aliases["LINBOX_CFLAGS"].append("-std=gnu++11")
463+
if "LINBOX_CFLAGS" in aliases:
464+
aliases["LINBOX_CFLAGS"].append("-std=gnu++11")
465+
458466
aliases["ARB_LIBRARY"] = ARB_LIBRARY
459467

460468
# TODO: Remove Cygwin hack by installing a suitable cblas.pc
@@ -463,7 +471,7 @@ def uname_specific(name, value, alternative):
463471

464472
try:
465473
aliases["M4RI_CFLAGS"].remove("-pedantic")
466-
except ValueError:
474+
except (ValueError, KeyError):
467475
pass
468476

469477
# Determine ecl-specific compiler arguments using the ecl-config script

0 commit comments

Comments
 (0)