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

Update recipe schema for new globs and files #34

Merged
merged 4 commits into from
Jul 9, 2024
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
9 changes: 9 additions & 0 deletions examples/valid/mamba/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ outputs:

build:
script: ${{ "build_mamba.sh" if unix else "build_mamba.bat" }}
files: "**"

requirements:
build:
Expand Down Expand Up @@ -86,6 +87,12 @@ outputs:
build:
script: ${{ "build_mamba.sh" if unix else "build_mamba.bat" }}
string: py${{ CONDA_PY }}h${{ PKG_HASH }}_${{ PKG_BUILDNUM }}
files:
include:
- include/*.hpp
exclude:
- foo/*.hpp

requirements:
build:
- ${{ compiler('cxx') }}
Expand Down Expand Up @@ -134,6 +141,8 @@ outputs:
build:
script: ${{ "build_mamba.sh" if unix else "build_mamba.bat" }}
string: py${{ CONDA_PY }}h${{ PKG_HASH }}_${{ PKG_BUILDNUM }}
files:
- foo.*
python:
entry_points:
- mamba = mamba.mamba:main
Expand Down
184 changes: 184 additions & 0 deletions examples/valid/single-output/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# yaml-language-server: $schema=../../../schema.json
schema_version: 1
# a recipe with all possible fields
package:
name: single_output
version: "0.1.0"

source:
# url source
- url: https://github.com/test/test-package.tar.gz
sha256: 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
md5: 1234567890abcdef1234567890abcdef
file_name: test-package.tar.gz
target_directory: test-package
patches:
- file.patch
# path source
- path: ./some-file.tar.gz
# currently not valid
sha256: 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
md5: 1234567890abcdef1234567890abcdef
patches:
- file.patch
file_name: test-package.tar.gz
target_directory: test-package
- git: https://github.com/test/package
depth: 10
patches:
- file.patch
lfs: false
target_directory: test-package-git

build:
number: 0
string: "blabla"
skip:
- false
noarch: generic
merge_build_and_host_envs: true
files:
include:
- include/*
- "**/foo.txt"
- x.txt
- out/**
exclude:
- foo/*
- bar.txt
- baz/
script:
env:
TEST: MYENV_VAR
secrets:
- SECRET_VARIABLE
content:
- test
python:
entry_points:
- test = test:main
skip_pyc_compilation:
- test/bla/**/*.py
use_python_app_entrypoint: true

always_copy_files:
- file1
- file2/**/*
always_include_files:
- file1
- file2/**/*

dynamic_linking:
rpaths: ["lib/"]
binary_relocation:
- lib/*
missing_dso_allowlist:
- /all/lib/**/*
rpath_allowlist:
- bla/*
overdepending_behavior: error
overlinking_behavior: ignore

variant:
use_keys:
- key1
- key2
ignore_keys:
- python
- numpy
down_prioritize_variant: -5

prefix_detection:
force_file_type:
text:
- bla/*.txt
binary:
- bla/*.so
ignore: true
ignore_binary_files: true
# post_process:
# - regex: "complicated(.*)regex"
# replacement: "simple_string"
# files:
# - "*.cmake"
# - "bla/"

requirements:
build:
- ${{ compiler('c') }}
- cmake
host:
- openssl
run:
- python >=3.11
- perl
run_constraints:
- python * *cpython
run_exports:
weak:
- python
strong:
- python
weak_constraints:
- python
strong_constraints:
- python
noarch:
- python
ignore_run_exports:
from_package:
- python
by_name:
- python

tests:
- script: |
echo FOO
requirements:
run:
- bash
build:
- bash
files:
source:
- include/
- src/*.c
- src_file.txt
- package_contents:
lib:
- test
- test.so.*
include:
- test.h
- test.h*
bin:
- test
- test.exe
- foo*
site_packages:
- numpy
- numpy/foo/__init__.py
files:
- test.txt
- license.txt
- python:
imports:
- numpy
- pypy
pip_check: false

about:
homepage: https://cool-website.com
license: BSD-3-Clause
license_file: LICENSE
summary: A summary
description: |
More description
documentation: https://cool-docs.com
repository: https://github.com/some-repo/some-package

extra:
recipe-maintainers:
- some-maintainer
random_keys:
with: random_value
23 changes: 21 additions & 2 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

NonEmptyStr = constr(min_length=1)
PathNoBackslash = constr(pattern=r"^[^\\]+$")
Glob = NonEmptyStr
UnsignedInt = conint(ge=0)
GitUrl = constr(pattern=r"((git|ssh|http(s)?)|(git@[\w\.]+))(:(\/\/)?)([\w\.@:\/\\-~]+)")

Expand All @@ -39,9 +38,25 @@ class IfStatement(StrictBaseModel, Generic[T]):


###################
# Package section #
# Glob section #
###################

SingleGlob = NonEmptyStr

GlobVec = ConditionalList[SingleGlob]


class GlobDict(StrictBaseModel):
include: GlobVec = Field(..., description="Glob patterns to include")
exclude: GlobVec = Field([], description="Glob patterns to exclude")


Glob = SingleGlob | GlobVec | GlobDict

####################
# Package section #
####################


class SimplePackage(StrictBaseModel):
name: str = Field(description="The package name")
Expand Down Expand Up @@ -227,6 +242,10 @@ class Build(StrictBaseModel):
description="Options that influence how the prefix replacement is done.",
)

files: Glob = Field(
None, description="Glob patterns to include or exclude files from the package."
)


class BaseScript(StrictBaseModel):
interpreter: NonEmptyStr | None = Field(
Expand Down
Loading