Skip to content

Commit

Permalink
feat: add support for recipe.yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Jul 15, 2024
1 parent 0c48e83 commit 4a387b6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# pixi environments
.pixi
pixi.toml
pixi.lock
3 changes: 2 additions & 1 deletion .github/workflows/scripts/create_feedstocks
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ conda install --yes --quiet \
"gitpython>=3.0.8,<3.1.20" \
requests \
ruamel.yaml \
"pygithub>=2.1.1"
"pygithub>=2.1.1" \
"rattler-build-conda-compat>=0.0.6,<0.1"

conda info
mamba info
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/scripts/create_feedstocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"""
from __future__ import print_function

from conda_build.metadata import MetaData
from rattler_build_conda_compat.render import MetaData as RattlerBuildMetaData
from conda_smithy.utils import get_feedstock_name_from_meta
from contextlib import contextmanager
from datetime import datetime, timezone
Expand All @@ -37,8 +37,17 @@


def list_recipes():
if os.path.isdir(recipe_directory_name):
recipes = os.listdir(recipe_directory_name)
"""
Locates all the recipes in the `recipes/` folder at the root of the repository.
For each found recipe this function returns a tuple consisting of
* the path to the recipe directory
* the name of the feedstock
"""
repository_root = os.path.abspath(os.path.join(os.path.dirname(os.path.join(__file__)), f"../../../"))
abs_recipe_dir = os.path.join(repository_root, recipe_directory_name)
if os.path.isdir(abs_recipe_dir):
recipes = os.listdir(abs_recipe_dir)
else:
recipes = []

Expand All @@ -49,8 +58,17 @@ def list_recipes():
# containing folder.
if recipe_dir in ['example', '.DS_Store']:
continue
path = os.path.abspath(os.path.join(recipe_directory_name, recipe_dir))
yield path, get_feedstock_name_from_meta(MetaData(path))

# Try to look for a conda-build recipe.
path = os.path.abspath(os.path.join(abs_recipe_dir, recipe_dir))
try:
yield path, get_feedstock_name_from_meta(MetaData(path))
continue
except OSError:
pass

# If no conda-build recipe was found, try to load a rattler-build recipe.
yield path, get_feedstock_name_from_meta(RattlerBuildMetaData(path))


@contextmanager
Expand Down

0 comments on commit 4a387b6

Please sign in to comment.