diff --git a/conda_build/skeletons/cpan.py b/conda_build/skeletons/cpan.py index 94a1efa5c7..090d298644 100644 --- a/conda_build/skeletons/cpan.py +++ b/conda_build/skeletons/cpan.py @@ -205,7 +205,7 @@ def get_build_dependencies_from_src_archive(package_url, sha256, src_cache): need_f = any([f.name.lower().endswith(('.f', '.f90', '.f77', '.f95', '.f03')) for f in tf]) # Fortran builds use CC to perform the link (they do not call the linker directly). need_c = True if need_f else \ - any([f.name.lower().endswith('.c') for f in tf]) + any([f.name.lower().endswith(('.c', '.xs')) for f in tf]) need_cxx = any([f.name.lower().endswith(('.cxx', '.cpp', '.cc', '.c++')) for f in tf]) need_autotools = any([f.name.lower().endswith('/configure') for f in tf]) diff --git a/news/4599-add-cpan-xs-detection b/news/4599-add-cpan-xs-detection new file mode 100644 index 0000000000..c0938e4785 --- /dev/null +++ b/news/4599-add-cpan-xs-detection @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* conda skeleton cpan now correctly adds a C compiler as dependency if the distribution contains an `.xs` file + +### Deprecations + +* + +### Docs + +* + +### Other + +* diff --git a/tests/test_api_skeleton_cpan.py b/tests/test_api_skeleton_cpan.py new file mode 100644 index 0000000000..815cb43522 --- /dev/null +++ b/tests/test_api_skeleton_cpan.py @@ -0,0 +1,23 @@ +# Copyright (C) 2014 Anaconda, Inc +# SPDX-License-Identifier: BSD-3-Clause +''' +Integrative tests of the CPAN skeleton that start from +conda_build.api.skeletonize and check the output files +''' + + +import pytest + +from conda_build import api +from conda_build.jinja_context import compiler + + +@pytest.mark.slow +@pytest.mark.flaky(rerun=5, reruns_delay=2) +def test_xs_needs_c_compiler(testing_config): + """Perl packages with XS files need a C compiler""" + # This uses Sub::Identify=0.14 since it includes no .c files but a .xs file. + api.skeletonize("Sub::Identify", version="0.14", repo="cpan", config=testing_config) + m = api.render("perl-sub-identify/0.14", finalize=False, bypass_env_check=True)[0][0] + build_requirements = m.get_value("requirements/build") + assert compiler("c", testing_config) in build_requirements