"""
import os
+from pathlib import Path
import platform
import shutil
import sys
+from typing import Dict
import pytest
sys.path.append(os.path.join(os.path.dirname(__file__), "../rtest"))
"""
return os.getenv("build_system") == "cmake"
+def _freedesktop_os_release() -> Dict[str, str]:
+ """
+ polyfill for `platform.freedesktop_os_release`
+ """
+ release = {}
+ os_release = Path("/etc/os-release")
+ if os_release.exists():
+ with open(os_release, "rt", encoding="utf-8") as f:
+ for line in f.readlines():
+ if line.startswith("#") or "=" not in line:
+ continue
+ key, _, value = (x.strip() for x in line.partition("="))
+ # remove quotes
+ if len(value) >= 2 and value[0] == '"' and value[-1] == '"':
+ value = value[1:-1]
+ release[key] = value
+ return release
+
+def is_centos() -> bool:
+ """
+ is the current CI environment CentOS-based?
+ """
+ return _freedesktop_os_release().get("ID") == "centos"
+
@pytest.mark.parametrize("binary", [
"acyclic",
"bcomps",
assert shutil.which(tool) is None, f"{tool} has been resurrected in the " \
f'{os.getenv("build_system")} build on {os_id}. Please remove skip.'
-@pytest.mark.xfail(is_cmake(),
+@pytest.mark.xfail(is_cmake() and not is_centos(),
reason="png:gd unavailable when built with CMake",
strict=True) # FIXME
def test_1786():
set(GD_INCLUDE_DIRS ${GD_INCLUDE_DIR})
set(GD_LIBRARIES ${GD_LIBRARY})
set(GD_RUNTIME_LIBRARIES ${GD_RUNTIME_LIBRARY})
+
+find_program(GDLIB_CONFIG gdlib-config)
+if(GDLIB_CONFIG)
+ message(STATUS "Found gdlib-config: ${GDLIB_CONFIG}")
+ execute_process(COMMAND ${GDLIB_CONFIG} --features
+ RESULT_VARIABLE GDLIB_CONFIG_EXIT_STATUS
+ OUTPUT_VARIABLE GD_FEATURES
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT GDLIB_CONFIG_EXIT_STATUS EQUAL 0)
+ message(FATAL_ERROR "Failed to query GD features")
+ endif()
+ message(STATUS "Detected GD features: ${GD_FEATURES}")
+ string(REPLACE " " ";" GD_FEATURES_LIST ${GD_FEATURES})
+ if("GD_PNG" IN_LIST GD_FEATURES_LIST)
+ set(HAVE_GD_PNG 1)
+ endif()
+ if("GD_JPEG" IN_LIST GD_FEATURES_LIST)
+ set(HAVE_GD_JPEG 1)
+ endif()
+ if("GD_XPM" IN_LIST GD_FEATURES_LIST)
+ set(HAVE_GD_XPM 1)
+ endif()
+ if("GD_FONTCONFIG" IN_LIST GD_FEATURES_LIST)
+ set(HAVE_GD_FONTCONFIG 1)
+ endif()
+ if("GD_FREETYPE" IN_LIST GD_FEATURES_LIST)
+ set(HAVE_GD_FREETYPE 1)
+ endif()
+ if("GD_GIF" IN_LIST GD_FEATURES_LIST)
+ set(HAVE_GD_GIF 1)
+ endif()
+else()
+ message(WARNING "gdlib-config not found; skipping feature checks")
+endif()
#cmakedefine HAVE_ANN
#cmakedefine HAVE_EXPAT
#cmakedefine HAVE_LIBGD
+#cmakedefine HAVE_GD_PNG
+#cmakedefine HAVE_GD_JPEG
+#cmakedefine HAVE_GD_XPM
+#cmakedefine HAVE_GD_FONTCONFIG
+#cmakedefine HAVE_GD_FREETYPE
+#cmakedefine HAVE_GD_GIF
#cmakedefine HAVE_ZLIB
// Values