Skip to content
Closed
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
10 changes: 6 additions & 4 deletions bioconda_utils/bioconductor_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,13 @@ def dependencies(self):

self._cb3_build_reqs = {}
if need_c:
self._cb3_build_reqs['c'] = "{{ compiler('c') }}"
self._cb3_build_reqs['compiler_c'] = "{{ compiler('c') }}"
if need_cxx:
self._cb3_build_reqs['cxx'] = "{{ compiler('cxx') }}"
self._cb3_build_reqs['compiler_cxx'] = "{{ compiler('cxx') }}"
if need_f:
self._cb3_build_reqs['fortran'] = "{{ compiler('fortran') }}"
self._cb3_build_reqs['compiler_fortran'] = "{{ compiler('fortran') }}"
if len(self._cb3_build_reqs):
self._cb3_build_reqs['stdlib_c'] = "{{ stdlib('c') }}"
if need_autotools:
self._cb3_build_reqs['automake'] = 'automake'
if need_make:
Expand Down Expand Up @@ -939,7 +941,7 @@ def sub_placeholders(x):
# Handle libblas and liblapack, which all compiled packages
# are assumed to need
additional_host_deps = []
if self.linkingto != [] or len(set(['c', 'cxx', 'fortran']).intersection(self._cb3_build_reqs.keys())) > 0:
if self.linkingto != [] or len(set(['compiler_c', 'compiler_cxx', 'compiler_fortran', 'stdlib_c']).intersection(self._cb3_build_reqs.keys())) > 0:
additional_host_deps.append('libblas')
additional_host_deps.append('liblapack')

Expand Down
18 changes: 18 additions & 0 deletions bioconda_utils/lint/check_build_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ def check_deps(self, deps):
if "run" in location or "host" in location:
self.message(section=location)

class compiler_needs_stdlib_c(LintCheck):
"""The recipe requests a compiler in the build section, but does not have stdlib.

Please add the ``{{ stdlib('c') }}`` line to the
``requirements: build:`` section.
"""

def check_deps(self, deps):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a check for having stdlib but no compiler?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. It doesn't seem like conda-forge has that check. Although maybe someone might get confused and think they could use it in place of a compiler.

compiler = False
stdlib = False
for dep, locations in deps.items():
if dep.startswith("compiler_") and any(["build" in location for location in locations]):
compiler = True
if dep == "stdlib_c" and any(["build" in location for location in locations]):
stdlib = True
if compiler and not stdlib:
self.message(section="requirements/build")


class uses_setuptools(LintCheck):
"""The recipe uses setuptools in run depends
Expand Down
1 change: 1 addition & 0 deletions bioconda_utils/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class Recipe():
JINJA_VARS = {
"cran_mirror": "https://cloud.r-project.org",
"compiler": lambda x: f"compiler_{x}",
"stdlib": lambda x: f"stdlib_{x}",
"pin_compatible": lambda x, max_pin=None, min_pin=None: f"{x}",
"cdt": lambda x: x
}
Expand Down
16 changes: 10 additions & 6 deletions test/lint_cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ tests:
- name: should_not_be_noarch_compiler
add:
build: { noarch: python }
requirements: { build: [compiler_gcc] }
requirements: { build: [compiler_gcc, stdlib_c] }
expect: should_not_be_noarch_compiler
- name: should_not_be_noarch_skip
add:
Expand All @@ -257,7 +257,7 @@ tests:
sha256: 123 # [linux]
- url: https://elsewhere # [osx]
sha256: 123 # [osx]
requirements: { build: ['{{compiler("c")}}'] }
requirements: { build: ['{{compiler("c")}}', '{{stdlib("c")}}'] }
- name: noarch_java_with_python_wrapper
add:
build: { noarch: generic }
Expand Down Expand Up @@ -328,7 +328,7 @@ tests:
add: { requirements: { build: ["numpy x.x"], run: ["numpy x.x"] } }
- name: compiler_ok
remove: build/noarch
add: { requirements: { build: ['{{compiler("c")}}'] } }
add: { requirements: { build: ['{{compiler("c")}}', '{{stdlib("c")}}'] } }
- name: compiler_old_1
expect: should_use_compilers
add: { requirements: { build: ["gcc # [linux]"] } }
Expand All @@ -341,6 +341,10 @@ tests:
- name: compiler_old_4
expect: should_use_compilers
add: { requirements: { build: ["rust >=1.56"] } }
- name: compiler_needs_stdlib_c
expect: compiler_needs_stdlib_c
remove: build/noarch
add: { requirements: { build: ['{{compiler("c")}}'] } }
- name: compiler_in_host
expect: compilers_must_be_in_build
remove: build/noarch
Expand Down Expand Up @@ -397,18 +401,18 @@ tests:
- name: cython_in_run
expect: cython_must_be_in_host
add:
requirements: { run: [cython], build: ['{{compiler("c")}}'] }
requirements: { run: [cython], build: ['{{compiler("c")}}', '{{stdlib("c")}}'] }
build: { noarch: False }
- name: cython_in_host_no_compiler
expect: cython_needs_compiler
add: { requirements: { host: [cython] } }
- name: cython_in_host
add:
requirements: { host: [cython], build: ['{{compiler("c")}}'] }
requirements: { host: [cython], build: ['{{compiler("c")}}', '{{stdlib("c")}}'] }
build: { noarch: False }
- name: cython_cxx_compiler_ok
add:
requirements: { host: [cython], build: ['{{compiler("cxx")}}'] }
requirements: { host: [cython], build: ['{{compiler("cxx")}}', '{{stdlib("c")}}'] }
build: { noarch: False }
- name: missing_run_exports
remove: build/run_exports
Expand Down