Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C compiler dep when .xs files are found. #4599

Merged
merged 5 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda_build/skeletons/cpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
19 changes: 19 additions & 0 deletions news/4599-add-cpan-xs-detection
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* conda skeleton cpan now correctly adds a C compiler as dependency if the distribution contains an `.xs` file

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
23 changes: 23 additions & 0 deletions tests/test_api_skeleton_cpan.py
Original file line number Diff line number Diff line change
@@ -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