├── rust-toolchain ├── test-data ├── recipes │ ├── test-sources │ │ ├── test-file.txt │ │ ├── test-folder │ │ │ ├── test-file-2.txt │ │ │ └── test-file-3.txt │ │ └── recipe.yaml │ ├── double_license │ │ ├── license.txt │ │ └── recipe.yaml │ ├── source_filter │ │ ├── test-folder │ │ │ ├── excluded.txt │ │ │ ├── included.txt │ │ │ └── not-included │ │ └── recipe.yaml │ ├── test-execution │ │ ├── testfile.txt │ │ ├── testfolder │ │ │ └── data.txt │ │ └── recipe-test-fail.yaml │ ├── abi3 │ │ ├── variants.yaml │ │ └── recipe.yaml │ ├── script │ │ ├── script.sh │ │ ├── script.bat │ │ ├── recipe.yaml │ │ └── recipe_with_extensions.yaml │ ├── interpreter-detection │ │ ├── r │ │ │ ├── build.r │ │ │ └── recipe.yaml │ │ ├── bash │ │ │ ├── build.sh │ │ │ ├── test.sh │ │ │ └── recipe.yaml │ │ ├── bat │ │ │ ├── build.bat │ │ │ └── recipe.yaml │ │ ├── nu │ │ │ ├── build.nu │ │ │ └── recipe.yaml │ │ ├── pl │ │ │ ├── build.pl │ │ │ └── recipe.yaml │ │ ├── py │ │ │ ├── build.py │ │ │ └── recipe.yaml │ │ └── recipe.yaml │ ├── package-content-tests │ │ ├── variant-config.yaml │ │ ├── recipe-test-fail.yaml │ │ ├── recipe-test-succeed.yaml │ │ └── llama-recipe.yaml │ ├── recipe_variant │ │ ├── variants.yaml │ │ └── recipe.yaml │ ├── used-vars │ │ ├── variants.yaml │ │ └── recipe_1.yaml │ ├── variant_config │ │ ├── variant_config.yaml │ │ └── recipe.yaml │ ├── topological-sort-variants │ │ ├── pkg-a │ │ │ ├── variants.yaml │ │ │ └── recipe.yaml │ │ ├── pkg-b │ │ │ ├── variants.yaml │ │ │ └── recipe.yaml │ │ └── pkg-c │ │ │ ├── variants.yaml │ │ │ └── recipe.yaml │ ├── variants │ │ ├── python_variant.yaml │ │ ├── variant_config.yaml │ │ ├── boltons_recipe.yaml │ │ ├── recipe.yaml │ │ └── issue_variant_ignore.yaml │ ├── env_vars │ │ ├── variants.yaml │ │ └── recipe.yaml │ ├── test_strategy │ │ ├── recipe.yaml │ │ └── recipe-noarch.yaml │ ├── race-condition │ │ ├── variants.yaml │ │ ├── recipe-undefined-variant.yaml │ │ ├── recipe-cycle.yaml │ │ ├── recipe-pin-subpackage.yaml │ │ ├── recipe-python-min.yaml │ │ ├── recipe-pin-invalid.yaml │ │ └── recipe.yaml │ ├── nushell-script-detection │ │ ├── build.nu │ │ └── recipe.yaml │ ├── channel_sources │ │ ├── conda_build_config.yaml │ │ └── recipe.yaml │ ├── ruby-extension-test │ │ ├── build.rb │ │ └── recipe.yaml │ ├── test-relink │ │ ├── absolute.c │ │ ├── relative.c │ │ ├── test_link.c │ │ ├── build.sh │ │ └── recipe.yaml │ ├── test-parsing │ │ ├── recipe_missing_version.yaml │ │ ├── recipe_bad_skip.yaml │ │ ├── recipe_jinja_error.yaml │ │ ├── recipe_build_binary_relocation.yaml │ │ ├── recipe_build_binary_relocation_paths.yaml │ │ ├── recipe_inline_jinja.yaml │ │ ├── recipe_outputs_and_requirements.yaml │ │ ├── recipe_bad_skip_multi.yaml │ │ ├── recipe_outputs_and_package.yaml │ │ ├── recipe_outputs_extra_keys.yaml │ │ ├── recipe_ignore_run_exports.yaml │ │ ├── recipe_duplicate_keys.yaml │ │ ├── map_jinja_null_values.yaml │ │ └── recipe_outputs_merging.yaml │ ├── toml │ │ ├── expected │ │ │ ├── link.json │ │ │ ├── about.json │ │ │ └── index.json │ │ └── recipe.yaml │ ├── pkg_hash │ │ └── recipe.yaml │ ├── timestamps │ │ ├── oldarchive.tar.gz │ │ └── create_archive.sh │ ├── nodejs-extension-test │ │ ├── build.js │ │ └── recipe.yaml │ ├── regex_post_process │ │ ├── test.pc │ │ ├── test.cmake │ │ └── recipe.yaml │ ├── channel_specific │ │ └── recipe.yaml │ ├── down_prioritize │ │ └── recipe.yaml │ ├── private-repository │ │ └── recipe.yaml │ ├── run_exports │ │ ├── multi_run_exports_list.yaml │ │ ├── recipe.yaml │ │ └── multi_run_exports_dict.yaml │ ├── hatch_vcs │ │ └── recipe.yaml │ ├── jinja-types │ │ └── variants.yaml │ ├── patch_with_strip │ │ ├── 0002-Patch-without-additional-levels.patch │ │ ├── 0001-Patch-with-levels-to-strip.patch │ │ └── recipe.yaml │ ├── pin_compatible │ │ └── recipe.yaml │ ├── polarify │ │ ├── linux_64_.yaml │ │ └── recipe.yaml │ ├── debug_test │ │ └── recipe.yaml │ ├── empty_folder │ │ └── recipe.yaml │ ├── missing_license_file │ │ └── recipe.yaml │ ├── relative_file_loading │ │ ├── data │ │ │ └── package_data.yaml │ │ └── recipe.yaml │ ├── entry_points │ │ └── additional_entrypoints.yaml │ ├── cache_run_exports │ │ ├── recipe_test_2.yaml │ │ ├── recipe_test_3.yaml │ │ ├── helper.yaml │ │ └── recipe_test_1.yaml │ ├── missing_license_glob │ │ └── recipe.yaml │ ├── python-version-spec │ │ └── recipe.yaml │ ├── script_env │ │ └── recipe.yaml │ ├── git_source_expected_commit │ │ └── recipe.yaml │ ├── always-copy-files │ │ └── recipe.yaml │ ├── git_source_patch │ │ └── recipe.yaml │ ├── simple-ruby-test │ │ └── recipe.yaml │ ├── run_exports_from │ │ └── recipe.yaml │ ├── ssl_test │ │ └── recipe.yaml │ ├── strict-mode │ │ ├── recipe-pass.yaml │ │ ├── recipe-fail.yaml │ │ └── recipe-many-files.yaml │ ├── simple-nodejs-test │ │ └── recipe.yaml │ ├── win-symlink-test │ │ └── recipe.yaml │ ├── 7z-source │ │ └── recipe.yaml │ ├── test-errorlevel-injection │ │ └── recipe.yaml │ ├── post-link │ │ └── recipe.yaml │ ├── downstream_test │ │ ├── fail.yaml │ │ ├── succeed.yaml │ │ └── fail_prelim.yaml │ ├── cache │ │ ├── recipe-cmake.yaml │ │ ├── recipe-compiler.yaml │ │ └── recipe-symlinks.yaml │ ├── build_files │ │ └── recipe.yaml │ ├── console_logging │ │ └── recipe.yaml │ ├── zip-source │ │ └── recipe.yaml │ ├── rattlerbuildignore │ │ └── recipe.yaml │ ├── filter_files │ │ └── recipe.yaml │ ├── correct-sha │ │ └── recipe.yaml │ ├── pin_subpackage │ │ └── recipe.yaml │ ├── llamacpp │ │ └── recipe.yaml │ ├── crazy_characters │ │ └── test.py │ ├── debug-multiple-outputs │ │ └── recipe.yaml │ ├── globtest │ │ └── recipe.yaml │ ├── prefix_detection │ │ └── recipe.yaml │ ├── git_source_submodule │ │ └── recipe.yaml │ ├── read_only_build_files │ │ └── recipe.yaml │ ├── line-breaks │ │ └── recipe.yaml │ ├── python_compilation │ │ ├── recipe.py │ │ └── recipe.yaml │ ├── tar-source │ │ └── recipe.yaml │ ├── overlinking │ │ └── recipe.yaml │ ├── symlink_test │ │ └── recipe.yaml │ ├── spaces-in-paths │ │ ├── recipe.yaml │ │ └── recipe-with-quotes.yaml │ ├── symlink │ │ └── recipe.yaml │ ├── allow_missing_dso │ │ └── recipe.yaml │ ├── overdepending │ │ └── recipe.yaml │ ├── git_source │ │ └── recipe.yaml │ ├── url-source-with-ignore │ │ └── recipe.yaml │ ├── sourceforge-redirects │ │ └── recipe.yaml │ ├── noarch_variant │ │ └── recipe.yaml │ ├── test-section │ │ └── script-test.yaml │ ├── pe-malformed-windows │ │ └── recipe.yaml │ ├── perl-test │ │ └── recipe.yaml │ ├── rpath │ │ └── recipe.yaml │ ├── r-test │ │ └── recipe.yaml │ ├── always-include-files │ │ └── recipe.yaml │ ├── output_order │ │ └── order_1.yaml │ ├── case-insensitive │ │ └── recipe.yaml │ ├── ruby-test │ │ └── recipe.yaml │ └── ruby-imports-test │ │ └── recipe.yaml ├── patch_application │ ├── workdir │ │ ├── tinygrad │ │ │ └── frontend │ │ │ │ ├── onnx.py │ │ │ │ ├── torch.py │ │ │ │ └── __init__.py │ │ ├── to_be_deleted.txt │ │ ├── text.md │ │ ├── existing_file.txt │ │ └── deep │ │ │ └── nested │ │ │ └── directory │ │ │ └── deep_file.txt │ └── patches │ │ ├── test_with_bak.patch │ │ ├── test_with_orig.patch │ │ ├── test.patch │ │ ├── test_create_delete.patch │ │ ├── test_simple_mixed.patch │ │ ├── test_mixed_existing.patch │ │ ├── test_pure_rename.patch │ │ ├── test_strip_level_edge_case.patch │ │ └── 0001-increase-minimum-cmake-version.patch ├── conda_build_config │ ├── all_filtered.yaml │ └── test_1.yaml ├── binary_files │ ├── zlink │ ├── simple.so │ ├── zlink-macos │ ├── simple-elf.o │ ├── simple.dylib │ ├── zlink-runpath │ ├── simple-macho.o │ ├── zlink-no-rpath │ ├── binary_file_fallback │ ├── windows │ │ └── zstd │ │ │ └── Library │ │ │ └── bin │ │ │ └── zstd.dll │ └── simple.c ├── package_content │ ├── test_bin_unix.yaml │ ├── test_include_unix.yaml │ ├── test_lib_linux.yaml │ ├── test_include_win.yaml │ ├── test_lib_macos.yaml │ ├── test_lib_win.yaml │ ├── test_site_packages_win.yaml │ ├── test_bin_win.yaml │ ├── test_site_packages_unix.yaml │ └── test_files.yaml ├── shebang │ ├── replace_shebang_2.py │ └── replace_shebang_1.py ├── patches │ ├── simple.patch │ ├── nested.patch │ ├── define_byteswap.patch │ └── 0001-cross.patch.fail ├── tbd_files │ └── usr │ │ └── lib │ │ └── libSystem.B.tbd └── selectors │ └── config_1.yaml ├── src ├── linux │ └── mod.rs ├── macos │ ├── mod.rs │ └── env.rs ├── windows │ └── mod.rs ├── unix │ └── mod.rs ├── render │ ├── test-data │ │ └── list.yaml │ ├── mod.rs │ └── snapshots │ │ └── rattler_build__render__resolved_dependencies__tests__dependency_info_render.snap ├── post_process │ ├── mod.rs │ ├── snapshots │ │ ├── rattler_build__post_process__python__tests__replace_shebang_in_file-2.snap │ │ └── rattler_build__post_process__python__tests__replace_shebang_in_file.snap │ ├── regex_replacements.rs │ └── menuinst.rs ├── recipe │ ├── parser │ │ └── snapshots │ │ │ ├── rattler_build__recipe__parser__glob_vec__tests__parsing_all_or_globvec-2.snap │ │ │ ├── rattler_build__recipe__parser__glob_vec__tests__parsing_all_or_globvec-3.snap │ │ │ ├── rattler_build__recipe__parser__glob_vec__tests__parsing_globvec.snap │ │ │ ├── rattler_build__recipe__parser__requirements__test__compiler_serde.snap │ │ │ ├── rattler_build__recipe__parser__requirements__test__compiler_serde-2.snap │ │ │ ├── rattler_build__recipe__parser__source__tests__ssh_serialization.snap │ │ │ ├── rattler_build__recipe__parser__glob_vec__tests__parsing_all_or_globvec.snap │ │ │ ├── rattler_build__recipe__parser__source__tests__git_serialization.snap │ │ │ ├── rattler_build__recipe__parser__test__test__parsing.snap │ │ │ ├── rattler_build__recipe__parser__glob_vec__tests__parsing_glob_checker_vec.snap │ │ │ ├── rattler_build__recipe__parser__glob_vec__tests__parsing_globvec-2.snap │ │ │ ├── rattler_build__recipe__parser__source__tests__git_source_with_expected_commit.snap │ │ │ ├── rattler_build__recipe__parser__test__test__package_contents_parsing.snap │ │ │ ├── rattler_build__recipe__parser__test__test__python_parsing.snap │ │ │ ├── rattler_build__recipe__parser__output__tests__recipe_schema_error-3.snap │ │ │ ├── rattler_build__recipe__parser__output__tests__recipe_schema_error-4.snap │ │ │ ├── rattler_build__recipe__parser__glob_vec__tests__parsing_globvec_fail.snap │ │ │ ├── rattler_build__recipe__parser__output__tests__recipe_schema_error.snap │ │ │ ├── rattler_build__recipe__parser__package__tests__invalid_fields.snap │ │ │ ├── rattler_build__recipe__parser__output__tests__recipe_schema_error-2.snap │ │ │ ├── rattler_build__recipe__parser__package__tests__missing_fields.snap │ │ │ ├── rattler_build__recipe__parser__requirements__test__pin_package.snap │ │ │ ├── rattler_build__recipe__parser__about__test__invalid_url.snap │ │ │ ├── rattler_build__recipe__parser__about__test__invalid_license.snap │ │ │ └── rattler_build__recipe__parser__test__test__script_parsing.snap │ └── snapshots │ │ ├── rattler_build__recipe__parser__tests__binary_relocation.snap │ │ ├── rattler_build__recipe__parser__tests__jinja_sequence.snap │ │ ├── rattler_build__recipe__parser__tests__duplicate_keys_error.snap │ │ ├── rattler_build__recipe__parser__tests__binary_relocation_paths.snap │ │ ├── rattler_build__recipe__parser__tests__bad_skip_single_output.snap │ │ ├── rattler_build__recipe__parser__tests__context_not_mapping.snap │ │ ├── rattler_build__recipe__error__tests__miette_output.snap │ │ ├── rattler_build__recipe__parser__tests__map_null_values.snap │ │ ├── rattler_build__recipe__parser__tests__bad_skip_multi_output.snap │ │ ├── rattler_build__recipe__parser__tests__jinja_error.snap │ │ ├── rattler_build__recipe__parser__tests__invalid_root_field.snap │ │ ├── rattler_build__recipe__parser__tests__context_variable_with_hyphen.snap │ │ ├── rattler_build__recipe__parser__tests__context_value_not_uniform_list.snap │ │ └── rattler_build__recipe__parser__tests__context_value_not_scalar.snap ├── snapshots │ ├── rattler_build__variant_config__tests__python_is_not_used_as_variant_when_noarch.snap │ ├── rattler_build__conda_build_config__tests__conda_build_config__all_filtered.yaml_none.snap │ ├── rattler_build__variant_config__tests__load_config_and_find_variants.snap │ ├── rattler_build__system_tools__tests__serialize.snap │ ├── rattler_build__variant_config__tests__flatten_selectors-2.snap │ ├── rattler_build__conda_build_config__tests__conda_build_config__test_1.yaml_none.snap │ ├── rattler_build__variant_config__tests__flatten_selectors.snap │ ├── rattler_build__metadata__test__resolved_dependencies_rendering.snap │ ├── rattler_build__conda_build_config__tests__conda_build_config__conda_forge_subset.yaml_false.snap │ ├── rattler_build__conda_build_config__tests__conda_build_config__conda_forge_subset.yaml_none.snap │ └── rattler_build__conda_build_config__tests__conda_build_config__conda_forge_subset.yaml_true.snap ├── recipe_generator │ └── mod.rs ├── package_test │ └── mod.rs ├── tui │ ├── utils.rs │ └── logger.rs ├── consts.rs └── script │ └── interpreter │ ├── perl.rs │ ├── ruby.rs │ ├── nodejs.rs │ ├── python.rs │ └── r.rs ├── examples ├── cargo-edit │ ├── variant_config.yaml │ └── recipe.yaml ├── rattler-build │ └── variant_config.yaml ├── match_and_cdt │ ├── variant_config.yaml │ └── recipe.yaml ├── ros-humble-turtlebot4-msgs │ ├── variant_config.yaml │ └── bld_ament_cmake.bat ├── recipe-folder │ ├── package-b │ │ └── recipe.yaml │ ├── package-a │ │ └── recipe.yaml │ └── package-c │ │ └── recipe.yaml ├── mamba │ ├── variant_config.yaml │ ├── build_mamba.bat │ └── build_mamba.sh ├── linking │ ├── zlink │ │ ├── src │ │ │ └── main.c │ │ └── CMakeLists.txt │ └── recipe.yaml ├── xtensor │ ├── build.nu │ └── recipe.yaml ├── curl │ ├── build.bat │ ├── build.sh │ └── recipe.yaml └── bitfurnace │ └── recipe.yaml ├── py-rattler-build ├── README.md ├── examples │ └── basic.py ├── tests │ ├── unit │ │ └── conftest.py │ └── data │ │ └── recipes │ │ ├── dummy │ │ └── recipe.yaml │ │ └── test-package │ │ └── recipe.yaml ├── .gitignore └── Cargo.toml ├── docs ├── assets │ ├── favicon.png │ ├── prefix-logo-white.png │ ├── trusted_publisher.png │ └── paxton-mascot-socialcard.png ├── layouts │ └── download-font-to-cache.sh ├── reference │ └── python_bindings.md ├── automatic_linting.md ├── generator │ └── generate-cli-docs.rs ├── tutorials │ └── index.md └── stylesheets │ └── fonts.css ├── pytest.ini ├── .gitmodules ├── scripts ├── activate.bat └── activate.sh ├── .github ├── actionlint.yaml ├── workflows │ ├── enforce-sha.yaml │ └── lint.yml └── dependabot.yml ├── test └── end-to-end │ ├── __snapshots__ │ ├── test_simple │ │ ├── test_git_submodule.json │ │ ├── test_jinja_types.1.json │ │ ├── test_pin_compatible.json │ │ ├── test_python_min_render.json │ │ ├── test_post_link.json │ │ ├── test_run_exports.json │ │ ├── test_recipe_variant_render.json │ │ ├── test_extra_meta_is_recorded_into_about_json.json │ │ ├── test_build_files.json │ │ ├── test_filter_files.json │ │ ├── test_recipe_variant_render.1.json │ │ ├── test_symlink_recipe.json │ │ └── test_jinja_types.json │ ├── test_simple.ambr │ └── test_tests.ambr │ └── conftest.py ├── .gitignore ├── .gitattributes ├── .dprint.jsonc ├── deny.toml ├── rust-tests └── Cargo.toml ├── typos.toml ├── clippy.toml ├── SECURITY.md ├── CONTRIBUTING.md ├── tbump.toml ├── crates ├── rattler_build_allocator │ ├── Cargo.toml │ └── src │ │ └── lib.rs └── rattler_build_recipe_generator │ └── Cargo.toml └── CODE_OF_CONDUCT.md /rust-toolchain: -------------------------------------------------------------------------------- 1 | 1.89.0 2 | -------------------------------------------------------------------------------- /test-data/recipes/test-sources/test-file.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/linux/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod env; 2 | pub mod link; 3 | -------------------------------------------------------------------------------- /src/macos/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod env; 2 | pub mod link; 3 | -------------------------------------------------------------------------------- /src/windows/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod env; 2 | pub mod link; 3 | -------------------------------------------------------------------------------- /test-data/recipes/double_license/license.txt: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /test-data/recipes/source_filter/test-folder/excluded.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test-data/recipes/source_filter/test-folder/included.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test-data/recipes/source_filter/test-folder/not-included: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test-data/recipes/test-sources/test-folder/test-file-2.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test-data/recipes/test-sources/test-folder/test-file-3.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/cargo-edit/variant_config.yaml: -------------------------------------------------------------------------------- 1 | rust_compiler: rust 2 | -------------------------------------------------------------------------------- /src/unix/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod env; 2 | pub mod permission_guard; 3 | -------------------------------------------------------------------------------- /test-data/recipes/test-execution/testfile.txt: -------------------------------------------------------------------------------- 1 | just a test 2 | -------------------------------------------------------------------------------- /test-data/recipes/test-execution/testfolder/data.txt: -------------------------------------------------------------------------------- 1 | data 2 | -------------------------------------------------------------------------------- /examples/rattler-build/variant_config.yaml: -------------------------------------------------------------------------------- 1 | rust_compiler: rust 2 | -------------------------------------------------------------------------------- /py-rattler-build/README.md: -------------------------------------------------------------------------------- 1 | # Python bindings to rattler-build 2 | -------------------------------------------------------------------------------- /test-data/recipes/abi3/variants.yaml: -------------------------------------------------------------------------------- 1 | python_min: 2 | - "3.8" 3 | -------------------------------------------------------------------------------- /examples/match_and_cdt/variant_config.yaml: -------------------------------------------------------------------------------- 1 | python: ["3.3", "3.5"] 2 | -------------------------------------------------------------------------------- /test-data/recipes/script/script.sh: -------------------------------------------------------------------------------- 1 | touch $PREFIX/script-executed.txt 2 | -------------------------------------------------------------------------------- /test-data/patch_application/workdir/tinygrad/frontend/onnx.py: -------------------------------------------------------------------------------- 1 | # onnx code 2 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/r/build.r: -------------------------------------------------------------------------------- 1 | print("Hello from R!") 2 | -------------------------------------------------------------------------------- /examples/ros-humble-turtlebot4-msgs/variant_config.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - "3.10" 3 | -------------------------------------------------------------------------------- /test-data/patch_application/workdir/tinygrad/frontend/torch.py: -------------------------------------------------------------------------------- 1 | # torch code 2 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/bash/build.sh: -------------------------------------------------------------------------------- 1 | echo "Hello from Bash!" 2 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/bat/build.bat: -------------------------------------------------------------------------------- 1 | @echo Hello from Cmd! 2 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/nu/build.nu: -------------------------------------------------------------------------------- 1 | echo "Hello from Nushell!" 2 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/pl/build.pl: -------------------------------------------------------------------------------- 1 | print "Hello from Perl!\n"; 2 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/py/build.py: -------------------------------------------------------------------------------- 1 | print("Hello from Python!") 2 | -------------------------------------------------------------------------------- /test-data/recipes/package-content-tests/variant-config.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: vs2022 2 | -------------------------------------------------------------------------------- /test-data/recipes/recipe_variant/variants.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - 3.8 3 | - 3.9 4 | -------------------------------------------------------------------------------- /test-data/recipes/used-vars/variants.yaml: -------------------------------------------------------------------------------- 1 | numpy: 2 | - "1.5" 3 | - "2.0" 4 | -------------------------------------------------------------------------------- /test-data/patch_application/workdir/tinygrad/frontend/__init__.py: -------------------------------------------------------------------------------- 1 | # frontend init 2 | -------------------------------------------------------------------------------- /test-data/recipes/script/script.bat: -------------------------------------------------------------------------------- 1 | echo "Script executed" > %PREFIX%/script-executed.txt 2 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/bash/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Hello from BASH!" 3 | -------------------------------------------------------------------------------- /test-data/recipes/variant_config/variant_config.yaml: -------------------------------------------------------------------------------- 1 | some_option: 2 | - "ABC" 3 | - "DEF" 4 | -------------------------------------------------------------------------------- /examples/recipe-folder/package-b/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: package-b 3 | version: 1.0.0 4 | -------------------------------------------------------------------------------- /test-data/conda_build_config/all_filtered.yaml: -------------------------------------------------------------------------------- 1 | c_stdlib_version: # [false] 2 | - 10.15 # [false] 3 | -------------------------------------------------------------------------------- /test-data/patch_application/workdir/to_be_deleted.txt: -------------------------------------------------------------------------------- 1 | This file will be deleted 2 | by the patch 3 | -------------------------------------------------------------------------------- /docs/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/docs/assets/favicon.png -------------------------------------------------------------------------------- /test-data/recipes/topological-sort-variants/pkg-a/variants.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - "3.11" 3 | - "3.12" 4 | -------------------------------------------------------------------------------- /test-data/recipes/topological-sort-variants/pkg-b/variants.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - "3.11" 3 | - "3.12" 4 | -------------------------------------------------------------------------------- /test-data/recipes/topological-sort-variants/pkg-c/variants.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - "3.11" 3 | - "3.12" 4 | -------------------------------------------------------------------------------- /test-data/recipes/variants/python_variant.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - 3.8.* *_cpython 3 | - 3.9.* *_cpython 4 | -------------------------------------------------------------------------------- /test-data/recipes/env_vars/variants.yaml: -------------------------------------------------------------------------------- 1 | MAKEFLAGS: 2 | - OVERRIDDEN_MAKEFLAGS 3 | pybind11_abi: 4 | - 4 5 | -------------------------------------------------------------------------------- /test-data/recipes/test_strategy/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: testing-test-strategy 3 | version: 0.0.1 4 | -------------------------------------------------------------------------------- /test-data/binary_files/zlink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/zlink -------------------------------------------------------------------------------- /test-data/recipes/race-condition/variants.yaml: -------------------------------------------------------------------------------- 1 | variant: 2 | - a 3 | - b 4 | 5 | python_min: 6 | - "3.8.0" 7 | -------------------------------------------------------------------------------- /test-data/recipes/nushell-script-detection/build.nu: -------------------------------------------------------------------------------- 1 | echo "Hello, world!" | save ($env.PREFIX | path join hello.txt) 2 | -------------------------------------------------------------------------------- /docs/assets/prefix-logo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/docs/assets/prefix-logo-white.png -------------------------------------------------------------------------------- /docs/assets/trusted_publisher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/docs/assets/trusted_publisher.png -------------------------------------------------------------------------------- /test-data/binary_files/simple.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/simple.so -------------------------------------------------------------------------------- /test-data/binary_files/zlink-macos: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/zlink-macos -------------------------------------------------------------------------------- /test-data/recipes/channel_sources/conda_build_config.yaml: -------------------------------------------------------------------------------- 1 | channel_sources: 2 | - conda-forge/label/rust_dev,conda-forge 3 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | filterwarnings = 3 | ignore:.*Use the filter argument to control this behavior.:DeprecationWarning 4 | -------------------------------------------------------------------------------- /src/render/test-data/list.yaml: -------------------------------------------------------------------------------- 1 | - { 2 | pin_subpackage: "name", 3 | pin: { 4 | max_pin: "x.x.x", 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /test-data/binary_files/simple-elf.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/simple-elf.o -------------------------------------------------------------------------------- /test-data/binary_files/simple.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/simple.dylib -------------------------------------------------------------------------------- /test-data/binary_files/zlink-runpath: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/zlink-runpath -------------------------------------------------------------------------------- /test-data/binary_files/simple-macho.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/simple-macho.o -------------------------------------------------------------------------------- /test-data/binary_files/zlink-no-rpath: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/zlink-no-rpath -------------------------------------------------------------------------------- /test-data/recipes/ruby-extension-test/build.rb: -------------------------------------------------------------------------------- 1 | puts "Ruby script with auto-detection working!" 2 | puts "File extension: .rb detected" 3 | -------------------------------------------------------------------------------- /test-data/recipes/test-relink/absolute.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void absolute() { 4 | printf("hello from absolute\n"); 5 | } 6 | -------------------------------------------------------------------------------- /test-data/recipes/test-relink/relative.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void relative() { 4 | printf("hello from relative\n"); 5 | } 6 | -------------------------------------------------------------------------------- /docs/assets/paxton-mascot-socialcard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/docs/assets/paxton-mascot-socialcard.png -------------------------------------------------------------------------------- /test-data/package_content/test_bin_unix.yaml: -------------------------------------------------------------------------------- 1 | platform: linux-64 2 | package_contents: 3 | bin: 4 | - curl 5 | paths: 6 | - bin/curl 7 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_missing_version.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: blib 3 | 4 | outputs: 5 | - package: 6 | name: bla 7 | -------------------------------------------------------------------------------- /test-data/recipes/toml/expected/link.json: -------------------------------------------------------------------------------- 1 | { 2 | "noarch": { 3 | "type": "python" 4 | }, 5 | "package_metadata_version": 1 6 | } 7 | -------------------------------------------------------------------------------- /py-rattler-build/examples/basic.py: -------------------------------------------------------------------------------- 1 | import rattler_build 2 | 3 | if __name__ == "__main__": 4 | print(rattler_build.rattler_build_version()) 5 | -------------------------------------------------------------------------------- /test-data/binary_files/binary_file_fallback: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/binary_file_fallback -------------------------------------------------------------------------------- /test-data/patch_application/workdir/text.md: -------------------------------------------------------------------------------- 1 | I am a long text. 2 | And I want to be patched. 3 | By the patching tool in rattler-build. 4 | Thank you! -------------------------------------------------------------------------------- /test-data/recipes/pkg_hash/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pkg_hash 3 | version: "1.0.0" 4 | 5 | build: 6 | string: h${{ hash }}_my_pkg 7 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_bad_skip.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: zlib 3 | version: 0.1.0 4 | 5 | build: 6 | skip: 7 | - asd;asd;123 8 | -------------------------------------------------------------------------------- /test-data/recipes/timestamps/oldarchive.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/recipes/timestamps/oldarchive.tar.gz -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test-data/conda_forge"] 2 | path = test-data/conda_forge 3 | url = https://github.com/remimimimimi/patch-apply-test-data.git 4 | -------------------------------------------------------------------------------- /examples/recipe-folder/package-a/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: package-a 3 | version: 1.0.0 4 | 5 | requirements: 6 | build: 7 | - package-b 8 | -------------------------------------------------------------------------------- /scripts/activate.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set CARGO_TARGET_DIR=target-pixi 3 | set RATTLER_BUILD_PATH="%PIXI_PROJECT_ROOT%\target-pixi\release\rattler-build.exe" 4 | -------------------------------------------------------------------------------- /test-data/patch_application/workdir/existing_file.txt: -------------------------------------------------------------------------------- 1 | I am a long text. 2 | And I want to be patched. 3 | By the patching tool in rattler-build. 4 | Thank you! -------------------------------------------------------------------------------- /test-data/recipes/test_strategy/recipe-noarch.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: testing-test-strategy 3 | version: 0.0.1 4 | 5 | build: 6 | noarch: generic 7 | -------------------------------------------------------------------------------- /test-data/recipes/nodejs-extension-test/build.js: -------------------------------------------------------------------------------- 1 | console.log("NodeJS script with auto-detection working!"); 2 | console.log("File extension: .js detected"); 3 | -------------------------------------------------------------------------------- /examples/mamba/variant_config.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - "3.11.* *cpython" 3 | # - "3.12.* *cpython" 4 | # - "3.9.* *cpython" 5 | 6 | cxx_compiler: 7 | - vs2019 8 | -------------------------------------------------------------------------------- /test-data/recipes/regex_post_process/test.pc: -------------------------------------------------------------------------------- 1 | I am a test file with /some/long/path/to/sysroot/and/some/more 2 | 3 | and: /some/long/path/to/sysroot/and/some/more 4 | -------------------------------------------------------------------------------- /test-data/binary_files/windows/zstd/Library/bin/zstd.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prefix-dev/rattler-build/HEAD/test-data/binary_files/windows/zstd/Library/bin/zstd.dll -------------------------------------------------------------------------------- /test-data/recipes/channel_specific/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: channel_specific 3 | version: 1.0.0 4 | 5 | requirements: 6 | host: 7 | - quantstack::sphinx 8 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_jinja_error.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: blib 3 | version: 0.1.0 4 | 5 | requirements: 6 | host: 7 | - ${{ zcompiler('c') }} 8 | -------------------------------------------------------------------------------- /test-data/shebang/replace_shebang_2.py: -------------------------------------------------------------------------------- 1 | #!/conda-bld/bla/_placeholder_path/bin/python 2 | # -*- coding: utf-8 -*- 3 | import sys 4 | 5 | print(sys.argv) 6 | 7 | # etc 8 | -------------------------------------------------------------------------------- /examples/linking/zlink/src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | printf("zlib version: %s\n", zlibVersion()); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /examples/recipe-folder/package-c/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: package-c 3 | version: 1.0.0 4 | 5 | requirements: 6 | build: 7 | - package-b 8 | - package-a 9 | -------------------------------------------------------------------------------- /test-data/patches/simple.patch: -------------------------------------------------------------------------------- 1 | diff --git a/hello.txt b/hello.txt 2 | index e69de29..3b18e51 100644 3 | --- a/hello.txt 4 | +++ b/hello.txt 5 | @@ -0,0 +1 @@ 6 | +hello world 7 | -------------------------------------------------------------------------------- /test-data/patch_application/workdir/deep/nested/directory/deep_file.txt: -------------------------------------------------------------------------------- 1 | This is a deep nested file. 2 | It should be patchable with various strip levels. 3 | Original content here. -------------------------------------------------------------------------------- /test-data/recipes/channel_sources/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: channel-sources 3 | version: 0.1.0 4 | 5 | requirements: 6 | build: 7 | - rust ==1.88.0.dev20250428 8 | -------------------------------------------------------------------------------- /test-data/recipes/regex_post_process/test.cmake: -------------------------------------------------------------------------------- 1 | target_compile_definitions(test PRIVATE "some_path;/some/path/to/sysroot/and/more;some_other_path;/some/other/path/to/sysroot/and/more") 2 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_build_binary_relocation.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: zlib 3 | version: 0.1.0 4 | 5 | build: 6 | dynamic_linking: 7 | binary_relocation: true 8 | -------------------------------------------------------------------------------- /.github/actionlint.yaml: -------------------------------------------------------------------------------- 1 | paths: 2 | .github/workflows/rust.yml: 3 | # https://github.com/rhysd/actionlint/pull/542 4 | ignore: 5 | - 'label "windows-11-arm" is unknown.+' 6 | -------------------------------------------------------------------------------- /src/post_process/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod checks; 2 | pub mod menuinst; 3 | pub mod package_nature; 4 | pub mod path_checks; 5 | pub mod python; 6 | pub mod regex_replacements; 7 | pub mod relink; 8 | -------------------------------------------------------------------------------- /test-data/recipes/down_prioritize/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: down_prioritize 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | variant: 8 | down_prioritize_variant: -4 9 | -------------------------------------------------------------------------------- /test-data/recipes/private-repository/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: "_testpackage_requiring_private_repo" 3 | version: "1" 4 | 5 | requirements: 6 | build: 7 | - private-package 8 | -------------------------------------------------------------------------------- /test-data/recipes/run_exports/multi_run_exports_list.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: run_exports_test_list 3 | version: "1.0.0" 4 | 5 | requirements: 6 | run_exports: 7 | - abc 8 | - def 9 | -------------------------------------------------------------------------------- /test-data/binary_files/simple.c: -------------------------------------------------------------------------------- 1 | // Simple C file to generate a test object file 2 | int add(int a, int b) { 3 | return a + b; 4 | } 5 | 6 | int multiply(int x, int y) { 7 | return x * y; 8 | } 9 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_git_submodule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "git": "https://github.com/wjakob/nanobind/", 4 | "rev": "8e1f8408b37d994fb987440859eb977af39be8c3" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__glob_vec__tests__parsing_all_or_globvec-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/glob_vec.rs 3 | expression: "&globs_all" 4 | --- 5 | globs: true 6 | 7 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__variant_config__tests__python_is_not_used_as_variant_when_noarch.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/variant_config.rs 3 | expression: used_variables_all 4 | --- 5 | - target_platform: noarch 6 | -------------------------------------------------------------------------------- /test-data/patches/nested.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/lib/hello.txt b/src/lib/hello.txt 2 | index e69de29..3b18e51 100644 3 | --- a/src/lib/hello.txt 4 | +++ b/src/lib/hello.txt 5 | @@ -0,0 +1 @@ 6 | +hello world 7 | -------------------------------------------------------------------------------- /test-data/recipes/hatch_vcs/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: hatch-vcs-example 3 | # hatch-vcs produces these kinds of version numbers 4 | version: "0.1.0.dev12+ga47bad07" 5 | 6 | build: 7 | number: 0 8 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/bash/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-interpreter-bash 3 | version: 0.1.0 4 | 5 | build: 6 | script: build.sh 7 | 8 | tests: 9 | - script: test.sh 10 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_build_binary_relocation_paths.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: zlib 3 | version: 0.1.0 4 | 5 | build: 6 | dynamic_linking: 7 | binary_relocation: ["/usr/lib/**", "/etc"] 8 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__glob_vec__tests__parsing_all_or_globvec-3.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/glob_vec.rs 3 | expression: "&globs_none" 4 | --- 5 | globs: false 6 | 7 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__glob_vec__tests__parsing_globvec.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/glob_vec.rs 3 | expression: "&as_yaml" 4 | --- 5 | - foo 6 | - bar 7 | - baz/**/qux 8 | -------------------------------------------------------------------------------- /src/render/mod.rs: -------------------------------------------------------------------------------- 1 | #![allow(missing_docs)] 2 | //! Render the dependencies to a final recipe 3 | 4 | pub mod pin; 5 | pub mod reporters; 6 | pub mod resolved_dependencies; 7 | mod run_exports; 8 | pub mod solver; 9 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/bat/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-interpreter-bat 3 | version: 0.1.0 4 | 5 | build: 6 | script: build.bat 7 | 8 | tests: 9 | - script: build.bat 10 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_inline_jinja.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: blib 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - ${{ "test succeeded" if true }} 8 | - ${{ "test failed" if false }} 9 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/requirements.rs 3 | expression: requirements 4 | --- 5 | build: 6 | - compiler: cxx 7 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__conda_build_config__tests__conda_build_config__all_filtered.yaml_none.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/conda_build_config.rs 3 | expression: config 4 | --- 5 | pin_run_as_build: ~ 6 | zip_keys: ~ 7 | -------------------------------------------------------------------------------- /test-data/recipes/jinja-types/variants.yaml: -------------------------------------------------------------------------------- 1 | xfloat: 2 | - 1.23 3 | xinteger: 4 | - 5 5 | xstring: 6 | - "blah" 7 | xboolean: 8 | - true 9 | quoted_bool: 10 | - "true" 11 | quoted_int: 12 | - "5" 13 | -------------------------------------------------------------------------------- /test-data/recipes/nushell-script-detection/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: nushell-implicit 3 | version: 0.1.0 4 | 5 | build: 6 | script: build.nu 7 | 8 | requirements: 9 | build: 10 | - nushell 11 | -------------------------------------------------------------------------------- /test-data/recipes/patch_with_strip/0002-Patch-without-additional-levels.patch: -------------------------------------------------------------------------------- 1 | diff --git a/somefile b/somefile 2 | index cd470e6..190a180 100444 3 | --- a/somefile 4 | +++ b/somefile 5 | @@ -1 +1 @@ 6 | -xyz 7 | +123 8 | -------------------------------------------------------------------------------- /test-data/recipes/pin_compatible/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test 3 | version: v1 4 | 5 | requirements: 6 | host: 7 | - python 8 | run: 9 | - ${{ pin_compatible('python', exact=True) }} 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | book 2 | output/ 3 | target/ 4 | .idea/ 5 | __pycache__/ 6 | .pytest_cache/ 7 | .DS_STORE 8 | 9 | # mkdocs 10 | .cache 11 | site 12 | 13 | # pixi environments 14 | .pixi 15 | target-pixi 16 | *.conda 17 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__compiler_serde-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/requirements.rs 3 | expression: deserialized 4 | --- 5 | build: 6 | - compiler: cxx 7 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__source__tests__ssh_serialization.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/source.rs 3 | expression: yaml 4 | --- 5 | git: git@github.com:prefix-dev/rattler-build.git 6 | -------------------------------------------------------------------------------- /test-data/recipes/script/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: script-test 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | # make sure this script is executed with either `.bat` or `.sh` extension 8 | file: script 9 | -------------------------------------------------------------------------------- /test-data/recipes/test-relink/test_link.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void absolute(); 4 | void relative(); 5 | 6 | int main() { 7 | printf("hello from test_link\n"); 8 | absolute(); 9 | relative(); 10 | } 11 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_jinja_types.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "quoted_bool": "true", 3 | "quoted_int": "5", 4 | "xboolean": true, 5 | "xfloat": "1.23", 6 | "xinteger": 5, 7 | "xstring": "blah" 8 | } 9 | -------------------------------------------------------------------------------- /test-data/package_content/test_include_unix.yaml: -------------------------------------------------------------------------------- 1 | platform: linux-64 2 | package_contents: 3 | include: 4 | - xtensor.hpp 5 | - xtensor/xarray.hpp 6 | paths: 7 | - include/xtensor.hpp 8 | - include/xtensor/xarray.hpp 9 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_outputs_and_requirements.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: blib 3 | version: 0.1.0 4 | 5 | requirements: 6 | host: 7 | - bla 8 | 9 | outputs: 10 | - package: 11 | name: bla 12 | -------------------------------------------------------------------------------- /test-data/recipes/used-vars/recipe_1.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: used-vars-1 3 | version: "0.1.0" 4 | 5 | build: 6 | noarch: python 7 | 8 | requirements: 9 | build: 10 | - python 11 | run: 12 | - numpy 13 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__glob_vec__tests__parsing_all_or_globvec.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/glob_vec.rs 3 | expression: "&as_yaml" 4 | --- 5 | globs: 6 | - foo 7 | - bar 8 | - baz/**/qux 9 | -------------------------------------------------------------------------------- /test-data/recipes/topological-sort-variants/pkg-a/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pkg-a 3 | version: 1.0.0 4 | 5 | build: 6 | number: 0 7 | 8 | requirements: 9 | host: 10 | - python 11 | run: 12 | - python 13 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__source__tests__git_serialization.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/source.rs 3 | expression: yaml 4 | --- 5 | git: https://test.com/test.git 6 | rev: refs/heads/master 7 | 8 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__test__test__parsing.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/test.rs 3 | expression: yaml_serde 4 | --- 5 | - python: 6 | imports: 7 | - numpy.testing 8 | - numpy.matrix 9 | -------------------------------------------------------------------------------- /test-data/package_content/test_lib_linux.yaml: -------------------------------------------------------------------------------- 1 | platform: linux-64 2 | package_contents: 3 | lib: 4 | - test 5 | - testb 6 | - testc 7 | paths: 8 | - lib/libtest.so 9 | - lib/testb.so 10 | - lib/testc.so.1.0.0 11 | -------------------------------------------------------------------------------- /test-data/recipes/toml/expected/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "channels": [ 3 | "https://conda.anaconda.org/conda-forge/" 4 | ], 5 | "home": "https://github.com/uiri/toml", 6 | "license": "MIT", 7 | "summary": "Python lib for TOML." 8 | } 9 | -------------------------------------------------------------------------------- /test-data/package_content/test_include_win.yaml: -------------------------------------------------------------------------------- 1 | platform: win-64 2 | package_contents: 3 | include: 4 | - xtensor.hpp 5 | - xtensor/xarray.hpp 6 | paths: 7 | - Library/include/xtensor.hpp 8 | - Library/include/xtensor/xarray.hpp 9 | -------------------------------------------------------------------------------- /test-data/recipes/polarify/linux_64_.yaml: -------------------------------------------------------------------------------- 1 | cdt_name: 2 | - cos6 3 | channel_sources: 4 | - conda-forge 5 | channel_targets: 6 | - conda-forge polarify-rattler-build_dev 7 | docker_image: 8 | - quay.io/condaforge/linux-anvil-cos7-x86_64 9 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__variant_config__tests__load_config_and_find_variants.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/variant_config.rs 3 | expression: used_variables_all 4 | --- 5 | - libblas: 3.9 *netlib 6 | r_base: "4.2" 7 | target_platform: linux-64 8 | -------------------------------------------------------------------------------- /test-data/package_content/test_lib_macos.yaml: -------------------------------------------------------------------------------- 1 | platform: osx-64 2 | package_contents: 3 | lib: 4 | - test 5 | - testb 6 | - testc 7 | paths: 8 | - lib/libtest.dylib 9 | - lib/testb.4.dylib 10 | - lib/libtestc.1.0.0.dylib 11 | -------------------------------------------------------------------------------- /test-data/recipes/race-condition/recipe-undefined-variant.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: my-package 3 | 4 | recipe: 5 | name: ${{ name }} 6 | version: "1.0.0" 7 | 8 | outputs: 9 | - package: 10 | name: ${{ name + '-' + variant }} 11 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__glob_vec__tests__parsing_glob_checker_vec.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/glob_vec.rs 3 | expression: "&yaml" 4 | --- 5 | exists: 6 | - foo 7 | - bar 8 | not_exists: 9 | - baz/**/qux 10 | -------------------------------------------------------------------------------- /src/recipe_generator/mod.rs: -------------------------------------------------------------------------------- 1 | //! Module for generating recipes for Python (PyPI), R (CRAN), Perl (CPAN), or Lua (LuaRocks) packages 2 | 3 | // Re-export everything from the rattler_build_recipe_generator crate 4 | pub use rattler_build_recipe_generator::*; 5 | -------------------------------------------------------------------------------- /test-data/recipes/variants/variant_config.yaml: -------------------------------------------------------------------------------- 1 | # blas 2 | libblas: 3 | - 3.9 *netlib 4 | libcblas: 5 | - 3.9 *netlib 6 | r_base: 7 | - 4.2 8 | 9 | eigen_abi_profile: 10 | - "100" 11 | - "80" 12 | 13 | some_key: 14 | - "1" 15 | - "2" 16 | -------------------------------------------------------------------------------- /test-data/recipes/debug_test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: debug-test 3 | version: 1.0.0 4 | 5 | build: 6 | script: | 7 | echo "This is a test script" 8 | mkdir -p $PREFIX/test 9 | echo "Hello from debug test" > $PREFIX/test/hello.txt 10 | -------------------------------------------------------------------------------- /test-data/recipes/recipe_variant/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: recipe_variant 3 | version: 0.1.0 4 | 5 | build: 6 | script: echo "hello, world!" 7 | 8 | requirements: 9 | build: 10 | - python 11 | run: 12 | - python 13 | - __unix 14 | -------------------------------------------------------------------------------- /test-data/recipes/topological-sort-variants/pkg-b/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pkg-b 3 | version: 1.0.0 4 | 5 | build: 6 | number: 0 7 | 8 | requirements: 9 | host: 10 | - python 11 | - pkg-a 12 | run: 13 | - python 14 | - pkg-a 15 | -------------------------------------------------------------------------------- /test-data/recipes/topological-sort-variants/pkg-c/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pkg-c 3 | version: 1.0.0 4 | 5 | build: 6 | number: 0 7 | 8 | requirements: 9 | host: 10 | - python 11 | - pkg-b 12 | run: 13 | - python 14 | - pkg-b 15 | -------------------------------------------------------------------------------- /src/package_test/mod.rs: -------------------------------------------------------------------------------- 1 | //! Tests that are run as part of the package build process. 2 | mod content_test; 3 | mod run_test; 4 | mod serialize_test; 5 | 6 | pub use run_test::{TestConfiguration, TestError, run_test}; 7 | pub(crate) use serialize_test::write_test_files; 8 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_pin_compatible.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": [ 3 | "python" 4 | ], 5 | "run": [ 6 | { 7 | "pin_compatible": { 8 | "exact": true, 9 | "name": "python" 10 | } 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /test-data/recipes/empty_folder/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: empty_folder 3 | version: "0.24.6" 4 | 5 | build: 6 | script: 7 | - if: win 8 | then: 9 | - mkdir %PREFIX%\empty_folder 10 | else: 11 | - mkdir -p $PREFIX/empty_folder 12 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_bad_skip_multi.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: zlib 3 | version: 0.1.0 4 | 5 | outputs: 6 | - package: 7 | name: zlib-dev 8 | - package: 9 | name: zlib-lib 10 | build: 11 | skip: 12 | - asd;asd;123 13 | -------------------------------------------------------------------------------- /test-data/recipes/missing_license_file/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: missing-license-file 3 | version: "0.1.0" 4 | 5 | build: 6 | script: 7 | - echo "test content" > LICENSE 8 | 9 | about: 10 | license_file: 11 | - LICENSE 12 | - does-not-exist.txt 13 | -------------------------------------------------------------------------------- /test-data/recipes/script/recipe_with_extensions.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: script-test-ext 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | # make sure this script is executed with either `.bat` or `.sh` extension 8 | file: ${{ "script.bat" if win else "script.sh" }} 9 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__glob_vec__tests__parsing_globvec-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/glob_vec.rs 3 | expression: "&as_yaml" 4 | --- 5 | include: 6 | - foo/ 7 | - bar 8 | - baz/**/qux 9 | exclude: 10 | - foo/bar 11 | - bar/*.txt 12 | -------------------------------------------------------------------------------- /test-data/conda_build_config/test_1.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc # [linux] 3 | - clang # [osx] 4 | - vs2019 # [win and x86_64] 5 | - vs2022 # [win and arm64] 6 | c_compiler_version: # [unix] 7 | - "13" # [linux] 8 | - "18" # [osx] 9 | 10 | other_stuff: 11 | - "123" 12 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__system_tools__tests__serialize.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/system_tools.rs 3 | assertion_line: 284 4 | expression: json 5 | --- 6 | { 7 | "git": "3.0.0", 8 | "install_name_tool": "2.0.0", 9 | "patchelf": "1.0.0", 10 | "rattler-build": "0.0.0" 11 | } 12 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_outputs_and_package.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json 2 | 3 | package: 4 | name: blib 5 | version: 0.1.0 6 | 7 | outputs: 8 | - package: 9 | name: bla 10 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__binary_relocation.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: recipe 4 | --- 5 | schema_version: 1 6 | context: {} 7 | package: 8 | name: zlib 9 | version: 0.1.0 10 | build: 11 | number: 0 12 | requirements: {} 13 | -------------------------------------------------------------------------------- /test-data/recipes/double_license/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: "double-license" 3 | version: "0.1.0" 4 | 5 | source: 6 | # license file twice, in $SRC_DIR and $RECIPE_DIR 7 | path: ./license.txt 8 | 9 | build: 10 | number: 0 11 | 12 | about: 13 | license_file: license.txt 14 | -------------------------------------------------------------------------------- /py-rattler-build/tests/unit/conftest.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | import pytest 3 | 4 | 5 | @pytest.fixture 6 | def recipes_dir() -> Path: 7 | current_file = Path(__file__).resolve() 8 | recipes_path = current_file.parents[1].joinpath("data", "recipes") 9 | return recipes_path 10 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__source__tests__git_source_with_expected_commit.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/source.rs 3 | assertion_line: 735 4 | expression: yaml 5 | --- 6 | git: https://test.com/test.git 7 | rev: refs/tags/v1.0.0 8 | expected_commit: abc123def456 9 | -------------------------------------------------------------------------------- /test-data/recipes/relative_file_loading/data/package_data.yaml: -------------------------------------------------------------------------------- 1 | name: test-relative-loading 2 | version: 1.0.0 3 | description: "Loaded from relative file" 4 | extra_metadata: 5 | key1: value1 6 | key2: value2 7 | build_data: 8 | steps: 9 | - "echo 'Step loaded from relative file'" 10 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__test__test__package_contents_parsing.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/test.rs 3 | expression: yaml_serde 4 | --- 5 | - package_contents: 6 | files: 7 | exists: 8 | - foo.hpp 9 | not_exists: 10 | - baz.hpp 11 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_python_min_render.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": [ 3 | "python >=3.8.0", 4 | "python 3.8.0.*", 5 | "python 3.8.0.*,<4.0a0" 6 | ], 7 | "run": [ 8 | "python >=3.8.0", 9 | "python 3.8.0.*", 10 | "python 3.8.0.*,<4.0a0" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # GitHub syntax highlighting 2 | pixi.lock merge=binary linguist-language=YAML linguist-generated=true 3 | Cargo.lock merge=binary linguist-generated=true 4 | 5 | # Test data files should always use LF line endings for cross-platform consistency 6 | test-data/patch_application/**/*.py text eol=lf 7 | -------------------------------------------------------------------------------- /test-data/recipes/entry_points/additional_entrypoints.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: additional_entrypoints 3 | version: 0.1.0 4 | 5 | build: 6 | python: 7 | entry_points: 8 | - additional_entrypoints = additional_entrypoints:main 9 | 10 | requirements: 11 | host: 12 | - python 3.11.* 13 | -------------------------------------------------------------------------------- /test-data/recipes/race-condition/recipe-cycle.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | version: "1.2.3" 3 | 4 | outputs: 5 | - package: 6 | name: foobar 7 | requirements: 8 | host: 9 | - bazbus 10 | - package: 11 | name: bazbus 12 | requirements: 13 | host: 14 | - foobar 15 | -------------------------------------------------------------------------------- /examples/xtensor/build.nu: -------------------------------------------------------------------------------- 1 | let prefix = if $nu.os-info.name == "windows" { $env.LIBRARY_PREFIX } else { $env.PREFIX } 2 | let cmake_args = [ 3 | "-GNinja" 4 | "-DBUILD_TESTS=OFF" 5 | $"-DCMAKE_INSTALL_PREFIX=($prefix)" 6 | $env.SRC_DIR 7 | ] 8 | 9 | cmake ...$cmake_args 10 | ninja install 11 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__variant_config__tests__flatten_selectors-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/variant_config.rs 3 | expression: res 4 | --- 5 | pin_run_as_build: ~ 6 | zip_keys: ~ 7 | c_compiler: 8 | - vs2019 9 | cplusplus: 10 | - "100" 11 | cxx_compiler: 12 | - vs2019 13 | python: 14 | - "3.10" 15 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__conda_build_config__tests__conda_build_config__test_1.yaml_none.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/conda_build_config.rs 3 | expression: config 4 | --- 5 | pin_run_as_build: ~ 6 | zip_keys: ~ 7 | c_compiler: 8 | - clang 9 | c_compiler_version: 10 | - "18" 11 | other_stuff: 12 | - "123" 13 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/pl/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-interpreter-pl 3 | version: 0.1.0 4 | 5 | build: 6 | script: build.pl 7 | 8 | requirements: 9 | build: 10 | - perl 11 | 12 | tests: 13 | - script: build.pl 14 | requirements: 15 | run: 16 | - perl 17 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/py/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-interpreter-py 3 | version: 0.1.0 4 | 5 | build: 6 | script: build.py 7 | 8 | requirements: 9 | build: 10 | - python 11 | 12 | tests: 13 | - script: build.py 14 | requirements: 15 | run: 16 | - python 17 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/r/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-interpreter-r 3 | version: 0.1.0 4 | 5 | build: 6 | script: build.r 7 | 8 | requirements: 9 | build: 10 | - r-base 11 | 12 | tests: 13 | - script: build.r 14 | requirements: 15 | run: 16 | - r-base 17 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_outputs_extra_keys.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json 2 | 3 | recipe: 4 | name: blib 5 | version: 0.1.0 6 | 7 | outputs: 8 | - package: 9 | name: bla 10 | 11 | randomkey: 12 | - bla 13 | -------------------------------------------------------------------------------- /test-data/recipes/toml/expected/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "build": "pyh4616a5c_0", 3 | "build_number": 0, 4 | "depends": [ 5 | "python" 6 | ], 7 | "license": "MIT", 8 | "name": "toml", 9 | "noarch": "python", 10 | "subdir": "noarch", 11 | "timestamp": 1697628467786, 12 | "version": "0.10.2" 13 | } 14 | -------------------------------------------------------------------------------- /test-data/tbd_files/usr/lib/libSystem.B.tbd: -------------------------------------------------------------------------------- 1 | --- !tapi-tbd 2 | tbd-version: 4 3 | targets: [ x86_64-macos, arm64-macos ] 4 | install-name: '/usr/lib/libSystem.B.dylib' 5 | current-version: 1351 6 | exports: 7 | - targets: [ x86_64-macos, arm64-macos ] 8 | symbols: [ _mach_init_routine ] 9 | -------------------------------------------------------------------------------- /test-data/recipes/cache_run_exports/recipe_test_2.yaml: -------------------------------------------------------------------------------- 1 | cache: 2 | requirements: 3 | host: 4 | - normal-run-exports 5 | ignore_run_exports: 6 | from_package: 7 | - normal-run-exports 8 | 9 | outputs: 10 | - package: 11 | name: cache-ignore-run-exports 12 | version: "1.0.0" 13 | -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/nu/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-interpreter-nu 3 | version: 0.1.0 4 | 5 | build: 6 | script: build.nu 7 | 8 | requirements: 9 | build: 10 | - nushell 11 | 12 | tests: 13 | - script: build.nu 14 | requirements: 15 | build: 16 | - nushell 17 | -------------------------------------------------------------------------------- /test-data/recipes/cache_run_exports/recipe_test_3.yaml: -------------------------------------------------------------------------------- 1 | cache: 2 | requirements: 3 | host: 4 | - normal-run-exports 5 | ignore_run_exports: 6 | by_name: 7 | - normal-run-exports 8 | 9 | outputs: 10 | - package: 11 | name: cache-ignore-run-exports-by-name 12 | version: "1.0.0" 13 | -------------------------------------------------------------------------------- /test-data/recipes/missing_license_glob/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: missing-license-glob 3 | version: "0.1.0" 4 | 5 | build: 6 | script: 7 | - echo "test content" > README.md 8 | - echo "another file" > NOTICE 9 | 10 | about: 11 | license_file: 12 | - "*.license" # This glob won't match anything 13 | -------------------------------------------------------------------------------- /test-data/recipes/python-version-spec/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - echo "test" > test.txt 8 | 9 | requirements: 10 | build: 11 | - python 12 | 13 | tests: 14 | - python: 15 | imports: 16 | - time 17 | python_version: "=.*" 18 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_ignore_run_exports.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: mypkg 3 | version: '0.1.0' 4 | 5 | build: 6 | number: 0 7 | 8 | requirements: 9 | ignore_run_exports: 10 | from_package: 11 | - ${{ compiler('cxx') }} 12 | build: 13 | - ${{ compiler('c') }} 14 | - ${{ compiler('cxx') }} -------------------------------------------------------------------------------- /test-data/package_content/test_lib_win.yaml: -------------------------------------------------------------------------------- 1 | platform: win-64 2 | package_contents: 3 | lib: 4 | - test 5 | - testb 6 | - testc 7 | paths: 8 | - Library/lib/test.lib 9 | - Library/bin/test.dll 10 | - Library/lib/testb.lib 11 | - Library/bin/testb.dll 12 | - Library/lib/testc.lib 13 | - Library/bin/testc.dll 14 | -------------------------------------------------------------------------------- /test-data/shebang/replace_shebang_1.py: -------------------------------------------------------------------------------- 1 | #!/conda-bld/placeholder_placeholder/python arguments -a -b -c 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | 6 | from myapp.cli.core import cli 7 | 8 | if __name__ == "__main__": 9 | sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) 10 | sys.exit(cli()) 11 | -------------------------------------------------------------------------------- /src/post_process/snapshots/rattler_build__post_process__python__tests__replace_shebang_in_file-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/post_process/python.rs 3 | expression: "fs::read_to_string(&dest).unwrap()" 4 | --- 5 | #!/bin/bash /super/prefix/bin/pythonw 6 | # -*- coding: utf-8 -*- 7 | import sys 8 | 9 | print(sys.argv) 10 | 11 | # etc 12 | 13 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__jinja_sequence.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: recipe 4 | --- 5 | schema_version: 1 6 | context: {} 7 | package: 8 | name: blib 9 | version: 0.1.0 10 | build: 11 | number: 0 12 | script: "${{ \"test succeeded\" if true }}" 13 | requirements: {} 14 | -------------------------------------------------------------------------------- /test-data/package_content/test_site_packages_win.yaml: -------------------------------------------------------------------------------- 1 | platform: win-64 2 | package_contents: 3 | site_packages: 4 | - numpy 5 | - numpy.superfunc 6 | - numpy.blabla 7 | 8 | paths: 9 | - Lib/site-packages/numpy/__init__.py 10 | - Lib/site-packages/numpy/blabla.py 11 | - Lib/site-packages/numpy/superfunc/__init__.py 12 | -------------------------------------------------------------------------------- /test-data/recipes/run_exports/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: run_exports_test 3 | version: "1.0.0" 4 | 5 | requirements: 6 | host: 7 | - zlib 8 | run_exports: 9 | - ${{ pin_subpackage("run_exports_test", exact=True) }} 10 | 11 | # avoid adding libzlib 12 | ignore_run_exports: 13 | by_name: 14 | - libzlib 15 | -------------------------------------------------------------------------------- /.dprint.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "yaml": { 3 | "printWidth": 100, 4 | "formatComments": true, 5 | "braceSpacing": false, 6 | }, 7 | "excludes": [ "**/*-lock.json", "**/*.lock", "**/node_modules/", "dist/" ], 8 | "plugins": [ 9 | "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm", 10 | ], 11 | } 12 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test_with_bak.patch: -------------------------------------------------------------------------------- 1 | --- ./workdir/text.md.bak 2021-12-27 12:22:09.000000000 -0800 2 | +++ ./workdir/text.md 2021-12-27 12:22:14.000000000 -0800 3 | @@ -1,4 +1,5 @@ 4 | I am a long text. 5 | And I want to be patched. 6 | +This was patched using .bak extension! 7 | By the patching tool in rattler-build. 8 | Thank you! -------------------------------------------------------------------------------- /test-data/recipes/script_env/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: script_env 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | env: 8 | FOO: Hello World! 9 | content: 10 | - if: unix 11 | then: echo "FOO is $FOO" > $PREFIX/hello.txt 12 | - if: win 13 | then: echo "FOO is %FOO%" > %PREFIX%\hello.txt 14 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_post_link.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": [ 3 | { 4 | "_path": "bin/.postlink-post-link.sh", 5 | "path_type": "hardlink", 6 | "sha256": "2b5030749a170526d3d4323429b032d9776b17d798c972b46f3076392fbf2117", 7 | "size_in_bytes": 34 8 | } 9 | ], 10 | "paths_version": 1 11 | } 12 | -------------------------------------------------------------------------------- /test-data/recipes/git_source_expected_commit/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: "git_source_expected_commit" 3 | version: "1" 4 | 5 | source: 6 | - git: https://github.com/prefix-dev/rattler-build 7 | tag: v0.1.0 8 | expected_commit: df83c1edf287a756b8fc995e03e9632af0344777 9 | 10 | build: 11 | script: 12 | - test -f README.md 13 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test_with_orig.patch: -------------------------------------------------------------------------------- 1 | --- ./workdir/text.md.orig 2021-12-27 12:22:09.000000000 -0800 2 | +++ ./workdir/text.md 2021-12-27 12:22:14.000000000 -0800 3 | @@ -1,4 +1,5 @@ 4 | I am a long text. 5 | And I want to be patched. 6 | +Oh, wow, I was patched! Thank you soooo much! 7 | By the patching tool in rattler-build. 8 | Thank you! -------------------------------------------------------------------------------- /test-data/recipes/always-copy-files/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: always_copy_files 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "Hello, world!" > $PREFIX/hello.txt 10 | else: 11 | - echo "Hello, world!" > %PREFIX%\hello.txt 12 | 13 | always_copy_files: 14 | - hello.txt 15 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_run_exports.json: -------------------------------------------------------------------------------- 1 | { 2 | "noarch": [ 3 | "python" 4 | ], 5 | "strong": [ 6 | "def", 7 | "ghi" 8 | ], 9 | "strong_constraints": [ 10 | "pqr", 11 | "stu" 12 | ], 13 | "weak": [ 14 | "abc" 15 | ], 16 | "weak_constraints": [ 17 | "jkl", 18 | "mno" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /test-data/recipes/git_source_patch/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: ament_package 3 | version: "0.14.0" 4 | 5 | source: 6 | git: https://github.com/ros2-gbp/ament_package-release.git 7 | tag: release/humble/ament_package/0.14.0-4 8 | target_directory: ros-humble-ament-package/src/work 9 | patches: 10 | - patch/ros-humble-ament-package.patch 11 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple.ambr: -------------------------------------------------------------------------------- 1 | # serializer version: 1 2 | # name: test_noarch_flask 3 | ''' 4 | - python: 5 | imports: 6 | - flask 7 | - flask.json 8 | - script: 9 | content: |- 10 | flask --help 11 | pip check 12 | requirements: 13 | run: 14 | - pip 15 | 16 | ''' 17 | # --- 18 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_recipe_variant_render.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "build": [ 4 | "python" 5 | ], 6 | "run": [ 7 | "python", 8 | "__unix" 9 | ] 10 | }, 11 | { 12 | "build": [ 13 | "python" 14 | ], 15 | "run": [ 16 | "python", 17 | "__unix" 18 | ] 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__test__test__python_parsing.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/test.rs 3 | expression: yaml_serde 4 | --- 5 | - python: 6 | imports: 7 | - pandas 8 | python_version: '>=3.10' 9 | - python: 10 | imports: 11 | - pandas 12 | python_version: 13 | - '>=3.10' 14 | - '>=3.12' 15 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__variant_config__tests__flatten_selectors.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/variant_config.rs 3 | expression: res 4 | --- 5 | pin_run_as_build: ~ 6 | zip_keys: ~ 7 | c_compiler: 8 | - super_g++ 9 | cplusplus: 10 | - "10" 11 | - "1000" 12 | cxx_compiler: 13 | - super_gcc 14 | python: 15 | - "3.7" 16 | - "3.8" 17 | unix_level: 18 | - 1 19 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test.patch: -------------------------------------------------------------------------------- 1 | diff --git a/text.md b/text.md 2 | index 0fbe3c1..71c9c03 100644 3 | --- a/text.md 4 | +++ b/text.md 5 | @@ -1,4 +1,5 @@ 6 | I am a long text. 7 | And I want to be patched. 8 | +Oh, wow, I was patched! Thank you soooo much! 9 | By the patching tool in rattler-build. 10 | Thank you! 11 | \ No newline at end of file 12 | -------------------------------------------------------------------------------- /test-data/recipes/ruby-extension-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: ruby-extension-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: build.rb # Should auto-detect Ruby interpreter 8 | 9 | requirements: 10 | build: 11 | - ruby 12 | 13 | about: 14 | summary: Test auto-detection of Ruby interpreter from .rb extension 15 | license: MIT 16 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_extra_meta_is_recorded_into_about_json.json: -------------------------------------------------------------------------------- 1 | { 2 | "channels": [ 3 | "https://conda.anaconda.org/conda-forge/" 4 | ], 5 | "extra": { 6 | "flow_run_id": "some_id", 7 | "sha": "24ee3" 8 | }, 9 | "home": "https://github.com/uiri/toml", 10 | "license": "MIT", 11 | "summary": "Python lib for TOML." 12 | } 13 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__duplicate_keys_error.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × failed to parse YAML: duplicate key. 9 | ╭─[8:1] 10 | 7 │ 11 | 8 │ build: 12 | · ──┬── 13 | · ╰── duplicate key here 14 | 9 │ string: "1234" 15 | ╰──── 16 | -------------------------------------------------------------------------------- /test-data/recipes/patch_with_strip/0001-Patch-with-levels-to-strip.patch: -------------------------------------------------------------------------------- 1 | diff --git a/tests/test-recipes/metadata/patch-read-only/somefile b/tests/test-recipes/metadata/patch-read-only/somefile 2 | index 8baef1b..cd470e6 100444 3 | --- a/tests/test-recipes/metadata/patch-read-only/somefile 4 | +++ b/tests/test-recipes/metadata/patch-read-only/somefile 5 | @@ -1 +1 @@ 6 | -abc 7 | +xyz 8 | -------------------------------------------------------------------------------- /test-data/recipes/nodejs-extension-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: nodejs-extension-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: build.js # Should auto-detect NodeJS interpreter 8 | 9 | requirements: 10 | build: 11 | - nodejs 12 | 13 | about: 14 | summary: Test auto-detection of NodeJS interpreter from .js extension 15 | license: MIT 16 | -------------------------------------------------------------------------------- /test-data/recipes/simple-ruby-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: simple-ruby-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | interpreter: ruby 9 | content: | 10 | puts "Ruby interpreter working!" 11 | 12 | requirements: 13 | build: 14 | - ruby 15 | 16 | about: 17 | summary: Simple test for Ruby interpreter 18 | license: MIT 19 | -------------------------------------------------------------------------------- /src/tui/utils.rs: -------------------------------------------------------------------------------- 1 | use miette::IntoDiagnostic; 2 | use std::env; 3 | use std::path::Path; 4 | use std::process::Command; 5 | 6 | /// Runs the user's default editor to edit content. 7 | pub fn run_editor(path: &Path) -> miette::Result<()> { 8 | let editor = env::var("EDITOR").into_diagnostic()?; 9 | Command::new(editor).arg(path).status().into_diagnostic()?; 10 | Ok(()) 11 | } 12 | -------------------------------------------------------------------------------- /deny.toml: -------------------------------------------------------------------------------- 1 | [licenses] 2 | allow = [ 3 | "0BSD", 4 | "Apache-2.0 WITH LLVM-exception", 5 | "Apache-2.0", 6 | "BSD-2-Clause", 7 | "BSD-3-Clause", 8 | "BSL-1.0", 9 | "bzip2-1.0.6", 10 | "CC0-1.0", 11 | "CDLA-Permissive-2.0", 12 | "ISC", 13 | "MIT", 14 | "MPL-2.0", 15 | "Unicode-3.0", 16 | "Zlib", 17 | ] 18 | confidence-threshold = 0.8 19 | private = { ignore = true } 20 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__binary_relocation_paths.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: recipe 4 | --- 5 | schema_version: 1 6 | context: {} 7 | package: 8 | name: zlib 9 | version: 0.1.0 10 | build: 11 | number: 0 12 | dynamic_linking: 13 | binary_relocation: 14 | - /usr/lib/** 15 | - /etc 16 | requirements: {} 17 | -------------------------------------------------------------------------------- /test-data/recipes/race-condition/recipe-pin-subpackage.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: test-split 3 | version: v1 4 | 5 | build: 6 | number: 0 7 | noarch: python 8 | 9 | source: 10 | path: ./ 11 | 12 | outputs: 13 | - package: 14 | name: test2 15 | requirements: 16 | run: 17 | - ${{ pin_subpackage('test1', exact=True) }} 18 | - package: 19 | name: test1 20 | -------------------------------------------------------------------------------- /test-data/recipes/run_exports_from/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: run_exports_test 3 | version: "1.0.0" 4 | 5 | build: 6 | merge_build_and_host_envs: true 7 | 8 | requirements: 9 | build: 10 | - zlib 11 | run_exports: 12 | - ${{ pin_subpackage("run_exports_test", exact=True) }} 13 | # avoid from package 14 | ignore_run_exports: 15 | from_package: 16 | - zlib 17 | -------------------------------------------------------------------------------- /test-data/recipes/ssl_test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: lua-lpeg 3 | version: 1.1.0 4 | 5 | source: 6 | - url: https://untrusted-root.badssl.com/style.css 7 | sha256: 0e755b89c8859e52f62869c84913efb0d11c48734437c93c506c210be2157e6b 8 | - url: https://self-signed.badssl.com/icons/favicon-red.ico 9 | sha256: 1dc349e55c6654635db94b9a4ea4510c94c13416653621b581d6c570076fd266 10 | -------------------------------------------------------------------------------- /test-data/recipes/strict-mode/recipe-pass.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-strict-pass 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "test" > $PREFIX/test.txt 10 | else: 11 | - echo "test" > %PREFIX%\test.txt 12 | 13 | tests: 14 | - package_contents: 15 | strict: true 16 | files: 17 | - test.txt 18 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__output__tests__recipe_schema_error-3.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/output.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × missing field `version` 9 | ╭─[6:11] 10 | 5 │ - package: 11 | 6 │ ╭─▶ name: bla 12 | ╰──── 13 | help: the field `version` is required for `package` 14 | -------------------------------------------------------------------------------- /test-data/recipes/cache_run_exports/helper.yaml: -------------------------------------------------------------------------------- 1 | outputs: 2 | - package: 3 | name: normal-run-exports 4 | version: "1.0.0" 5 | requirements: 6 | run_exports: 7 | - normal-run-exports 8 | - package: 9 | name: strong-run-exports 10 | version: "1.0.0" 11 | requirements: 12 | run_exports: 13 | strong: 14 | - normal-run-exports 15 | -------------------------------------------------------------------------------- /test-data/recipes/variant_config/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: bla 3 | version: "0.1.0" 4 | 5 | build: 6 | number: ${{ 10 if false }} 7 | noarch: generic 8 | script: 9 | env: 10 | FOO: ${{ some_option }} 11 | content: 12 | - if: unix 13 | then: 14 | - echo $FOO > $PREFIX/foo.txt 15 | else: 16 | - echo %FOO% > %PREFIX%\foo.txt 17 | -------------------------------------------------------------------------------- /test-data/recipes/simple-nodejs-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: simple-nodejs-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | interpreter: nodejs 9 | content: | 10 | console.log("NodeJS interpreter working!"); 11 | 12 | requirements: 13 | build: 14 | - nodejs 15 | 16 | about: 17 | summary: Simple test for NodeJS interpreter 18 | license: MIT 19 | -------------------------------------------------------------------------------- /test-data/recipes/run_exports/multi_run_exports_dict.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: run_exports_test_list 3 | version: "1.0.0" 4 | 5 | requirements: 6 | run_exports: 7 | weak: 8 | - abc 9 | strong: 10 | - def 11 | - ghi 12 | weak_constraints: 13 | - jkl 14 | - mno 15 | strong_constraints: 16 | - pqr 17 | - stu 18 | noarch: 19 | - python 20 | -------------------------------------------------------------------------------- /docs/layouts/download-font-to-cache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Since Moranga is not on Google Fonts, we have to download the TTF file ourselves 4 | # and place it in the cache for the social card plugin to use it. 5 | # This step is executed by Pixi 6 | 7 | mkdir -p .cache/plugin/social/fonts/Moranga 8 | curl -sL https://fonts.prefix.dev/moranga/MorangaMedium/font.ttf \ 9 | -o .cache/plugin/social/fonts/Moranga/Medium.ttf -------------------------------------------------------------------------------- /test-data/package_content/test_bin_win.yaml: -------------------------------------------------------------------------------- 1 | platform: win-64 2 | package_contents: 3 | bin: 4 | - curl 5 | - curl-mingw2 6 | - python-entry-point 7 | - noextension 8 | - oldschool 9 | - batch 10 | paths: 11 | - Library/bin/curl.exe 12 | - Library/bin/noextension 13 | - Library/mingw-w64/bin/curl.exe 14 | - Scripts/python-entry-point.exe 15 | - oldschool.com 16 | - batch.bat 17 | -------------------------------------------------------------------------------- /test-data/recipes/race-condition/recipe-python-min.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-python-min 3 | version: "1.0.0" 4 | 5 | requirements: 6 | host: 7 | - python >=${{ python_min }} 8 | - python ${{ python_min }}.* 9 | - python ${{ python_min ~ ".*,<4.0a0" }} 10 | run: 11 | - python >=${{ python_min }} 12 | - python ${{ python_min }}.* 13 | - python ${{ python_min ~ ".*,<4.0a0" }} 14 | -------------------------------------------------------------------------------- /test-data/package_content/test_site_packages_unix.yaml: -------------------------------------------------------------------------------- 1 | platform: linux-64 2 | package_contents: 3 | site_packages: 4 | - numpy 5 | - numpy.superfunc 6 | - numpy.xfunc 7 | - numpy.blabla 8 | - numpy/blabla* 9 | 10 | paths: 11 | - lib/python3.8/site-packages/numpy/__init__.py 12 | - lib/python3.8/site-packages/numpy/blabla.py 13 | - lib/python3.8/site-packages/numpy/superfunc/__init__.py 14 | -------------------------------------------------------------------------------- /test-data/recipes/source_filter/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: source_filter 3 | version: 1.0.0 4 | 5 | source: 6 | - path: ./test-folder 7 | filter: 8 | include: 9 | - "*.txt" 10 | exclude: 11 | - "exclude*" 12 | 13 | build: 14 | script: 15 | - echo "running build (test)" 16 | - test -f included.txt 17 | - test ! -f not-included 18 | - test ! -f excluded.txt 19 | -------------------------------------------------------------------------------- /test-data/recipes/win-symlink-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: win-symlink-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | - mkdir %PREFIX%\bin 9 | - mkdir %PREFIX%\lib 10 | - echo "target file content" > %PREFIX%\lib\target.txt 11 | - echo "executable content" > %PREFIX%\bin\real_exe.bat 12 | - mklink %PREFIX%\bin\symlink_to_target.txt %PREFIX%\lib\target.txt 13 | -------------------------------------------------------------------------------- /test-data/package_content/test_files.yaml: -------------------------------------------------------------------------------- 1 | platform: linux-64 2 | package_contents: 3 | files: 4 | - assets/**/*.mp3 5 | - images/cover.jpg 6 | - pkg-config/test.pc 7 | - pkg-config/*.pc 8 | paths: 9 | - assets/music/track1.mp3 10 | - assets/music/interpret/track2.mp3 11 | - images/cover.jpg 12 | - pkg-config/test.pc 13 | - pkg-config/bla.pc 14 | fail_paths: 15 | - assets/music/track1.ogg 16 | -------------------------------------------------------------------------------- /test-data/recipes/race-condition/recipe-pin-invalid.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: test-split 3 | version: v1 4 | 5 | build: 6 | number: 0 7 | noarch: python 8 | 9 | source: 10 | path: ./ 11 | 12 | outputs: 13 | - package: 14 | name: test.a 15 | - package: 16 | name: test.b 17 | requirements: 18 | run: 19 | - ${{ pin_subpackage('test1', exact=True) }} # this package does not exist! 20 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__output__tests__recipe_schema_error-4.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/output.rs 3 | expression: find_outputs_from_src(src.as_str()).unwrap_err() 4 | --- 5 | × invalid field `randomkey`. 6 | ╭─[11:1] 7 | 10 │ 8 | 11 │ randomkey: 9 | · ────┬──── 10 | · ╰── here 11 | 12 │ - bla 12 | ╰──── 13 | help: invalid key `randomkey` in root node 14 | -------------------------------------------------------------------------------- /test-data/recipes/7z-source/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: 7z-source 3 | version: 0.1.0 4 | source: 5 | - url: https://downloads.sourceforge.net/project/sevenzip/7-Zip/24.08/7z2408-src.7z 6 | sha256: 4df7a62e5ce503892f500b1f96f0a954931c5266900c439102040957b25a90c6 7 | 8 | build: 9 | script: 10 | - if: unix 11 | then: 12 | - test -d CPP 13 | else: 14 | - if not exist "CPP\" exit 1 15 | -------------------------------------------------------------------------------- /examples/match_and_cdt/recipe.yaml: -------------------------------------------------------------------------------- 1 | # this is an example recipe to show how you may use cmp and 2 | # cdt in actual recipe code 3 | 4 | package: 5 | name: async-cairo 6 | version: dev 7 | 8 | build: 9 | string: "py_${{ python | version_to_buildstring }}" 10 | 11 | requirements: 12 | host: 13 | - if: linux 14 | then: ${{ cdt("cairo") }} 15 | run: 16 | - if: match(python, "3.3") 17 | then: asyncio 18 | -------------------------------------------------------------------------------- /test-data/recipes/test-errorlevel-injection/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-errorlevel-injection 3 | version: "0.1.0" 4 | 5 | tests: 6 | - script: 7 | - echo "This test is designed to fail." 8 | # make something that sets error level to non-zero 9 | - python.exe -c "import sys; sys.exit(1)" 10 | - echo "This line will not be executed." 11 | requirements: 12 | run: 13 | - python 14 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__bad_skip_single_output.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × failed to render Jinja expression: syntax error: unexpected character (in 9 | │ :1) 10 | ╭─[7:7] 11 | 6 │ skip: 12 | 7 │ - asd;asd;123 13 | · ─────┬───── 14 | · ╰── here 15 | ╰──── 16 | -------------------------------------------------------------------------------- /test-data/recipes/post-link/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: postlink 3 | version: 0.1.0 4 | 5 | build: 6 | skip: 7 | - win 8 | script: 9 | - mkdir -p $PREFIX/bin 10 | - echo 'touch $CONDA_PREFIX/POST-LINK-RAN' > $PREFIX/bin/.postlink-post-link.sh 11 | - chmod +x $PREFIX/bin/.postlink-post-link.sh 12 | 13 | tests: 14 | - script: 15 | - test -f $CONDA_PREFIX/POST-LINK-RAN 16 | - ls $CONDA_PREFIX/ 17 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__context_not_mapping.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × expected a mapping. 9 | ╭─[2:18] 10 | 1 │ 11 | 2 │ context: "not-mapping" 12 | · ──────┬────── 13 | · ╰── here 14 | 3 │ 15 | ╰──── 16 | help: `context` must always be a mapping 17 | -------------------------------------------------------------------------------- /test-data/recipes/package-content-tests/recipe-test-fail.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-execution-fail 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "Hello World" > $PREFIX/test-execution.txt 10 | else: 11 | - echo "Hello World" > %PREFIX%\test-execution.txt 12 | 13 | tests: 14 | - package_contents: 15 | files: 16 | - "**/*.txt" 17 | - "**/*.php" 18 | -------------------------------------------------------------------------------- /rust-tests/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-tests" 3 | version = "0.1.0" 4 | edition = "2024" 5 | license = "BSD-3-Clause" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | glob = "0.3.3" 11 | rattler_package_streaming = { version = "0.23.20", default-features = false } 12 | serde_json = "1.0.145" 13 | sha1 = "0.10.6" 14 | duct = "1.1.1" 15 | fs-err = "3.2.0" 16 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__error__tests__miette_output.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/error.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × expected a mapping. 9 | ╭─[3:17] 10 | 2 │ context: 11 | 3 │ ╭─▶ - a 12 | 4 │ ├─▶ - b 13 | · ╰──── here 14 | 5 │ package: 15 | ╰──── 16 | help: `context` must always be a mapping 17 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__map_null_values.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: recipe 4 | --- 5 | schema_version: 1 6 | context: {} 7 | package: 8 | name: zlib 9 | version: 0.1.0 10 | build: 11 | number: 0 12 | script: "${{ \"echo 'world'\" if true }}" 13 | prefix_detection: 14 | force_file_type: 15 | binary: 16 | - zlib 17 | requirements: 18 | run: 19 | - zlib 20 | -------------------------------------------------------------------------------- /test-data/recipes/downstream_test/fail.yaml: -------------------------------------------------------------------------------- 1 | outputs: 2 | - package: 3 | name: upstream-fail 4 | version: 2.0.0 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - touch $PREFIX/fail.txt 10 | - if: win 11 | then: 12 | - echo "empty" > %PREFIX%\fail.txt 13 | tests: 14 | - script: 15 | - echo "Running test" 16 | - downstream: downstream-fail 17 | -------------------------------------------------------------------------------- /examples/curl/build.bat: -------------------------------------------------------------------------------- 1 | mkdir build 2 | 3 | cmake -GNinja ^ 4 | -DCMAKE_BUILD_TYPE=Release ^ 5 | -DBUILD_SHARED_LIBS=ON ^ 6 | -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ 7 | -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ 8 | -DCURL_USE_SCHANNEL=ON ^ 9 | -DCURL_USE_LIBSSH2=OFF ^ 10 | -DUSE_ZLIB=ON ^ 11 | -DENABLE_UNICODE=ON ^ 12 | %SRC_DIR% 13 | 14 | IF %ERRORLEVEL% NEQ 0 exit 1 15 | 16 | ninja install --verbose 17 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__bad_skip_multi_output.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × failed to render Jinja expression: syntax error: unexpected character (in 9 | │ :1) 10 | ╭─[12:11] 11 | 11 │ skip: 12 | 12 │ - asd;asd;123 13 | · ─────┬───── 14 | · ╰── here 15 | ╰──── 16 | -------------------------------------------------------------------------------- /src/render/snapshots/rattler_build__render__resolved_dependencies__tests__dependency_info_render.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/render/resolved_dependencies.rs 3 | expression: yaml_str 4 | --- 5 | - source: xyz 6 | - variant: bar 7 | spec: foo 8 | - pin_subpackage: baz 9 | lower_bound: x.x.x 10 | upper_bound: x.x 11 | exact: true 12 | spec: baz 13 | - pin_compatible: bat 14 | lower_bound: x.x.x 15 | upper_bound: x.x 16 | exact: true 17 | spec: bat 18 | -------------------------------------------------------------------------------- /test-data/recipes/cache/recipe-cmake.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: 0.1.0 3 | build_num: 0 4 | 5 | recipe: 6 | name: cache-installation 7 | version: ${{ version }} 8 | 9 | build: 10 | number: ${{ build_num }} 11 | 12 | cache: 13 | requirements: 14 | build: 15 | - cmake 16 | build: 17 | script: 18 | - cmake --version 19 | 20 | outputs: 21 | - package: 22 | name: check-1 23 | 24 | - package: 25 | name: check-2 26 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__glob_vec__tests__parsing_globvec_fail.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/glob_vec.rs 3 | expression: err 4 | --- 5 | × failed to parse glob: error parsing glob 'foo/{bla': unclosed alternate 6 | │ group; missing '}' (maybe escape '{' with '[{]'?) 7 | ╭─[2:11] 8 | 1 │ globs: 9 | 2 │ - foo/{bla 10 | · ────┬─── 11 | · ╰── here 12 | 3 │ 13 | ╰──── 14 | -------------------------------------------------------------------------------- /test-data/recipes/build_files/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: build_files 3 | version: 1.0.0 4 | 5 | build: 6 | files: 7 | include: 8 | - include/* 9 | exclude: 10 | - "*.exe" 11 | 12 | script: | 13 | mkdir -p $PREFIX/include 14 | mkdir -p $PREFIX/lib 15 | touch $PREFIX/include/include_file.h 16 | touch $PREFIX/include/include_file.c 17 | touch $PREFIX/include/include_file.exe 18 | touch $PREFIX/lib/lib_foo.so 19 | -------------------------------------------------------------------------------- /docs/reference/python_bindings.md: -------------------------------------------------------------------------------- 1 | # Python bindings 2 | 3 | These are the API docs for the `rattler_build` Python bindings. 4 | 5 | ::: rattler_build 6 | options: 7 | members: 8 | - build_recipes 9 | - test_package 10 | - upload_package_to_quetz 11 | - upload_package_to_artifactory 12 | - upload_package_to_prefix 13 | - upload_package_to_anaconda 14 | - upload_packages_to_conda_forge 15 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__jinja_error.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × failed to render Jinja expression: unknown function: zcompiler is unknown 9 | │ (in :1) 10 | ╭─[7:7] 11 | 6 │ host: 12 | 7 │ - ${{ zcompiler('c') }} 13 | · ──────────┬────────── 14 | · ╰── unknown function: zcompiler is unknown 15 | ╰──── 16 | -------------------------------------------------------------------------------- /test-data/recipes/console_logging/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: console_logging 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | secrets: 8 | - SECRET 9 | content: 10 | - if: unix 11 | then: 12 | - printf "Building console_logging\n" 13 | - printf "\e[1;31mThis is a red text\e[0m\n" 14 | - printf "I am ${SECRET}\n" 15 | else: 16 | - echo "Building console_logging" 17 | - echo "I am %SECRET%" 18 | -------------------------------------------------------------------------------- /test-data/recipes/strict-mode/recipe-fail.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-strict-fail 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "test" > $PREFIX/test.txt 10 | - echo "extra" > $PREFIX/extra.txt 11 | else: 12 | - echo "test" > %PREFIX%\test.txt 13 | - echo "extra" > %PREFIX%\extra.txt 14 | 15 | tests: 16 | - package_contents: 17 | strict: true 18 | files: 19 | - test.txt 20 | -------------------------------------------------------------------------------- /typos.toml: -------------------------------------------------------------------------------- 1 | [files] 2 | extend-exclude = [ 3 | ".git/", 4 | ".pixi/", 5 | "**/*.snap", 6 | "**/*.patch", 7 | "tests/data/mapping_files/*", 8 | "test-data/conda_forge/**/*", 9 | "test-data/patch_application/**/*", 10 | "**/*.ipynb", 11 | "**/__marimo__/", 12 | ] 13 | ignore-hidden = false 14 | 15 | [default.extend-identifiers] 16 | ratatui = "ratatui" 17 | ND = "ND" 18 | FreeTakServer = "FreeTakServer" 19 | 20 | [default.extend-words] 21 | placehold = "placehold" 22 | -------------------------------------------------------------------------------- /examples/linking/zlink/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | project(MyProject) 3 | 4 | # Find the zlib library 5 | find_package(ZLIB REQUIRED) 6 | 7 | # Include directories 8 | include_directories(${ZLIB_INCLUDE_DIRS}) 9 | 10 | # Target executable 11 | add_executable(zlink src/main.c) 12 | 13 | # Link zlib to the executable 14 | target_link_libraries(zlink ${ZLIB_LIBRARIES}) 15 | 16 | # Install the executable to bin/zlink 17 | install(TARGETS zlink DESTINATION bin/) 18 | -------------------------------------------------------------------------------- /src/post_process/snapshots/rattler_build__post_process__python__tests__replace_shebang_in_file.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/post_process/python.rs 3 | expression: "fs::read_to_string(&dest).unwrap()" 4 | --- 5 | #!/super/prefix/bin/python arguments -a -b -c 6 | # -*- coding: utf-8 -*- 7 | import re 8 | import sys 9 | 10 | from myapp.cli.core import cli 11 | 12 | if __name__ == "__main__": 13 | sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) 14 | sys.exit(cli()) 15 | 16 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__output__tests__recipe_schema_error.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/output.rs 3 | expression: find_outputs_from_src(src.as_str()).unwrap_err() 4 | --- 5 | × invalid field `package`. 6 | ╭─[3:1] 7 | 2 │ 8 | 3 │ package: 9 | · ───┬─── 10 | · ╰── here 11 | 4 │ name: blib 12 | ╰──── 13 | help: recipe cannot have both `outputs` and `package` fields. Rename 14 | `package` to `recipe` or remove `outputs` 15 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__package__tests__invalid_fields.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/package.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × invalid field `invalid`. 9 | ╭─[5:13] 10 | 4 │ version: 0.1.0 11 | 5 │ invalid: "field" 12 | · ───┬─── 13 | · ╰── here 14 | 6 │ 15 | ╰──── 16 | help: valid fields for `package` are `name` and `version` 17 | -------------------------------------------------------------------------------- /test-data/recipes/zip-source/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: zip-source 3 | version: 0.1.0 4 | source: 5 | - url: https://cache-redirector.jetbrains.com/download.jetbrains.com/idea/jdbc-drivers/web/snowflake-3.13.27.zip 6 | sha256: 6a15e95ee7e6c55b862dab9758ea803350aa2e3560d6183027b0c29919fcab18 7 | 8 | build: 9 | script: 10 | - if: unix 11 | then: 12 | - test -f snowflake-jdbc-3.13.27.jar 13 | else: 14 | - if not exist snowflake-jdbc-3.13.27.jar exit 1 15 | -------------------------------------------------------------------------------- /test-data/recipes/rattlerbuildignore/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-rattlerbuildignore 3 | version: 1.0.0 4 | 5 | source: 6 | - path: . 7 | 8 | build: 9 | script: 10 | - if: unix 11 | then: 12 | - mkdir -p $PREFIX/files 13 | - cp -r * $PREFIX/files/ 2>/dev/null || true 14 | else: 15 | - mkdir %PREFIX%\files 16 | - xcopy * %PREFIX%\files\ /E /I /Y 2>nul || exit 0 17 | 18 | about: 19 | summary: Test package for .condapackageignore functionality 20 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__invalid_root_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × invalid field `test`. 9 | ╭─[6:9] 10 | 5 │ 11 | 6 │ test: 12 | · ──┬─ 13 | · ╰── here 14 | 7 │ - python: 15 | ╰──── 16 | help: valid fields are `schema_version`, `package`, `context`, `source`, 17 | `build`, `requirements`, `tests`, `about`, `extra` 18 | -------------------------------------------------------------------------------- /test-data/recipes/test-execution/recipe-test-fail.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-execution-fail 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "Hello World" > $PREFIX/test-execution.txt 10 | else: 11 | - echo "Hello World" > %PREFIX%\test-execution.txt 12 | 13 | tests: 14 | - script: 15 | - if: unix 16 | then: 17 | - test -f $PREFIX/fail.txt 18 | else: 19 | - if not exist %PREFIX%\fail.txt (exit 1) 20 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_duplicate_keys.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 1234 7 | 8 | build: 9 | string: "1234" 10 | 11 | about: 12 | homepage: http://www.example.com 13 | license: BSD-3-Clause 14 | license_file: LICENSE 15 | summary: blabla 16 | description: long blabla 17 | documentation: http://docs.example.com 18 | repository: https://github.com/example/test 19 | 20 | extra: 21 | recipe-maintainers: 22 | - some-maintainer 23 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__output__tests__recipe_schema_error-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/output.rs 3 | expression: find_outputs_from_src(src.as_str()).unwrap_err() 4 | --- 5 | × invalid field `requirements`. 6 | ╭─[5:1] 7 | 4 │ 8 | 5 │ requirements: 9 | · ──────┬───── 10 | · ╰── here 11 | 6 │ host: 12 | ╰──── 13 | help: multi-output recipes cannot have a top-level requirements field. Move 14 | `requirements` inside the individual output. 15 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__package__tests__missing_fields.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/package.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × missing field `version` 9 | ╭─[3:17] 10 | 2 │ package: 11 | 3 │ name: test 12 | · ───┬── 13 | · ╰── add the field `version` in between here 14 | 4 │ 15 | ╰──── 16 | help: the field `version` is required for `package` 17 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__requirements__test__pin_package.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/requirements.rs 3 | expression: "serde_yaml::to_string(&requirements).unwrap()" 4 | --- 5 | build: 6 | - foo >=3.1 7 | - pin_subpackage: 8 | name: foo 9 | lower_bound: x.x.x.x 10 | upper_bound: x.x 11 | - pin_compatible: 12 | name: bar 13 | lower_bound: x.x 14 | upper_bound: x.x.x 15 | - pin_compatible: 16 | name: bar 17 | lower_bound: x.x 18 | exact: true 19 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test_create_delete.patch: -------------------------------------------------------------------------------- 1 | diff --git a/to_be_deleted.txt b/to_be_deleted.txt 2 | deleted file mode 100644 3 | index 1234567..0000000 4 | --- a/to_be_deleted.txt 5 | +++ /dev/null 6 | @@ -1,2 +0,0 @@ 7 | -This file will be deleted 8 | -by the patch 9 | diff --git a/newly_created.txt b/newly_created.txt 10 | new file mode 100644 11 | index 0000000..abcdefg 12 | --- /dev/null 13 | +++ b/newly_created.txt 14 | @@ -0,0 +1,2 @@ 15 | +This is a newly created file 16 | +via patch application 17 | -------------------------------------------------------------------------------- /test-data/recipes/filter_files/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: filter_files 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - mkdir -p $PREFIX/ 8 | - touch $PREFIX/.DS_Store 9 | - touch $PREFIX/.gitignore 10 | - mkdir -p $PREFIX/share/info 11 | - touch $PREFIX/share/info/dir 12 | - touch $PREFIX/test.pyo 13 | - mkdir -p $PREFIX/lib 14 | - touch $PREFIX/lib/libarchive.la 15 | - touch $PREFIX/exists.txt 16 | - mkdir -p $PREFIX/.github/ 17 | - touch $PREFIX/.github/foo 18 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__about__test__invalid_url.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/about.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × failed to parse URL: relative URL without a base 9 | ╭─[7:23] 10 | 6 │ about: 11 | 7 │ homepage: license_urla.asda:://sdskd 12 | · ─────────────┬──────────── 13 | · ╰── failed to parse URL 14 | 8 │ 15 | ╰──── 16 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__context_variable_with_hyphen.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × invalid context variable name. 9 | ╭─[3:11] 10 | 2 │ context: 11 | 3 │ foo-bar: baz 12 | · ───┬─── 13 | · ╰── here 14 | 4 │ 15 | ╰──── 16 | help: `context` variable names cannot contain hyphens (-) as they are not 17 | valid in jinja expressions 18 | -------------------------------------------------------------------------------- /test-data/recipes/correct-sha/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: "0.0.1" 3 | 4 | package: 5 | name: test-package 6 | version: ${{ version }} 7 | source: 8 | - url: 9 | - https://idontexist.com/microsoft/mssql-jdbc/raw/v12.2.0/LICENSE 10 | - https://github.com/microsoft/mssql-jdbc/raw/v12.2.0/LICENSE 11 | sha256: 96783d7ed4ff39e20c9ae6642ac6de02692ec8909e9910700e3694d68211ee97 12 | file_name: mssql-jdbc-license.txt 13 | 14 | build: 15 | number: 0 16 | script: 17 | - echo "Hello world!" 18 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test_simple_mixed.patch: -------------------------------------------------------------------------------- 1 | --- a/existing_file.txt 2021-12-27 12:22:09.000000000 -0800 2 | +++ b/existing_file.txt 2021-12-27 12:22:14.000000000 -0800 3 | @@ -1,4 +1,5 @@ 4 | I am a long text. 5 | And I want to be patched. 6 | +Mixed files patch applied! 7 | By the patching tool in rattler-build. 8 | Thank you! 9 | --- /dev/null 2021-12-27 12:22:09.000000000 -0800 10 | +++ b/new_file.txt 2021-12-27 12:22:14.000000000 -0800 11 | @@ -0,0 +1,2 @@ 12 | +This is a new file. 13 | +Created by patch application. -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__context_value_not_uniform_list.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × mixed types in sequence: subsequent member is `number` in a list of 9 | │ `string`. 10 | ╭─[6:15] 11 | 5 │ - bar 12 | 6 │ - 3 13 | · ┬ 14 | · ╰── here 15 | 7 │ - 4 16 | ╰──── 17 | help: sequence `context` must have all members of the same scalar type 18 | -------------------------------------------------------------------------------- /test-data/recipes/pin_subpackage/recipe.yaml: -------------------------------------------------------------------------------- 1 | # regression test that pin subpackage works with `my.package` 2 | context: 3 | name: my.package 4 | version: 0.1.0 5 | 6 | recipe: 7 | version: ${{ version }} 8 | 9 | build: 10 | number: 0 11 | 12 | outputs: 13 | - package: 14 | name: ${{ name }} 15 | build: 16 | noarch: generic 17 | 18 | - package: 19 | name: ${{ name }}-a 20 | build: 21 | noarch: generic 22 | requirements: 23 | run: 24 | - ${{ pin_subpackage(name, exact=true) }} 25 | -------------------------------------------------------------------------------- /src/recipe/snapshots/rattler_build__recipe__parser__tests__context_value_not_scalar.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser.rs 3 | assertion_line: 458 4 | expression: err 5 | --- 6 | × Failed to parse recipe 7 | 8 | Error: 9 | × expected a scalar value. 10 | ╭─[4:16] 11 | 3 │ key: 12 | 4 │ ╭─▶ foo: 13 | 5 │ ├─▶ - [not, scalar] 14 | · ╰──── here 15 | 6 │ 16 | ╰──── 17 | help: `context` values must always be scalars (booleans, integers or 18 | strings) or uniform lists of scalars 19 | -------------------------------------------------------------------------------- /test-data/selectors/config_1.yaml: -------------------------------------------------------------------------------- 1 | cxx_compiler: 2 | - if: win 3 | then: vs2019 4 | - if: linux 5 | then: super_gcc 6 | 7 | c_compiler: 8 | - if: win 9 | then: vs2019 10 | - if: linux 11 | then: super_g++ 12 | 13 | unix_level: 14 | - if: unix 15 | then: 1 16 | 17 | python: 18 | - if: unix 19 | then: 20 | - "3.7" 21 | - "3.8" 22 | - if: win 23 | then: 24 | - "3.10" 25 | 26 | cplusplus: 27 | - if: unix 28 | then: 29 | - "10" 30 | - "1000" 31 | - if: win 32 | then: "100" 33 | -------------------------------------------------------------------------------- /.github/workflows/enforce-sha.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: [main] 4 | pull_request: 5 | 6 | name: Security 7 | 8 | jobs: 9 | ensure-pinned-actions: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 14 | - name: Ensure SHA pinned actions 15 | uses: zgosalvez/github-actions-ensure-sha-pinned-actions@6124774845927d14c601359ab8138699fa5b70c3 # v3 16 | with: 17 | allowlist: | 18 | prefix-dev/ 19 | -------------------------------------------------------------------------------- /test-data/recipes/llamacpp/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: llama.cpp 3 | version: b1513 4 | 5 | package: 6 | name: "${{ name|lower }}" 7 | version: "${{ version }}" 8 | 9 | source: 10 | git: https://github.com/ggerganov/llama.cpp.git 11 | tag: "${{ version }}" 12 | 13 | build: 14 | number: 0 15 | script: cmake -B build 16 | 17 | requirements: 18 | build: 19 | - cmake 20 | about: 21 | homepage: https://github.com/ggerganov/llama.cpp 22 | license: MIT 23 | license_file: LICENSE 24 | summary: Port of Facebook's LLaMA model in C/C++ 25 | -------------------------------------------------------------------------------- /test-data/recipes/patch_with_strip/recipe.yaml: -------------------------------------------------------------------------------- 1 | # copied from conda-build test suite 2 | 3 | package: 4 | name: patch_with_strip 5 | version: "1.0" 6 | 7 | source: 8 | path: ./somefile.tar 9 | patches: 10 | # Use different kinds of patches to trigger different code paths. 11 | - 0001-Patch-with-levels-to-strip.patch 12 | - 0002-Patch-without-additional-levels.patch 13 | 14 | build: 15 | script: 16 | - if: unix 17 | then: 18 | - cp somefile $PREFIX/somefile 19 | else: 20 | - copy somefile %PREFIX%\somefile 21 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_build_files.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": [ 3 | { 4 | "_path": "include/include_file.c", 5 | "path_type": "hardlink", 6 | "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 7 | "size_in_bytes": 0 8 | }, 9 | { 10 | "_path": "include/include_file.h", 11 | "path_type": "hardlink", 12 | "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 13 | "size_in_bytes": 0 14 | } 15 | ], 16 | "paths_version": 1 17 | } 18 | -------------------------------------------------------------------------------- /test-data/recipes/crazy_characters/test.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | 4 | prefix = Path(os.environ["PREFIX"]) 5 | 6 | # create some files with crazy characters 7 | (prefix / "files").mkdir() 8 | file_1 = prefix / "files" / "File(Glob …).tmSnippet" 9 | file_1.write_text(file_1.name) 10 | 11 | file_2 = ( 12 | prefix / "files" / "a $random_crazy file name with spaces and (parentheses).txt" 13 | ) 14 | file_2.write_text(file_2.name) 15 | 16 | file_3 = prefix / "files" / ("a_really_long_" + ("a" * 200) + ".txt") 17 | file_3.write_text(file_3.name) 18 | -------------------------------------------------------------------------------- /test-data/recipes/timestamps/create_archive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create a temporary file with content 4 | echo "This file has an old timestamp" > oldfile.txt 5 | 6 | # Set the timestamp to January 1, 2000 at 12:00 7 | touch -t 200001011200 oldfile.txt 8 | 9 | # Display the original timestamp for verification 10 | echo "Original file timestamp:" 11 | ls -la oldfile.txt 12 | 13 | # Create the tar.gz archive 14 | tar -czf oldarchive.tar.gz oldfile.txt 15 | 16 | # Clean up the original file 17 | rm oldfile.txt 18 | 19 | echo "Archive created: oldarchive.tar.gz" 20 | -------------------------------------------------------------------------------- /test-data/recipes/debug-multiple-outputs/recipe.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: debug-multiple-outputs 3 | version: 1.0.0 4 | 5 | outputs: 6 | - package: 7 | name: output1 8 | build: 9 | script: | 10 | echo "Building output1" 11 | mkdir -p $PREFIX/output1 12 | echo "Hello from output1" > $PREFIX/output1/hello.txt 13 | 14 | - package: 15 | name: output2 16 | build: 17 | script: | 18 | echo "Building output2" 19 | mkdir -p $PREFIX/output2 20 | echo "Hello from output2" > $PREFIX/output2/hello.txt 21 | -------------------------------------------------------------------------------- /test-data/recipes/relative_file_loading/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | loaded_data: ${{ load_from_file('data/package_data.yaml') }} 3 | loaded_name: ${{ load_from_file('data/package_data.yaml').name }} 4 | loaded_version: ${{ load_from_file('data/package_data.yaml').version }} 5 | loaded_description: ${{ load_from_file('data/package_data.yaml').description }} 6 | 7 | package: 8 | name: relative-file-loading 9 | version: "1.0.0" 10 | 11 | about: 12 | summary: "Test for relative file loading" 13 | description: ${{ load_from_file('data/package_data.yaml').description }} 14 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test_mixed_existing.patch: -------------------------------------------------------------------------------- 1 | --- ./workdir/text.md.orig 2021-12-27 12:22:09.000000000 -0800 2 | +++ ./workdir/text.md 2021-12-27 12:22:14.000000000 -0800 3 | @@ -1,4 +1,5 @@ 4 | I am a long text. 5 | And I want to be patched. 6 | +Mixed files patch applied! 7 | By the patching tool in rattler-build. 8 | Thank you! 9 | --- ./workdir/nonexistent.txt.orig 2021-12-27 12:22:09.000000000 -0800 10 | +++ ./workdir/nonexistent.txt 2021-12-27 12:22:14.000000000 -0800 11 | @@ -0,0 +1,2 @@ 12 | +This file doesn't exist on disk. 13 | +It should be created by the patch. -------------------------------------------------------------------------------- /scripts/activate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -Eeuo pipefail 3 | export CARGO_TARGET_DIR="target-pixi" 4 | export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER="clang" 5 | export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-fuse-ld=$CONDA_PREFIX/bin/mold" 6 | 7 | # on macOS we need to set these rust flags 8 | export CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS="-C link-arg=-Wl,-rpath,$CONDA_PREFIX/lib" 9 | export CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS="-C link-arg=-Wl,-rpath,$CONDA_PREFIX/lib" 10 | 11 | export RATTLER_BUILD_PATH="$PIXI_PROJECT_ROOT/target-pixi/release/rattler-build" 12 | -------------------------------------------------------------------------------- /test-data/recipes/race-condition/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: my-package 3 | 4 | recipe: 5 | name: ${{ name }} 6 | version: "1.0.0" 7 | 8 | outputs: 9 | - package: 10 | name: ${{ name }}-${{ variant }} 11 | 12 | tests: 13 | - script: 14 | - echo "Hello, world!" 15 | requirements: 16 | run: 17 | - ${{ name }} 18 | 19 | - package: 20 | name: ${{ name }} 21 | requirements: 22 | run: 23 | - ${{ pin_subpackage('my-package-a', exact=true) if variant == 'a' else pin_subpackage('my-package-b', exact=true) }} 24 | -------------------------------------------------------------------------------- /clippy.toml: -------------------------------------------------------------------------------- 1 | disallowed-methods = [ 2 | "std::fs::canonicalize", 3 | "std::fs::copy", 4 | "std::fs::create_dir", 5 | "std::fs::create_dir_all", 6 | "std::fs::hard_link", 7 | "std::fs::metadata", 8 | "std::fs::read", 9 | "std::fs::read_dir", 10 | "std::fs::read_link", 11 | "std::fs::read_to_string", 12 | "std::fs::remove_dir", 13 | "std::fs::remove_dir_all", 14 | "std::fs::remove_file", 15 | "std::fs::rename", 16 | "std::fs::set_permissions", 17 | "std::fs::soft_link", 18 | "std::fs::symlink_metadata", 19 | "std::fs::write", 20 | ] 21 | 22 | allow-unwrap-in-tests = true 23 | -------------------------------------------------------------------------------- /test-data/recipes/globtest/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: globtest 3 | version: "0.24.6" 4 | 5 | package: 6 | name: "${{ name|lower }}" 7 | version: "${{ version }}" 8 | 9 | source: 10 | url: https://github.com/xtensor-stack/xtensor/archive/${{ version }}.zip 11 | sha256: 8cd062cfefce0f5bff8961e0c42b3636d5e7eddbe33e5c3167e3fb6d8380f50e 12 | 13 | about: 14 | homepage: https://github.com/xtensor-stack/xtensor 15 | license: BSD-3-Clause 16 | license_file: 17 | - LICENSE 18 | - cmake/ 19 | - docs/*.yml 20 | # this should include the entire `tools` directory 21 | - tools 22 | -------------------------------------------------------------------------------- /test-data/recipes/env_vars/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: env_var_test 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "Value of $pybind11_abi" 10 | - echo "And jinja style: ${{ pybind11_abi }}" 11 | - echo $MAKEFLAGS > $PREFIX/makeflags.txt 12 | - echo $pybind11_abi > $PREFIX/pybind_abi.txt 13 | else: 14 | - echo %MAKEFLAGS% > %PREFIX%\makeflags.txt 15 | - echo %pybind11_abi% > %PREFIX%\pybind_abi.txt 16 | 17 | requirements: 18 | build: 19 | # use to make the variant "used" 20 | - pybind11-abi 21 | -------------------------------------------------------------------------------- /test-data/recipes/package-content-tests/recipe-test-succeed.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-execution 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "Hello World" > $PREFIX/test-execution.txt 10 | - mkdir $PREFIX/bin && echo "Hello World" > $PREFIX/bin/rust 11 | else: 12 | - echo "Hello World" > %PREFIX%\test-execution.txt 13 | - mkdir %PREFIX%\Library\bin && echo "Hello World" > %PREFIX%\Library\bin\rust.exe 14 | 15 | tests: 16 | - package_contents: 17 | files: 18 | - "**/*.txt" 19 | bin: 20 | - rust 21 | -------------------------------------------------------------------------------- /test-data/recipes/downstream_test/succeed.yaml: -------------------------------------------------------------------------------- 1 | outputs: 2 | - package: 3 | name: upstream-good 4 | version: 1.0.0 5 | build: 6 | string: "good" 7 | 8 | tests: 9 | - script: 10 | - echo "Running test" 11 | - downstream: downstream-good 12 | 13 | - package: 14 | name: downstream-good 15 | version: 1.0.0 16 | build: 17 | string: "good" 18 | requirements: 19 | host: 20 | - upstream-good 21 | run: 22 | - upstream-good 23 | 24 | tests: 25 | - script: 26 | - echo "Running test in downstream package" 27 | -------------------------------------------------------------------------------- /test-data/recipes/test-relink/build.sh: -------------------------------------------------------------------------------- 1 | $CC $CFLAGS $LDFLAGS -shared -Wl,-install_name,$PREFIX/lib/libabsolute.dylib ${RECIPE_DIR}/absolute.c -o libabsolute.dylib 2 | $CC $CFLAGS $LDFLAGS -shared ${RECIPE_DIR}/relative.c -o librelative.dylib 3 | 4 | $CC $CFLAGS $LDFLAGS ${RECIPE_DIR}/test_link.c -L. -labsolute -lrelative -o test_link 5 | 6 | # install 7 | mkdir -p $PREFIX/bin 8 | mkdir -p $PREFIX/lib 9 | cp -v *${SHLIB_EXT} $PREFIX/lib/ 10 | cp -v test_link $PREFIX/bin/test_link 11 | 12 | # check for before/after comparison 13 | otool -L $PREFIX/lib/libabsolute.dylib $PREFIX/lib/librelative.dylib $PREFIX/bin/test_link 14 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test_pure_rename.patch: -------------------------------------------------------------------------------- 1 | diff --git a/tinygrad/frontend/__init__.py b/tinygrad/frontend/__init__.py 2 | deleted file mode 100644 3 | index 9d2492e..0000000 4 | --- a/tinygrad/frontend/__init__.py 5 | +++ /dev/null 6 | @@ -1 +0,0 @@ 7 | -# frontend init 8 | diff --git a/tinygrad/frontend/onnx.py b/tinygrad/nn/onnx.py 9 | similarity index 100% 10 | rename from tinygrad/frontend/onnx.py 11 | rename to tinygrad/nn/onnx.py 12 | diff --git a/tinygrad/frontend/torch.py b/tinygrad/nn/torch.py 13 | similarity index 100% 14 | rename from tinygrad/frontend/torch.py 15 | rename to tinygrad/nn/torch.py 16 | -------------------------------------------------------------------------------- /test-data/recipes/prefix_detection/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: prefix_detection 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | - if: unix 9 | then: 10 | - python $RECIPE_DIR/create_files_with_prefix.py 11 | - if: win 12 | then: 13 | - python %RECIPE_DIR%\create_files_with_prefix.py 14 | prefix_detection: 15 | ignore: 16 | - ignore/* # ignore all files in this directory 17 | force_file_type: 18 | binary: 19 | - force_binary/* 20 | text: 21 | - force_text/* 22 | 23 | requirements: 24 | host: 25 | - python 3.11.* 26 | -------------------------------------------------------------------------------- /examples/curl/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get an updated config.sub and config.guess 4 | cp $BUILD_PREFIX/share/libtool/build-aux/config.* . 5 | 6 | if [[ $target_platform =~ linux.* ]]; then 7 | USESSL="--with-openssl=${PREFIX}" 8 | else 9 | USESSL="--with-secure-transport" 10 | fi; 11 | 12 | ./configure \ 13 | --prefix=${PREFIX} \ 14 | --host=${HOST} \ 15 | ${USESSL} \ 16 | --with-ca-bundle=${PREFIX}/ssl/cacert.pem \ 17 | --disable-static --enable-shared 18 | 19 | make -j${CPU_COUNT} ${VERBOSE_AT} 20 | make install 21 | 22 | # Includes man pages and other miscellaneous. 23 | rm -rf "${PREFIX}/share" 24 | -------------------------------------------------------------------------------- /test-data/recipes/cache_run_exports/recipe_test_1.yaml: -------------------------------------------------------------------------------- 1 | cache: 2 | requirements: 3 | host: 4 | - normal-run-exports 5 | 6 | outputs: 7 | - package: 8 | name: cache-run-exports 9 | version: "1.0.0" 10 | - package: 11 | name: no-cache-from-package-run-exports 12 | version: "1.0.0" 13 | requirements: 14 | ignore_run_exports: 15 | from_package: 16 | - normal-run-exports 17 | - package: 18 | name: no-cache-by-name-run-exports 19 | version: "1.0.0" 20 | requirements: 21 | ignore_run_exports: 22 | by_name: 23 | - normal-run-exports 24 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/test_strip_level_edge_case.patch: -------------------------------------------------------------------------------- 1 | --- a/b/c/d/deep/nested/directory/deep_file.txt.orig 2021-12-27 12:22:09.000000000 -0800 2 | +++ a/b/c/d/deep/nested/directory/deep_file.txt 2021-12-27 12:22:14.000000000 -0800 3 | @@ -1,3 +1,4 @@ 4 | This is a deep nested file. 5 | It should be patchable with various strip levels. 6 | +Strip level test applied! 7 | Original content here. 8 | --- a/b/c/d/nonexistent_deep.txt.orig 2021-12-27 12:22:09.000000000 -0800 9 | +++ a/b/c/d/nonexistent_deep.txt 2021-12-27 12:22:14.000000000 -0800 10 | @@ -0,0 +1,2 @@ 11 | +This file doesn't exist. 12 | +Should not affect strip level detection. -------------------------------------------------------------------------------- /test-data/recipes/interpreter-detection/recipe.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: test-interpreter-all 3 | version: 0.1.0 4 | 5 | outputs: 6 | - package: 7 | name: test-interpreter-all 8 | version: 0.1.0 9 | 10 | tests: 11 | - script: py/build.py 12 | requirements: 13 | build: 14 | - python 15 | - script: pl/build.pl 16 | requirements: 17 | build: 18 | - perl 19 | - script: r/build.r 20 | requirements: 21 | build: 22 | - r 23 | - script: nu/build.nu 24 | requirements: 25 | build: 26 | - nushell 27 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Issues 2 | 3 | We take security bugs in our projects seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions. 4 | 5 | To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/prefix-dev/rattler-build/security/advisories/new) tab. 6 | 7 | We will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance. 8 | -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__about__test__invalid_license.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/about.rs 3 | expression: err 4 | --- 5 | × Failed to parse recipe 6 | 7 | Error: 8 | × failed to parse SPDX license: 'MIT/X derivate', because: invalid 9 | │ character(s) 10 | │ See for the list of valid licenses. 11 | │ Use 'LicenseRef-' if you are using a custom license. 12 | ╭─[7:22] 13 | 6 │ about: 14 | 7 │ license: MIT/X derivate 15 | · ───────┬────── 16 | · ╰── here 17 | 8 │ 18 | ╰──── 19 | -------------------------------------------------------------------------------- /test-data/recipes/git_source_submodule/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: nanobind 3 | version: "1.9.1" 4 | 5 | source: 6 | git: https://github.com/wjakob/nanobind/ 7 | tag: v1.9.1 8 | 9 | build: 10 | number: 0 11 | # make noarch so that we can run the test on any platform 12 | noarch: generic 13 | script: | 14 | # test that the tag is checked out to hash 8e1f8408b37d994fb987440859eb977af39be8c3 15 | test "$(git rev-parse HEAD)" = "8e1f8408b37d994fb987440859eb977af39be8c3" 16 | # check that ext/robin_map is checked out to 68ff732 17 | cd ext/robin_map 18 | test "$(git rev-parse HEAD)" = "68ff7325b3898fca267a103bad5c509e8861144d" 19 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/map_jinja_null_values.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: zlib 3 | version: 0.1.0 4 | 5 | build: 6 | # should be filtered 7 | number: ${{ 2 if false }} 8 | string: ${{ "bs" if false }} 9 | script: 10 | - ${{ "echo 'hello'" if false }} 11 | - ${{ "echo 'world'" if true }} 12 | prefix_detection: 13 | force_file_type: 14 | text: ~ 15 | binary: 16 | - ${{ "remove" if false }} 17 | - ${{ "zlib" if true }} 18 | noarch: ${{ "python" if false }} 19 | dynamic_linking: ~ 20 | 21 | requirements: 22 | run: 23 | - ${{ "zlib" if true }} 24 | # should be filtered 25 | - ${{ "remove" if false }} 26 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, it is always a good idea to first 4 | discuss the change you wish to make via issue, email, or any other method with 5 | the owners of this repository before making a change. 6 | 7 | We welcome all kinds of contribution -- code or non-code -- and value them 8 | highly. We pledge to treat everyones contribution fairly and with respect and 9 | we are here to help awesome pull requests over the finish line. 10 | 11 | Please note we have a code of conduct, and follow it in all your interactions with the project. 12 | 13 | We follow the [NumFOCUS code of conduct](https://numfocus.org/code-of-conduct). 14 | -------------------------------------------------------------------------------- /test-data/recipes/read_only_build_files/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: read-only-build-files 3 | version: 0.1.0 4 | 5 | build: 6 | script: | 7 | # create some readonly files in the current directory incl. a read-only directory with files 8 | mkdir -p ./read-only-cache/read-only-dir 9 | touch read-only-cache/read-only-file 10 | touch read-only-cache/read-only-dir/read-only-file 11 | 12 | chmod 444 ./read-only-cache/read-only-file 13 | chmod 444 ./read-only-cache/read-only-dir/read-only-file 14 | chmod 555 ./read-only-cache/read-only-dir 15 | 16 | ls -al 17 | ls -al ./read-only-cache 18 | ls -al ./read-only-cache/read-only-dir 19 | -------------------------------------------------------------------------------- /test-data/recipes/line-breaks/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-cr 3 | version: 0.0.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | content: 9 | - if: win 10 | then: | 11 | powershell -Command "$count=1; while($count -le 10) { Write-Host -NoNewline ([char]13); Write-Host -NoNewline ('line ' + $count); Start-Sleep -Milliseconds 100; $count++ }; Write-Host ([char]10 + 'done')" 12 | - if: unix 13 | then: | 14 | #!/usr/bin/env bash 15 | set +x 16 | set -eu 17 | for i in {1..10}; do 18 | echo -ne "\rline ${i}" 19 | sleep 0.1 20 | done 21 | echo -e "\ndone" 22 | -------------------------------------------------------------------------------- /test-data/recipes/python_compilation/recipe.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | 4 | prefix = Path(os.environ["PREFIX"]) 5 | 6 | py_content = "print('Hello, world!')" 7 | py_file = prefix / "test.py" 8 | 9 | py_file.write_text(py_content) 10 | 11 | py_skippy = prefix / "test_skippy.py" 12 | py_skippy.write_text(py_content) 13 | 14 | new_folder = prefix / "cmd" 15 | new_folder.mkdir(exist_ok=True) 16 | 17 | py_file = prefix / "cmd" / "test.py" 18 | py_file.write_text(py_content) 19 | 20 | py_broken = prefix / "broken.py" 21 | py_broken.write_text("print('Hello, world!'") 22 | 23 | adding_pyc_file = prefix / "just_a_.cpython-311.pyc" 24 | adding_pyc_file.write_text("") 25 | -------------------------------------------------------------------------------- /test-data/recipes/tar-source/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: polarify 3 | version: 0.1.3 4 | 5 | package: 6 | name: ${{ name }} 7 | version: ${{ version }} 8 | 9 | source: 10 | - url: https://github.com/quantco/polarify/archive/refs/tags/v${{ version }}.tar.gz 11 | sha256: 93441164c23b764d72c8a66d14b11d5bbd353ed6112ccf3b35efda2a98f9df02 12 | - url: https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.8.0/jna-5.8.0.jar 13 | sha256: 930273cc1c492f25661ea62413a6da3fd7f6e01bf1c4dcc0817fc8696a7b07ac 14 | 15 | build: 16 | script: 17 | - if: unix 18 | then: 19 | - test -f jna-5.8.0.jar 20 | else: 21 | - if not exist jna-5.8.0.jar exit 1 22 | -------------------------------------------------------------------------------- /test-data/recipes/overlinking/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: "0.1.0" 3 | 4 | package: 5 | name: zlink 6 | version: ${{ version }} 7 | 8 | source: 9 | path: ../../../examples/linking/zlink/ 10 | 11 | build: 12 | script: 13 | - mkdir -p build 14 | - cd build 15 | - cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=$PREFIX -DZLIB_ROOT=$BUILD_PREFIX 16 | - ninja install 17 | dynamic_linking: 18 | overdepending_behavior: ignore 19 | overlinking_behavior: error 20 | 21 | requirements: 22 | build: 23 | - ${{ compiler('c') }} 24 | - ninja 25 | - cmake 26 | - zlib 27 | 28 | tests: 29 | - script: 30 | - zlink 31 | - ldd $PREFIX/bin/zlink 32 | -------------------------------------------------------------------------------- /src/consts.rs: -------------------------------------------------------------------------------- 1 | /// A `recipe.yaml` file might be accompanied by a `variants.yaml` file from 2 | /// which we can read variant configuration for that specific recipe.. 3 | pub const VARIANTS_CONFIG_FILE: &str = "variants.yaml"; 4 | 5 | /// The name of the old-style configuration file (`conda_build_config.yaml`). 6 | pub const CONDA_BUILD_CONFIG_FILE: &str = "conda_build_config.yaml"; 7 | 8 | /// This env var is set to "true" when run inside a github actions runner 9 | pub const GITHUB_ACTIONS: &str = "GITHUB_ACTIONS"; 10 | 11 | // This env var determines whether GitHub integration is enabled 12 | pub const RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: &str = "RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION"; 13 | -------------------------------------------------------------------------------- /test-data/recipes/symlink_test/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: symlink-test 3 | version: "1.0.0" 4 | 5 | package: 6 | name: ${{ name }} 7 | version: ${{ version }} 8 | 9 | build: 10 | number: 0 11 | script: 12 | - mkdir -p $PREFIX/bin 13 | - echo '#!/bin/bash' > $PREFIX/bin/real_script 14 | - echo 'echo "Hello from real script"' >> $PREFIX/bin/real_script 15 | - chmod +x $PREFIX/bin/real_script 16 | - ln -s real_script $PREFIX/bin/symlink_script 17 | - ln -s real_script $PREFIX/bin/another_symlink 18 | - ls -la $PREFIX/bin/ 19 | 20 | about: 21 | summary: Test package with symlinks 22 | description: This package contains symlinks to test symlink handling 23 | -------------------------------------------------------------------------------- /examples/bitfurnace/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: bitfurnace 3 | version: 0.1.0 4 | 5 | package: 6 | name: ${{ name|lower }} 7 | version: ${{ version }} 8 | 9 | source: 10 | git: https://github.com/mamba-org/bitfurnace 11 | 12 | build: 13 | number: 0 14 | noarch: python 15 | script: pip install . 16 | 17 | requirements: 18 | host: 19 | - python 20 | - pip 21 | 22 | about: 23 | homepage: https://github.com/mamba-org/bitfurnace 24 | license: BSD-3-Clause 25 | license_file: LICENSE 26 | summary: Cross platform build helpers for conda-forge 27 | repository: https://github.com/mamba-org/bitfurnace 28 | 29 | extra: 30 | recipe-maintainers: 31 | - some-maintainer 32 | -------------------------------------------------------------------------------- /test-data/recipes/spaces-in-paths/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: spaces-in-paths 3 | version: 1.0.0 4 | 5 | package: 6 | name: spaces-in-paths 7 | version: "1.0.0" 8 | 9 | build: 10 | script: 11 | - if: unix 12 | then: | 13 | echo "This is a test with spaces in paths" > "$PREFIX/test.txt" 14 | mkdir -p "$PREFIX/dir with spaces" 15 | echo "This file is in a directory with spaces" > "$PREFIX/dir with spaces/file.txt" 16 | - if: win 17 | then: | 18 | echo "This is a test with spaces in paths" > "%PREFIX%\test.txt" 19 | mkdir "%PREFIX%\dir with spaces" 20 | (echo This file is in a directory with spaces) > "%PREFIX%\dir with spaces\file.txt" 21 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__metadata__test__resolved_dependencies_rendering.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/metadata.rs 3 | expression: resolved_dependencies 4 | --- 5 | specs: 6 | - source: python 3.12.* h12332 7 | resolved: 8 | - arch: x86_64 9 | build: h123 10 | build_number: 0 11 | depends: [] 12 | license: MIT 13 | md5: 68b329da9893e34099c7d8ad5cb9c940 14 | name: test 15 | platform: linux 16 | sha256: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 17 | size: 123123 18 | subdir: linux-64 19 | timestamp: 123123000 20 | version: 1.2.3 21 | fn: test-1.2.3-h123.tar.bz2 22 | url: "https://test.com/test/linux-64/test-1.2.3-h123.tar.bz2" 23 | channel: test 24 | -------------------------------------------------------------------------------- /test-data/recipes/symlink/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: symlink 3 | version: 0.1.0 4 | 5 | package: 6 | name: ${{ name|lower }} 7 | version: ${{ version }} 8 | 9 | build: 10 | number: 0 11 | always_include_files: 12 | - lib/empty-folder 13 | 14 | script: | 15 | mkdir -p ${PREFIX}/lib/symlink 16 | mkdir -p ${PREFIX}/bin 17 | echo "test" > ${PREFIX}/lib/symlink/symlink-target 18 | 19 | ln -s ${PREFIX}/lib/symlink/symlink-target ${PREFIX}/bin/symlink 20 | 21 | ln -s ${PREFIX}/broken ${PREFIX}/bin/broken 22 | 23 | ln -s ${PREFIX}/lib/ $PREFIX/bin/symlink-to-lib 24 | 25 | # note: we currently don't expect empty folders in the output! 26 | mkdir -p ${PREFIX}/lib/empty-folder 27 | -------------------------------------------------------------------------------- /test-data/recipes/spaces-in-paths/recipe-with-quotes.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: spaces-in-paths-quotes 3 | version: 1.0.0 4 | 5 | package: 6 | name: spaces-in-paths-quotes 7 | version: "1.0.0" 8 | 9 | build: 10 | script: 11 | - if: unix 12 | then: | 13 | echo "This is a test with spaces in paths" > "$PREFIX/test.txt" 14 | mkdir "$PREFIX/dir with spaces" 15 | echo "This file is in a directory with spaces" > "$PREFIX/dir with spaces/file.txt" 16 | - if: win 17 | then: | 18 | echo "This is a test with spaces in paths" > "%PREFIX%\test.txt" 19 | mkdir "%PREFIX%\dir with spaces" 20 | (echo This file is in a directory with spaces) > "%PREFIX%\dir with spaces\file.txt" 21 | -------------------------------------------------------------------------------- /test-data/recipes/toml/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: toml 3 | version: 0.10.2 4 | 5 | package: 6 | name: "${{ name|lower }}" 7 | version: "${{ version }}" 8 | 9 | source: 10 | url: https://pypi.io/packages/source/${{ name[0] }}/${{ name }}/${{ name }}-${{ version }}.tar.gz 11 | sha256: b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f 12 | 13 | build: 14 | noarch: python 15 | script: python -m pip install . -vv 16 | 17 | requirements: 18 | host: 19 | - python 3.12.1.* 20 | - pip 23.3.2.* 21 | - setuptools 68.* 22 | run: 23 | - python 24 | 25 | about: 26 | homepage: https://github.com/uiri/toml 27 | license: MIT 28 | license_file: LICENSE 29 | summary: Python lib for TOML. 30 | -------------------------------------------------------------------------------- /test-data/recipes/allow_missing_dso/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: "0.1.0" 3 | 4 | package: 5 | name: zlink 6 | version: ${{ version }} 7 | 8 | source: 9 | path: ../../../examples/linking/zlink/ 10 | 11 | build: 12 | script: 13 | - mkdir -p build 14 | - cd build 15 | - cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=$PREFIX -DZLIB_ROOT=$BUILD_PREFIX 16 | - ninja install 17 | dynamic_linking: 18 | overdepending_behavior: ignore 19 | overlinking_behavior: error 20 | missing_dso_allowlist: ["libz*", "libc*"] 21 | 22 | requirements: 23 | build: 24 | - ${{ compiler('c') }} 25 | - ninja 26 | - cmake 27 | - zlib 28 | 29 | tests: 30 | - script: 31 | - zlink 32 | - ldd $PREFIX/bin/zlink 33 | -------------------------------------------------------------------------------- /test-data/recipes/variants/boltons_recipe.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json 2 | 3 | context: 4 | version: "23.0.0" 5 | 6 | package: 7 | name: "boltons" 8 | version: ${{ version }} 9 | 10 | source: 11 | url: https://github.com/mahmoud/boltons/archive/refs/tags/${{ version }}.tar.gz 12 | sha256: 9b2998cd9525ed472079c7dd90fbd216a887202e8729d5969d4f33878f0ff668 13 | 14 | build: 15 | noarch: python 16 | script: 17 | - python -m pip install . -vv 18 | 19 | requirements: 20 | host: 21 | - python 22 | - pip 23 | - setuptools 24 | run: 25 | - pip 26 | - python 27 | 28 | about: 29 | license: BSD-3-Clause 30 | license_file: LICENSE 31 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_filter_files.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": [ 3 | { 4 | "_path": ".github/foo", 5 | "path_type": "hardlink", 6 | "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 7 | "size_in_bytes": 0 8 | }, 9 | { 10 | "_path": ".gitignore", 11 | "path_type": "hardlink", 12 | "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 13 | "size_in_bytes": 0 14 | }, 15 | { 16 | "_path": "exists.txt", 17 | "path_type": "hardlink", 18 | "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 19 | "size_in_bytes": 0 20 | } 21 | ], 22 | "paths_version": 1 23 | } 24 | -------------------------------------------------------------------------------- /py-rattler-build/tests/data/recipes/dummy/recipe.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: dummy 3 | version: 1.0.0 4 | 5 | outputs: 6 | - package: 7 | name: dummy-x 8 | version: 0.1.0 9 | 10 | build: 11 | script: 12 | - if: win 13 | then: 14 | - if not exist "%PREFIX%\bin" mkdir "%PREFIX%\bin" 15 | - echo @echo dummy-x on windows > %PREFIX%\bin\dummy-x.bat 16 | else: 17 | - mkdir -p $PREFIX/bin 18 | - echo "echo dummy-x on unix" > $PREFIX/bin/dummy-x 19 | - chmod +x $PREFIX/bin/dummy-x 20 | tests: 21 | - script: 22 | - if: win 23 | then: 24 | - dummy-x.bat 25 | else: 26 | - dummy-x 27 | -------------------------------------------------------------------------------- /tbump.toml: -------------------------------------------------------------------------------- 1 | github_url = "https://github.com/prefix-dev/rattler-build" 2 | 3 | [version] 4 | current = "0.55.0" 5 | 6 | # Example of a semver regexp. 7 | # Make sure this matches current_version before 8 | # using tbump 9 | regex = ''' 10 | (?P\d+) 11 | \. 12 | (?P\d+) 13 | \. 14 | (?P\d+) 15 | (rc 16 | (?P\d+) 17 | )? 18 | ''' 19 | 20 | [git] 21 | # The current version will get updated when tbump is run 22 | message_template = "Bump version: {new_version}" 23 | tag_template = "v{new_version}" 24 | 25 | 26 | [[file]] 27 | search = '^version = "{current_version}"' 28 | src = "Cargo.toml" 29 | 30 | 31 | [[file]] 32 | search = '^version = "{current_version}"' 33 | src = "py-rattler-build/Cargo.toml" 34 | -------------------------------------------------------------------------------- /test-data/recipes/overdepending/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: "0.1.0" 3 | 4 | package: 5 | name: zlink 6 | version: ${{ version }} 7 | 8 | source: 9 | path: ../../../examples/linking/zlink/ 10 | 11 | build: 12 | script: 13 | - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS} 14 | - cmake --build build --config Release 15 | - cmake --install build --prefix ${PREFIX} 16 | dynamic_linking: 17 | overdepending_behavior: error 18 | overlinking_behavior: ignore 19 | 20 | requirements: 21 | build: 22 | - ${{ compiler('c') }} 23 | - ninja 24 | - cmake 25 | host: 26 | - zlib 27 | run: 28 | - yaml 29 | 30 | tests: 31 | - script: 32 | - zlink 33 | - ldd $PREFIX/bin/zlink 34 | -------------------------------------------------------------------------------- /crates/rattler_build_allocator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rattler_build_allocator" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | description = "A crate that provides the best memory allocator for different platforms" 9 | 10 | [lib] 11 | doctest = false 12 | 13 | # Use mimalloc on Windows 14 | [target.'cfg(windows)'.dependencies] 15 | mimalloc = "0.1.48" 16 | 17 | # Use jemalloc on supported unix platforms (excluding OpenBSD and FreeBSD) 18 | [target.'cfg(all(not(windows), not(target_os = "openbsd"), not(target_os = "freebsd"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64")))'.dependencies] 19 | tikv-jemallocator = "0.6.1" 20 | -------------------------------------------------------------------------------- /test-data/recipes/cache/recipe-compiler.yaml: -------------------------------------------------------------------------------- 1 | # test for issue https://github.com/prefix-dev/rattler-build/issues/1290 2 | recipe: 3 | name: foo 4 | version: 0.1.0 5 | 6 | cache: 7 | build: 8 | script: 9 | - mkdir -p $PREFIX/lib 10 | - mkdir -p $PREFIX/include 11 | - touch $PREFIX/include/test.h 12 | - touch $PREFIX/lib/libdav1d.so.7.0.0 13 | - ln -s $PREFIX/lib/libdav1d.so.7.0.0 $PREFIX/lib/libdav1d.so.7 14 | - ln -s $PREFIX/lib/libdav1d.so.7 $PREFIX/lib/libdav1d.so 15 | 16 | requirements: 17 | build: 18 | - ${{ compiler('c') }} 19 | 20 | outputs: 21 | - package: 22 | name: testlib-so-version 23 | version: 2.1.4 24 | 25 | build: 26 | files: 27 | include: 28 | - lib/*.so.* 29 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_recipe_variant_render.1.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | [ 4 | { 5 | "spec": "python 3.8.*", 6 | "variant": "python" 7 | } 8 | ], 9 | { 10 | "constraints": [], 11 | "depends": [ 12 | { 13 | "source": "python" 14 | }, 15 | { 16 | "source": "__unix" 17 | } 18 | ] 19 | } 20 | ], 21 | [ 22 | [ 23 | { 24 | "spec": "python 3.9.*", 25 | "variant": "python" 26 | } 27 | ], 28 | { 29 | "constraints": [], 30 | "depends": [ 31 | { 32 | "source": "python" 33 | }, 34 | { 35 | "source": "__unix" 36 | } 37 | ] 38 | } 39 | ] 40 | ] 41 | -------------------------------------------------------------------------------- /test-data/recipes/downstream_test/fail_prelim.yaml: -------------------------------------------------------------------------------- 1 | outputs: 2 | - package: 3 | name: upstream-fail 4 | version: 1.0.0 5 | 6 | - package: 7 | name: downstream-fail 8 | version: 1.0.0 9 | 10 | requirements: 11 | host: 12 | - upstream-fail 13 | run: 14 | - upstream-fail 15 | 16 | tests: 17 | - script: 18 | - if: unix 19 | then: 20 | - if [ -f "$PREFIX/fail.txt" ]; then 21 | echo "Failing test in downstream package"; 22 | exit 1; 23 | fi 24 | - if: win 25 | then: 26 | - if exist "%PREFIX%\\fail.txt" ( 27 | echo "Failing test in downstream package" && exit /b 1 28 | ) 29 | -------------------------------------------------------------------------------- /test-data/recipes/git_source/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: "git_source" 3 | version: "1" 4 | 5 | source: 6 | - git: https://github.com/prefix-dev/rattler-build 7 | tag: v0.1.0 8 | - git: https://github.com/wolfv/rattler-build 9 | branch: main 10 | target_directory: main 11 | - git: https://github.com/prefix-dev/rattler-build 12 | target_directory: HEAD 13 | - git: https://github.com/prefix-dev/rattler-build 14 | rev: df83c1edf287a756b8fc995e03e9632af0344777 15 | target_directory: initial_version 16 | - git: git@github.com:prefix-dev/rattler-build.git 17 | # - git: https://github.com/tensorflow/tensorflow 18 | # target_directory: tensorflow 19 | 20 | build: 21 | script: 22 | - test -f README.md 23 | - cat ./initial_version/build.sh 24 | -------------------------------------------------------------------------------- /test-data/patch_application/patches/0001-increase-minimum-cmake-version.patch: -------------------------------------------------------------------------------- 1 | From 7203acd80d048de1b13fdff813e69a0a4621396b Mon Sep 17 00:00:00 2001 2 | From: Bas Zalmstra 3 | Date: Wed, 30 Apr 2025 14:03:16 +0200 4 | Subject: [PATCH 1/5] increase minimum cmake version 5 | 6 | --- 7 | CMakeLists.txt | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/CMakeLists.txt b/CMakeLists.txt 11 | index dfb44de9..cf37bde7 100644 12 | --- a/CMakeLists.txt 13 | +++ b/CMakeLists.txt 14 | @@ -23,7 +23,7 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) 15 | message(FATAL_ERROR "Prevented in-tree build.") 16 | endif() 17 | 18 | -cmake_minimum_required(VERSION 3.1) 19 | +cmake_minimum_required(VERSION 3.12) 20 | 21 | project(love) 22 | -------------------------------------------------------------------------------- /test-data/recipes/test-relink/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | c_compiler: clang 3 | c_compiler_version: "19" 4 | 5 | package: 6 | name: test-relink 7 | version: 0.0.0 8 | 9 | build: 10 | number: 0 11 | 12 | requirements: 13 | build: 14 | - ${{ compiler('c') }} 15 | tests: 16 | - script: 17 | - otool -L $PREFIX/lib/libabsolute.dylib $PREFIX/lib/librelative.dylib $PREFIX/bin/test_link 18 | # verify that links are rewritten with @rpath 19 | - otool -L $PREFIX/lib/libabsolute.dylib | grep @rpath/libabsolute.dylib 20 | - otool -L $PREFIX/lib/librelative.dylib | grep @rpath/librelative.dylib 21 | - otool -L $PREFIX/bin/test_link | grep @rpath/libabsolute.dylib 22 | - otool -L $PREFIX/bin/test_link | grep @rpath/librelative.dylib 23 | - test_link 24 | -------------------------------------------------------------------------------- /test-data/recipes/url-source-with-ignore/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-url-source-ignore 3 | version: 1.0.0 4 | 5 | source: 6 | url: https://github.com/zed-industries/zed/archive/6f918ed99bfa107d496f7e6a7101a956494f3153.tar.gz 7 | sha256: 8d9598aa5a7da38661f3968eaf8094a93cd7ae019b2750181c8da14ba13e7c07 8 | 9 | build: 10 | script: 11 | - if: unix 12 | then: 13 | - test -f tooling/workspace-hack/Cargo.toml || (echo "FAIL: Cargo.toml was ignored!" && exit 1) 14 | - echo "SUCCESS: Cargo.toml was not ignored" 15 | else: 16 | - if not exist tooling\workspace-hack\Cargo.toml (echo FAIL: Cargo.toml was ignored! && exit 1) 17 | - echo SUCCESS: Cargo.toml was not ignored 18 | 19 | about: 20 | summary: Test that .ignore files don't affect URL sources 21 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_tests.ambr: -------------------------------------------------------------------------------- 1 | # serializer version: 1 2 | # name: test_perl_tests 3 | ''' 4 | - perl: 5 | uses: 6 | - Call::Context 7 | 8 | ''' 9 | # --- 10 | # name: test_r_tests 11 | ''' 12 | - r: 13 | libraries: 14 | - ggplot2 15 | 16 | ''' 17 | # --- 18 | # name: test_win_errorlevel_injection 19 | ''' 20 | - script: 21 | content: |- 22 | echo "This test is designed to fail." 23 | if %errorlevel% neq 0 exit /b %errorlevel% 24 | python.exe -c "import sys; sys.exit(1)" 25 | if %errorlevel% neq 0 exit /b %errorlevel% 26 | echo "This line will not be executed." 27 | if %errorlevel% neq 0 exit /b %errorlevel% 28 | requirements: 29 | run: 30 | - python 31 | 32 | ''' 33 | # --- 34 | -------------------------------------------------------------------------------- /test-data/recipes/test-parsing/recipe_outputs_merging.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 1234 7 | 8 | outputs: 9 | - package: 10 | name: testlib 11 | build: 12 | number: 0 13 | requirements: 14 | host: 15 | - bla 16 | - package: 17 | name: superlib 18 | version: 0.10.0 19 | build: 20 | script: 21 | - test 1234 22 | requirements: 23 | host: 24 | - abc 25 | 26 | about: 27 | homepage: http://www.example.com 28 | license: BSD-3-Clause 29 | license_file: LICENSE 30 | summary: blabla 31 | description: long blabla 32 | documentation: http://docs.example.com 33 | repository: https://github.com/example/test 34 | 35 | extra: 36 | recipe-maintainers: 37 | - some-maintainer 38 | -------------------------------------------------------------------------------- /src/post_process/regex_replacements.rs: -------------------------------------------------------------------------------- 1 | //! A post process step that runs a regex replacement over the new files 2 | use crate::{metadata::Output, packaging::TempFiles}; 3 | use fs_err as fs; 4 | 5 | pub fn regex_post_process(temp_files: &TempFiles, output: &Output) -> Result<(), std::io::Error> { 6 | for post_process_step in output.recipe.build().post_process().iter() { 7 | for file in temp_files.files.iter() { 8 | if post_process_step.files.is_match(file) { 9 | let file_contents = fs::read_to_string(file)?; 10 | let new_contents = post_process_step 11 | .regex 12 | .replace_all(&file_contents, &post_process_step.replacement); 13 | fs::write(file, new_contents.as_bytes())?; 14 | } 15 | } 16 | } 17 | 18 | Ok(()) 19 | } 20 | -------------------------------------------------------------------------------- /test-data/recipes/sourceforge-redirects/recipe.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json 2 | context: 3 | version: "0.0.1" 4 | 5 | package: 6 | name: sourceforge-redirect-test 7 | version: ${{ version }} 8 | 9 | source: 10 | # This URL requires 3 redirects across different hosts to reach the final file: 11 | # 1. sourceforge.net -> sourceforge.net/download 12 | # 2. sourceforge.net/download -> downloads.sourceforge.net?ts=... 13 | # 3. downloads.sourceforge.net -> [mirror].dl.sourceforge.net 14 | url: https://sourceforge.net/projects/arma/files/armadillo-15.2.1.tar.xz 15 | sha256: a5b8109da3c169802f51a14d3bd1246395c24bbca55601760b0c96a3c0b2f8fa 16 | 17 | build: 18 | number: 0 19 | script: 20 | - echo "Successfully downloaded from SourceForge with cross-host redirects" 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "cargo" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | time: "04:00" # UTC 8 | labels: 9 | - "dependencies" 10 | commit-message: 11 | prefix: "bump" 12 | open-pull-requests-limit: 10 13 | ignore: 14 | - dependency-name: "rattler*" 15 | groups: 16 | cargo-dependencies: 17 | patterns: 18 | - "*" 19 | - package-ecosystem: "github-actions" 20 | directory: "/" 21 | schedule: 22 | interval: "weekly" 23 | labels: 24 | - "dependencies" 25 | commit-message: 26 | prefix: "chore(ci)" 27 | ignore: 28 | - dependency-name: "crate-ci/typos" 29 | update-types: ["version-update:semver-patch"] 30 | groups: 31 | github-actions: 32 | patterns: 33 | - "*" 34 | -------------------------------------------------------------------------------- /examples/linking/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: "0.1.0" 3 | 4 | package: 5 | name: zlink 6 | version: ${{ version }} 7 | 8 | source: 9 | path: ./zlink 10 | 11 | build: 12 | script: 13 | - if: win 14 | then: 15 | - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release %CMAKE_ARGS% 16 | - if: unix 17 | then: 18 | - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS} 19 | - cmake --build build --config Release 20 | - cmake --install build 21 | 22 | requirements: 23 | build: 24 | - ${{ compiler('c') }} 25 | - ninja 26 | - cmake 27 | host: 28 | - zlib 29 | 30 | tests: 31 | - script: 32 | - if: linux 33 | then: 34 | - zlink 35 | - ldd $PREFIX/bin/zlink 36 | - if: osx 37 | then: 38 | - zlink 39 | - otool -L $PREFIX/bin/zlink 40 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # The NumFOCUS Code of Conduct 2 | 3 | ## THE SHORT VERSION 4 | 5 | Be kind to others. Do not insult or put down others. Behave professionally. Remember that harassment and sexist, racist, or exclusionary jokes are not appropriate for NumFOCUS. 6 | 7 | All communication should be appropriate for a professional audience including people of many different backgrounds. Sexual language and imagery is not appropriate. 8 | 9 | NumFOCUS is dedicated to providing a harassment-free community for everyone, regardless of gender, sexual orientation, gender identity and expression, disability, physical appearance, body size, race, or religion. We do not tolerate harassment of community members in any form. 10 | 11 | Thank you for helping make this a welcoming, friendly community for all. 12 | 13 | ## THE LONGER VERSION 14 | 15 | [Can be found here](https://numfocus.org/code-of-conduct). 16 | -------------------------------------------------------------------------------- /test-data/recipes/python_compilation/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: python_compilation 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | interpreter: python 9 | file: recipe.py 10 | 11 | python: 12 | skip_pyc_compilation: 13 | - test_skippy.py 14 | 15 | requirements: 16 | host: 17 | - python 3.11.* 18 | 19 | tests: 20 | - script: 21 | - if: unix 22 | then: 23 | - test -f $PREFIX/__pycache__/test.cpython-311.pyc 24 | - test -f $PREFIX/cmd/__pycache__/test.cpython-311.pyc 25 | - test ! -f $PREFIX/__pycache__/test_skippy.cpython-311.pyc 26 | - if: win 27 | then: 28 | - if not exist %PREFIX%\__pycache__\test.cpython-311.pyc exit 1 29 | - if not exist %PREFIX%\cmd\__pycache__\test.cpython-311.pyc exit 1 30 | - if exist %PREFIX%\__pycache__\test_skippy.cpython-311.pyc exit 1 31 | -------------------------------------------------------------------------------- /test-data/recipes/noarch_variant/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: rattler-build-demo 3 | version: 1 4 | build_variant: ${{ 'unix' if unix else 'win' }} 5 | build_number: 0 6 | 7 | outputs: 8 | - package: 9 | name: ${{ name }} 10 | version: ${{ version }} 11 | build: 12 | noarch: generic 13 | number: ${{ build_number }} 14 | string: ${{ build_variant }}_${{ hash }}_${{ build_number }} 15 | requirements: 16 | run: 17 | - ${{ "__unix" if unix }} 18 | - ${{ "__win >=11.0.123 foobar" if win }} 19 | 20 | - package: 21 | name: ${{ name }}-subpackage 22 | version: ${{ version }} 23 | build: 24 | noarch: generic 25 | number: ${{ build_number }} 26 | string: ${{ build_variant }}_${{ hash }}_${{ build_number }} 27 | requirements: 28 | run: 29 | - ${{ pin_subpackage('rattler-build-demo', exact=True) }} 30 | -------------------------------------------------------------------------------- /docs/automatic_linting.md: -------------------------------------------------------------------------------- 1 | # Automatic Linting in VSCode 2 | 3 | Our new recipe format adheres to a strict JSON schema, which you can access [on Github](https://github.com/prefix-dev/recipe-format). 4 | 5 | This schema is implemented using `pydantic` and can be rendered into a JSON schema file. The [YAML language server extension in VSCode](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) is capable of recognizing this schema, providing useful hints during the editing process. 6 | 7 | We have published the schema on [schemastore.org](https://www.schemastore.org/) which means, it will be automatically picked up when the file is called `recipe.yaml`. If you give your recipe files different names, you can use the following in the first line of your recipe to get schema hints: 8 | 9 | ```yaml 10 | # yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json 11 | ``` -------------------------------------------------------------------------------- /src/recipe/parser/snapshots/rattler_build__recipe__parser__test__test__script_parsing.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/recipe/parser/test.rs 3 | expression: yaml_serde 4 | --- 5 | - python: 6 | imports: 7 | - numpy.testing 8 | - numpy.matrix 9 | - script: echo "FOO" 10 | - script: 11 | interpreter: python 12 | content: | 13 | import numpy as np 14 | np.testing.assert_array_equal(np.array([1, 2, 3]), np.array([1, 2, 3])) 15 | - script: 16 | interpreter: bash 17 | env: 18 | FOO: BAR 19 | BAZ: QUX 20 | secrets: 21 | - ABC 22 | - DEF 23 | file: test.sh 24 | files: 25 | source: 26 | - foo/* 27 | recipe: 28 | - test/* 29 | - downstream: foo 30 | - downstream: bar 31 | - package_contents: 32 | files: 33 | - foo 34 | - bar 35 | - package_contents: 36 | lib: 37 | - libfoo.so 38 | - libbar.so 39 | include: 40 | - xtensor/xarray.hpp 41 | -------------------------------------------------------------------------------- /test-data/recipes/polarify/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: polarify 3 | version: "0.1.3" 4 | 5 | package: 6 | name: ${{ name | lower }} 7 | version: ${{ version }} 8 | 9 | source: 10 | url: https://pypi.io/packages/source/${{ name[0] }}/${{ name }}/polarify-${{ version }}.tar.gz 11 | sha256: a172a25c73936f23448d3d9a29bfbd578ac4e676962a78e546da8be86e14745d 12 | 13 | build: 14 | number: 3 15 | noarch: python 16 | script: 17 | - python -m pip install . -vv 18 | 19 | requirements: 20 | host: 21 | - python >=3.9 22 | - pip 23 | - hatchling 24 | run: 25 | - python >=3.9 26 | - polars >=0.14.24,<0.20 27 | 28 | about: 29 | homepage: https://github.com/quantco/polarify 30 | summary: Simplifying conditional Polars Expressions with Python 🐍 🐻‍❄️ 31 | license: BSD-3-Clause 32 | license_file: LICENSE 33 | 34 | extra: 35 | recipe-maintainers: 36 | - pavelzw 37 | - "0xbe7a" 38 | -------------------------------------------------------------------------------- /test-data/recipes/test-section/script-test.yaml: -------------------------------------------------------------------------------- 1 | tests: 2 | - python: 3 | imports: 4 | - numpy.testing 5 | - numpy.matrix 6 | - script: 7 | - echo "FOO" 8 | - script: 9 | interpreter: python 10 | content: | 11 | import numpy as np 12 | np.testing.assert_array_equal(np.array([1, 2, 3]), np.array([1, 2, 3])) 13 | - script: 14 | file: test.sh 15 | interpreter: bash 16 | env: 17 | FOO: BAR 18 | BAZ: QUX 19 | secrets: 20 | - ABC 21 | - DEF 22 | files: 23 | source: 24 | - foo/* 25 | recipe: 26 | - test/* 27 | - downstream: foo 28 | - downstream: bar 29 | - package_contents: 30 | files: 31 | exists: 32 | - foo 33 | - bar 34 | - package_contents: 35 | lib: 36 | - libfoo.so 37 | - libbar.so 38 | include: 39 | - xtensor/xarray.hpp 40 | -------------------------------------------------------------------------------- /docs/generator/generate-cli-docs.rs: -------------------------------------------------------------------------------- 1 | /// This is a separate binary not included in the main rattler-build binary. 2 | /// Used to generate the documentation for the rattler-build binary. 3 | 4 | #[cfg(feature = "generate-cli-docs")] 5 | fn main() { 6 | use clap_markdown::help_markdown; 7 | use rattler_build::opt::App; 8 | use rattler_conda_types::Platform; 9 | 10 | let help = help_markdown::(); 11 | 12 | let target_default_platform = format!("Default value: `{}`", Platform::current()); 13 | let help = help.replace( 14 | target_default_platform.as_str(), 15 | "Default value: current platform", 16 | ); 17 | 18 | print!("{}", help); 19 | } 20 | 21 | #[cfg(not(feature = "generate-cli-docs"))] 22 | fn main() { 23 | eprintln!("This binary is not enabled in the current build configuration."); 24 | eprintln!("To enable it, run `cargo build --features generate-cli-docs`."); 25 | std::process::exit(1); 26 | } 27 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_symlink_recipe.json: -------------------------------------------------------------------------------- 1 | { 2 | "paths": [ 3 | { 4 | "_path": "bin/broken", 5 | "path_type": "softlink", 6 | "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 7 | "size_in_bytes": 9 8 | }, 9 | { 10 | "_path": "bin/symlink", 11 | "path_type": "softlink", 12 | "sha256": "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2", 13 | "size_in_bytes": 29 14 | }, 15 | { 16 | "_path": "bin/symlink-to-lib", 17 | "path_type": "softlink", 18 | "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 19 | "size_in_bytes": 6 20 | }, 21 | { 22 | "_path": "lib/symlink/symlink-target", 23 | "path_type": "hardlink", 24 | "sha256": "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2", 25 | "size_in_bytes": 5 26 | } 27 | ], 28 | "paths_version": 1 29 | } 30 | -------------------------------------------------------------------------------- /test-data/recipes/package-content-tests/llama-recipe.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json 2 | 3 | context: 4 | name: llama.cpp 5 | version: b1513 6 | 7 | package: 8 | name: "${{ name|lower }}" 9 | version: "${{ version }}" 10 | 11 | source: 12 | git: https://github.com/ggerganov/llama.cpp.git 13 | tag: "${{ version }}" 14 | 15 | build: 16 | number: 0 17 | script: | 18 | cmake -S . -B build 19 | cmake --build build --config Release --parallel 20 | cmake --install build --prefix %LIBRARY_PREFIX% 21 | 22 | requirements: 23 | build: 24 | - ${{ compiler('c') }} 25 | - cmake 26 | - if: win 27 | then: ninja 28 | 29 | tests: 30 | - package_contents: 31 | bin: 32 | - main 33 | - quantize 34 | 35 | about: 36 | homepage: https://github.com/ggerganov/llama.cpp 37 | license: MIT 38 | license_file: LICENSE 39 | summary: Port of Facebook's LLaMA model in C/C++ 40 | -------------------------------------------------------------------------------- /test-data/recipes/variants/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: llama.cpp 3 | version: b1513 4 | 5 | package: 6 | name: "${{ name|lower }}" 7 | version: "${{ version }}" 8 | 9 | source: 10 | git: https://github.com/ggerganov/llama.cpp.git 11 | tag: "${{ version }}" 12 | 13 | build: 14 | variant: 15 | use_keys: 16 | - libblas 17 | ignore_keys: 18 | - libcblas 19 | number: 0 20 | script: | 21 | cmake -S . -B build 22 | cmake --build build --config Release --parallel 23 | cmake --install build --prefix %LIBRARY_PREFIX% 24 | 25 | requirements: 26 | build: 27 | - ${{ compiler('c') }} 28 | - cmake 29 | - libcblas 30 | - r-base 31 | - if: win 32 | then: ninja 33 | 34 | tests: 35 | - package_contents: 36 | bin: 37 | - main 38 | - quantize 39 | 40 | about: 41 | homepage: https://github.com/ggerganov/llama.cpp 42 | license: MIT 43 | license_file: LICENSE 44 | summary: Port of Facebook's LLaMA model in C/C++ 45 | -------------------------------------------------------------------------------- /examples/cargo-edit/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: "0.11.9" 3 | 4 | package: 5 | name: cargo-edit 6 | version: ${{ version }} 7 | 8 | source: 9 | url: https://github.com/killercup/cargo-edit/archive/refs/tags/v${{ version }}.tar.gz 10 | sha256: 46670295e2323fc2f826750cdcfb2692fbdbea87122fe530a07c50c8dba1d3d7 11 | 12 | build: 13 | script: 14 | - cargo-bundle-licenses --format yaml --output ${SRC_DIR}/THIRDPARTY.yml 15 | - $BUILD_PREFIX/bin/cargo install --locked --bins --root ${PREFIX} --path . 16 | 17 | requirements: 18 | build: 19 | - ${{ compiler('rust') }} 20 | - cargo-bundle-licenses 21 | 22 | tests: 23 | - script: 24 | - cargo-upgrade --help 25 | 26 | about: 27 | homepage: https://github.com/killercup/cargo-edit 28 | license: MIT 29 | license_file: 30 | - LICENSE 31 | - THIRDPARTY.yml 32 | description: "A utility for managing cargo dependencies from the command line." 33 | summary: "A utility for managing cargo dependencies from the command line." 34 | -------------------------------------------------------------------------------- /test-data/recipes/pe-malformed-windows/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pe-test 3 | version: "1.0.0" 4 | 5 | source: 6 | # No external source; build script will generate the malformed DLL 7 | path: . 8 | 9 | build: 10 | number: 0 11 | script: | 12 | rem Create a malformed PE file directly in the PREFIX Library\bin 13 | powershell -NoProfile -Command "${env:out} = Join-Path $env:PREFIX 'Library\bin\malformed.dll'; New-Item -Force -ItemType Directory (Split-Path ${env:out}) | Out-Null; $len = 0x10000 + 4 + 100; $bytes = New-Object byte[] ($len); $bytes[0] = 0x4D; $bytes[1] = 0x5A; $bytes[60] = 0x00; $bytes[61] = 0x00; $bytes[62] = 0x01; $bytes[63] = 0x00; $bytes[0x10000] = 0x46; $bytes[0x10000 + 1] = 0x41; $bytes[0x10000 + 2] = 0x4B; $bytes[0x10000 + 3] = 0x45; [System.IO.File]::WriteAllBytes(${env:out}, $bytes)" 14 | 15 | requirements: 16 | build: [] 17 | host: [] 18 | run: [] 19 | 20 | about: 21 | summary: Test package to validate relinker behavior with malformed PE files on Windows 22 | license: MIT 23 | -------------------------------------------------------------------------------- /test-data/recipes/perl-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: 0.03 3 | 4 | package: 5 | name: perl-call-context 6 | version: ${{ version }} 7 | 8 | source: 9 | url: https://cpan.metacpan.org/authors/id/F/FE/FELIPE/Call-Context-${{ version }}.tar.gz 10 | sha256: 0ee6bf46bc72755adb7a6b08e79d12e207de5f7809707b3c353b58cb2f0b5a26 11 | 12 | build: 13 | number: 0 14 | noarch: generic 15 | script: 16 | - perl Makefile.PL INSTALLDIRS=site NO_PERLLOCAL=1 NO_PACKLIST=1 17 | - make 18 | - make test 19 | - make install 20 | - echo "LICENSE-ARTISTIC" > LICENSE-ARTISTIC 21 | - echo "LICENSE-GPL" > LICENSE-GPL 22 | 23 | requirements: 24 | build: 25 | - make 26 | host: 27 | - perl 28 | 29 | tests: 30 | - perl: 31 | uses: 32 | - Call::Context 33 | 34 | about: 35 | license: GPL-1.0-or-later OR Artistic-1.0-Perl 36 | license_file: 37 | - LICENSE-ARTISTIC 38 | - LICENSE-GPL 39 | summary: Sanity-check calling context 40 | homepage: http://metacpan.org/pod/Call-Context 41 | -------------------------------------------------------------------------------- /src/post_process/menuinst.rs: -------------------------------------------------------------------------------- 1 | //! Check that we can parse any `Menu/*.json` files as valid `menuinst` files. 2 | 3 | use std::ffi::OsStr; 4 | 5 | use crate::packaging::{PackagingError, TempFiles}; 6 | use rattler_menuinst::schema::MenuInstSchema; 7 | 8 | /// Check that all `Menu/*.json` files are valid `menuinst` files. 9 | pub fn menuinst(temp_files: &TempFiles) -> Result<(), PackagingError> { 10 | // find all new files `Menu/*.json` 11 | for p in temp_files.files.iter() { 12 | let prefix_path = p.strip_prefix(temp_files.temp_dir.path()).unwrap(); 13 | if let Some(first) = prefix_path.components().next() 14 | && first.as_os_str() == "Menu" 15 | && prefix_path.extension() == Some(OsStr::new("json")) 16 | { 17 | let content = fs_err::read_to_string(p)?; 18 | let _menu: MenuInstSchema = serde_json::from_str(&content) 19 | .map_err(|e| PackagingError::InvalidMenuInstSchema(p.to_path_buf(), e))?; 20 | } 21 | } 22 | 23 | Ok(()) 24 | } 25 | -------------------------------------------------------------------------------- /test/end-to-end/__snapshots__/test_simple/test_jinja_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "boolean": true, 3 | "cboolean": true, 4 | "cfloat": "1.23", 5 | "cinteger": 5, 6 | "computed_int": 123, 7 | "cquoted": "5", 8 | "cquoted_bool": "true", 9 | "cstring": "blah", 10 | "ending_with": true, 11 | "float": "1.23", 12 | "inline_list": [ 13 | "a", 14 | "b", 15 | "c" 16 | ], 17 | "integer": 5, 18 | "is_boolean": true, 19 | "is_cboolean": true, 20 | "is_cfloat": false, 21 | "is_cinteger": true, 22 | "is_computed_int": true, 23 | "is_cquoted": true, 24 | "is_cstring": true, 25 | "is_float": false, 26 | "is_inline_list": true, 27 | "is_integer": true, 28 | "is_list": true, 29 | "is_list_elem": true, 30 | "is_quoted_int_var": true, 31 | "is_quoted_true": true, 32 | "is_quoted_true_var": true, 33 | "is_string": true, 34 | "list": [ 35 | "a", 36 | "b", 37 | "c" 38 | ], 39 | "not_ending_with": false, 40 | "not_starting_with": false, 41 | "starting_with": true, 42 | "string": "blah" 43 | } 44 | -------------------------------------------------------------------------------- /py-rattler-build/tests/data/recipes/test-package/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-package 3 | version: 1.0.0 4 | 5 | source: 6 | url: https://example.com/package.tar.gz 7 | sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 8 | 9 | build: 10 | number: 0 11 | script: | 12 | pip install . --no-deps -vv 13 | 14 | requirements: 15 | host: 16 | - python >=3.8 17 | - pip 18 | - if: win 19 | then: 20 | - vs2019_win-64 21 | - cmake 22 | else: 23 | - gcc_linux-64 24 | run: 25 | - python >=3.8 26 | - if: win 27 | then: 28 | - vs2019_runtime 29 | - if: osx 30 | then: 31 | - libcxx >=10 32 | 33 | about: 34 | summary: A comprehensive test package 35 | description: | 36 | This is a test package for validating the Recipe OOP interface. 37 | Recipe is nonsense, its just used to parse/validate via python tests. 38 | homepage: https://example.com 39 | repository: https://github.com/example/test-package 40 | license: MIT 41 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: lint 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | workflow_dispatch: 8 | pull_request: 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | pre-commit: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 19 | with: 20 | submodules: recursive 21 | - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2 22 | with: 23 | shared-key: lint 24 | # Only save cache on main to avoid thrashing 25 | save-if: ${{ github.ref == 'refs/heads/main' }} 26 | - name: Set up pixi 27 | uses: prefix-dev/setup-pixi@v0.9.3 28 | with: 29 | environments: lint 30 | cache: true 31 | - name: lint (if this step fails, please 'pixi run lint' locally and push the changes) 32 | run: pixi run lint 33 | -------------------------------------------------------------------------------- /test-data/recipes/cache/recipe-symlinks.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: cache-symlinks 3 | version: 1.0.0 4 | 5 | cache: 6 | build: 7 | script: | 8 | mkdir -p $PREFIX/bin 9 | touch $PREFIX/bin/exe 10 | ln -s $PREFIX/bin/exe $PREFIX/bin/exe-symlink 11 | ln -s $PREFIX/bin/exe $PREFIX/bin/absolute-exe-symlink 12 | touch $PREFIX/foo.txt 13 | ln -s $PREFIX/foo.txt $PREFIX/foo-symlink.txt 14 | ln -s $PREFIX/foo.txt $PREFIX/absolute-symlink.txt 15 | ln -s $PREFIX/non-existent-file $PREFIX/broken-symlink.txt 16 | ln -s ./foo.txt $PREFIX/relative-symlink.txt 17 | echo ${{ PREFIX }} > $PREFIX/prefix.txt 18 | 19 | outputs: 20 | - package: 21 | name: cache-symlinks 22 | build: 23 | files: 24 | include: 25 | - "**/*" 26 | exclude: 27 | - "absolute-symlink.txt" 28 | - "bin/absolute-exe-symlink" 29 | - package: 30 | name: absolute-cache-symlinks 31 | build: 32 | files: 33 | - "absolute-symlink.txt" 34 | - "bin/absolute-exe-symlink" 35 | -------------------------------------------------------------------------------- /test-data/recipes/rpath/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: mssql-tools 3 | version: "18.2.1.1" 4 | 5 | package: 6 | name: ${{ name }} 7 | version: ${{ version }} 8 | 9 | source: 10 | - url: https://packages.microsoft.com/rhel/7/prod/${{ name }}18-${{ version }}-1.x86_64.rpm 11 | sha256: 98758f29f1b1aad13c5ce32a5cf1e849d35a97054d030ee5dccdab6aefd2aef9 12 | 13 | build: 14 | number: 0 15 | script: 16 | - bsdtar xf mssql-tools18-${{ version }}-1.x86_64.rpm 17 | - mkdir -p $PREFIX/bin 18 | - cp opt/mssql-tools18/bin/* $PREFIX/bin 19 | 20 | requirements: 21 | build: 22 | - libarchive 23 | 24 | tests: 25 | - package_contents: 26 | bin: 27 | - sqlcmd 28 | - bcp 29 | - script: 30 | # both binaries come shipped from the source without rpath 31 | # but rattler-build should add $ORIGIN/../lib to rpath 32 | - patchelf --print-rpath $PREFIX/bin/bcp | grep -q \$ORIGIN/../lib 33 | - patchelf --print-rpath $PREFIX/bin/sqlcmd | grep -q \$ORIGIN/../lib 34 | requirements: 35 | build: 36 | - patchelf 37 | -------------------------------------------------------------------------------- /src/macos/env.rs: -------------------------------------------------------------------------------- 1 | //! macOS specific environment variables 2 | use rattler_conda_types::Platform; 3 | use std::{collections::HashMap, path::Path}; 4 | 5 | use crate::unix; 6 | 7 | /// Get default env vars for macOS 8 | pub fn default_env_vars( 9 | prefix: &Path, 10 | target_platform: &Platform, 11 | ) -> HashMap> { 12 | let mut vars = unix::env::default_env_vars(prefix); 13 | let t_string = target_platform.to_string(); 14 | let arch = t_string.split('-').collect::>()[1]; 15 | let (osx_arch, deployment_target, build) = match arch { 16 | "32" => ("i386", "10.9", "i386-apple-darwin13.4.0"), 17 | "arm64" => ("arm64", "11.0", "arm64-apple-darwin20.0.0"), 18 | _ => ("x86_64", "10.9", "x86_64-apple-darwin13.4.0"), 19 | }; 20 | 21 | vars.insert("OSX_ARCH".to_string(), Some(osx_arch.to_string())); 22 | vars.insert( 23 | "MACOSX_DEPLOYMENT_TARGET".to_string(), 24 | Some(deployment_target.to_string()), 25 | ); 26 | vars.insert("BUILD".to_string(), Some(build.to_string())); 27 | vars 28 | } 29 | -------------------------------------------------------------------------------- /crates/rattler_build_allocator/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! This crate provides the best memory allocator for different platforms. 2 | //! 3 | //! On Windows, we use mimalloc because it provides good performance. 4 | //! On most Unix platforms (Linux, macOS), we use jemalloc for its excellent 5 | //! performance characteristics with multi-threaded applications. 6 | //! 7 | //! This crate is designed to be used as a dependency that, when included, 8 | //! automatically sets the global allocator. Simply add this crate as a 9 | //! dependency and the allocator will be configured. 10 | 11 | // Use mimalloc on Windows 12 | #[cfg(windows)] 13 | #[global_allocator] 14 | static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; 15 | 16 | // Use jemalloc on supported unix platforms 17 | #[cfg(all( 18 | not(windows), 19 | not(target_os = "openbsd"), 20 | not(target_os = "freebsd"), 21 | any( 22 | target_arch = "x86_64", 23 | target_arch = "aarch64", 24 | target_arch = "powerpc64" 25 | ) 26 | ))] 27 | #[global_allocator] 28 | static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; 29 | -------------------------------------------------------------------------------- /docs/tutorials/index.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | This section contains examples for packaging software in different languages with `rattler-build`. Each example walks you through creating a recipe for a specific language ecosystem. 4 | 5 | | Example | Description | 6 | |---------|-------------| 7 | | [Python](python.md) | Build pure Python packages with `noarch: python` and compiled packages like NumPy | 8 | | [C++](cpp.md) | Package header-only and compiled C++ libraries using CMake | 9 | | [JavaScript](javascript.md) | Create packages for NodeJS applications using NPM | 10 | | [Rust](rust.md) | Build Rust packages with proper license bundling using `cargo-bundle-licenses` | 11 | | [Go](go.md) | Package Go applications with `go-cgo` or `go-nocgo` compilers | 12 | | [Perl](perl.md) | Build Perl packages from CPAN with `noarch: generic` support | 13 | | [R](r.md) | Package R libraries from CRAN | 14 | | [Repackaging](repackaging.md) | Repackage existing pre-built binaries for distribution | 15 | | [Converting from conda-build](../converting_from_conda_build.md) | Migrate existing `meta.yaml` recipes to the `rattler-build` format | 16 | -------------------------------------------------------------------------------- /py-rattler-build/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | !Cargo.lock 3 | !pixi.lock 4 | 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | .pytest_cache/ 8 | *.py[cod] 9 | 10 | # C extensions 11 | *.so 12 | 13 | # Distribution / packaging 14 | .Python 15 | .venv/ 16 | env/ 17 | bin/ 18 | build/ 19 | develop-eggs/ 20 | dist/ 21 | eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | include/ 28 | man/ 29 | venv/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | pip-selfcheck.json 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | 47 | # Translations 48 | *.mo 49 | 50 | # Mr Developer 51 | .mr.developer.cfg 52 | .project 53 | .pydevproject 54 | 55 | # Rope 56 | .ropeproject 57 | 58 | # Django stuff: 59 | *.log 60 | *.pot 61 | 62 | .DS_Store 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # MkDocs build 68 | site/ 69 | 70 | # PyCharm 71 | .idea/ 72 | 73 | # VSCode 74 | .vscode/ 75 | 76 | # Pyenv 77 | .python-version 78 | .ruff_cache 79 | -------------------------------------------------------------------------------- /src/tui/logger.rs: -------------------------------------------------------------------------------- 1 | //! TUI log handler. 2 | 3 | use super::event::Event; 4 | use std::io; 5 | use tokio::sync::mpsc; 6 | use tracing_subscriber::fmt::MakeWriter; 7 | 8 | /// Writer for TUI logs. 9 | #[derive(Debug)] 10 | pub struct TuiOutputHandler { 11 | /// Sender channel for logs. 12 | pub log_sender: mpsc::UnboundedSender, 13 | } 14 | 15 | impl Clone for TuiOutputHandler { 16 | fn clone(&self) -> Self { 17 | Self { 18 | log_sender: self.log_sender.clone(), 19 | } 20 | } 21 | } 22 | 23 | impl io::Write for TuiOutputHandler { 24 | fn write(&mut self, buf: &[u8]) -> io::Result { 25 | self.log_sender 26 | .send(Event::BuildLog(buf.to_vec())) 27 | .map_err(|e| io::Error::other(format!("could not send TUI event: {e}")))?; 28 | Ok(buf.len()) 29 | } 30 | 31 | fn flush(&mut self) -> io::Result<()> { 32 | Ok(()) 33 | } 34 | } 35 | 36 | impl<'a> MakeWriter<'a> for TuiOutputHandler { 37 | type Writer = TuiOutputHandler; 38 | 39 | fn make_writer(&'a self) -> Self::Writer { 40 | self.clone() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test-data/patches/define_byteswap.patch: -------------------------------------------------------------------------------- 1 | diff --git a/image/decode/segdec.c b/image/decode/segdec.c 2 | index fb83f2b..1eb9ae4 100644 3 | --- a/image/decode/segdec.c 4 | +++ b/image/decode/segdec.c 5 | @@ -52,6 +52,9 @@ static Int DecodeSignificantAbsLevel (struct CAdaptiveHuffman *pAHexpt, BitIOInf 6 | //================================================================ 7 | // Memory access functions 8 | //================================================================ 9 | + 10 | +U32 _byteswap_ulong(U32 bits); 11 | + 12 | static U32 _FORCEINLINE _load4(void* pv) 13 | { 14 | #ifdef _BIG__ENDIAN_ 15 | diff --git a/jxrgluelib/JXRGlueJxr.c b/jxrgluelib/JXRGlueJxr.c 16 | index 0fde9bb..e6c54e4 100644 17 | --- a/jxrgluelib/JXRGlueJxr.c 18 | +++ b/jxrgluelib/JXRGlueJxr.c 19 | @@ -28,7 +28,7 @@ 20 | //*@@@---@@@@****************************************************************** 21 | #include 22 | #include 23 | - 24 | +#include 25 | 26 | static const char szHDPhotoFormat[] = "image/vnd.ms-photo"; 27 | const U32 IFDEntryTypeSizes[] = { 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 }; 28 | -------------------------------------------------------------------------------- /examples/mamba/build_mamba.bat: -------------------------------------------------------------------------------- 1 | @echo ON 2 | 3 | if /I "%PKG_NAME%" == "mamba" ( 4 | cd mamba 5 | %PYTHON% -m pip install . -vv 6 | exit 0 7 | ) 8 | 9 | rmdir /Q /S build 10 | mkdir build 11 | cd build 12 | 13 | rem most likely don't needed on Windows, just for OSX 14 | rem set "CXXFLAGS=%CXXFLAGS% /D_LIBCPP_DISABLE_AVAILABILITY=1" 15 | 16 | if /I "%PKG_NAME%" == "libmamba" ( 17 | cmake .. ^ 18 | %CMAKE_ARGS% ^ 19 | -GNinja ^ 20 | -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ 21 | -DCMAKE_PREFIX_PATH=%PREFIX% ^ 22 | -DBUILD_LIBMAMBA=ON ^ 23 | -DBUILD_SHARED=ON ^ 24 | -DBUILD_MAMBA_PACKAGE=ON 25 | ) 26 | if /I "%PKG_NAME%" == "libmambapy" ( 27 | cmake .. ^ 28 | %CMAKE_ARGS% ^ 29 | -GNinja ^ 30 | -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ 31 | -DCMAKE_PREFIX_PATH=%PREFIX% ^ 32 | -DPython_EXECUTABLE=%PYTHON% ^ 33 | -DBUILD_LIBMAMBAPY=ON 34 | ) 35 | if errorlevel 1 exit 1 36 | 37 | ninja 38 | if errorlevel 1 exit 1 39 | 40 | ninja install 41 | if errorlevel 1 exit 1 42 | 43 | if /I "%PKG_NAME%" == "libmambapy" ( 44 | cd ../libmambapy 45 | rmdir /Q /S build 46 | %PYTHON% -m pip install . -vv 47 | del *.pyc /a /s 48 | ) 49 | -------------------------------------------------------------------------------- /test-data/recipes/r-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: r-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | interpreter: rscript 9 | content: | 10 | print("Testing R Interpreter", quote = FALSE) 11 | 12 | # Create test data and output file 13 | test_data <- data.frame( 14 | name = c("package1", "package2"), 15 | version = c("1.0", "2.0") 16 | ) 17 | 18 | # Load and use ggplot2 19 | library(ggplot2) 20 | p <- ggplot(test_data, aes(x = name, y = as.numeric(version))) + 21 | geom_bar(stat = "identity") 22 | 23 | # Create output file 24 | output_file <- file.path(Sys.getenv("PREFIX"), "r-test-output.txt") 25 | writeLines(c( 26 | "This file was created by the R interpreter in rattler-build", 27 | "R test successful", 28 | paste("R version:", R.version.string), 29 | paste("PREFIX:", Sys.getenv("PREFIX")) 30 | ), output_file) 31 | 32 | requirements: 33 | host: 34 | - r-base 35 | - r-ggplot2 36 | run: 37 | - r-base 38 | - r-ggplot2 39 | 40 | tests: 41 | - r: 42 | libraries: 43 | - ggplot2 44 | -------------------------------------------------------------------------------- /test-data/recipes/always-include-files/recipe.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | version: 0.1.0 3 | 4 | outputs: 5 | - package: 6 | name: force-include-base 7 | build: 8 | script: 9 | - if: unix 10 | then: 11 | - echo "Hello, world!" > $PREFIX/hello.txt 12 | else: 13 | - echo "Hello, world!" > %PREFIX%\hello.txt 14 | 15 | - package: 16 | name: force-include-sanity-check 17 | requirements: 18 | host: 19 | - force-include-base 20 | build: 21 | script: 22 | - if: unix 23 | then: 24 | - echo "Force include sanity check" > $PREFIX/hello.txt 25 | else: 26 | - echo "Force include sanity check" > %PREFIX%\hello.txt 27 | 28 | - package: 29 | name: force-include-forced 30 | requirements: 31 | host: 32 | - force-include-base 33 | build: 34 | script: 35 | - if: unix 36 | then: 37 | - echo "Force include new file" > $PREFIX/hello.txt 38 | else: 39 | - echo "Force include new file" > %PREFIX%\hello.txt 40 | 41 | always_include_files: 42 | - hello.txt 43 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__conda_build_config__tests__conda_build_config__conda_forge_subset.yaml_false.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/conda_build_config.rs 3 | expression: config 4 | --- 5 | pin_run_as_build: 6 | libblst: 7 | max_pin: x.x 8 | min_pin: ~ 9 | netcdf-cxx4: 10 | max_pin: x.x 11 | min_pin: ~ 12 | vlfeat: 13 | max_pin: x.x.x 14 | min_pin: ~ 15 | zip_keys: 16 | - - c_compiler_version 17 | - cxx_compiler_version 18 | - fortran_compiler_version 19 | - - python 20 | - numpy 21 | - python_impl 22 | - is_python_min 23 | - - libarrow 24 | - libarrow_all 25 | blas_impl: 26 | - openblas 27 | c_compiler: 28 | - clang 29 | c_compiler_version: 30 | - "18" 31 | c_stdlib: 32 | - macosx_deployment_target 33 | c_stdlib_version: 34 | - "11.0" 35 | cxx_compiler: 36 | - clangxx 37 | cxx_compiler_version: 38 | - "18" 39 | environment_var: 40 | - CF_CUDA_DISABLED 41 | fortran_compiler_version: 42 | - "13" 43 | libblas: 44 | - 3.9.* *netlib 45 | libcblas: 46 | - 3.9.* *netlib 47 | liblapack: 48 | - 3.9.* *netlib 49 | liblapacke: 50 | - 3.9.* *netlib 51 | llvm_openmp: 52 | - "18" 53 | startswith: 54 | - truey 55 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__conda_build_config__tests__conda_build_config__conda_forge_subset.yaml_none.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/conda_build_config.rs 3 | expression: config 4 | --- 5 | pin_run_as_build: 6 | libblst: 7 | max_pin: x.x 8 | min_pin: ~ 9 | netcdf-cxx4: 10 | max_pin: x.x 11 | min_pin: ~ 12 | vlfeat: 13 | max_pin: x.x.x 14 | min_pin: ~ 15 | zip_keys: 16 | - - c_compiler_version 17 | - cxx_compiler_version 18 | - fortran_compiler_version 19 | - - python 20 | - numpy 21 | - python_impl 22 | - is_python_min 23 | - - libarrow 24 | - libarrow_all 25 | blas_impl: 26 | - openblas 27 | c_compiler: 28 | - clang 29 | c_compiler_version: 30 | - "18" 31 | c_stdlib: 32 | - macosx_deployment_target 33 | c_stdlib_version: 34 | - "11.0" 35 | cxx_compiler: 36 | - clangxx 37 | cxx_compiler_version: 38 | - "18" 39 | environment_var: 40 | - CF_CUDA_DISABLED 41 | fortran_compiler_version: 42 | - "13" 43 | libblas: 44 | - 3.9.* *netlib 45 | libcblas: 46 | - 3.9.* *netlib 47 | liblapack: 48 | - 3.9.* *netlib 49 | liblapacke: 50 | - 3.9.* *netlib 51 | llvm_openmp: 52 | - "18" 53 | startswith: 54 | - truey 55 | -------------------------------------------------------------------------------- /docs/stylesheets/fonts.css: -------------------------------------------------------------------------------- 1 | /* Display font */ 2 | @font-face { 3 | font-family: 'Moranga'; 4 | font-style: normal; 5 | font-weight: 300; 6 | font-display: swap; 7 | src: url(https://fonts.prefix.dev/moranga/MorangaLight/font.woff2) format('woff2'); 8 | } 9 | @font-face { 10 | font-family: 'Moranga'; 11 | font-style: normal; 12 | font-weight: 400; 13 | font-display: swap; 14 | src: url(https://fonts.prefix.dev/moranga/MorangaRegular/font.woff2) format('woff2'); 15 | } 16 | @font-face { 17 | font-family: 'Moranga'; 18 | font-style: normal; 19 | font-weight: 500; 20 | font-display: swap; 21 | src: url(https://fonts.prefix.dev/moranga/MorangaMedium/font.woff2) format('woff2'); 22 | } 23 | @font-face { 24 | font-family: 'Moranga'; 25 | font-style: normal; 26 | font-weight: 600; 27 | font-display: swap; 28 | src: url(https://fonts.prefix.dev/moranga/MorangaBold/font.woff2) format('woff2'); 29 | } 30 | @font-face { 31 | font-family: 'Moranga'; 32 | font-style: normal; 33 | font-weight: 700; 34 | font-display: swap; 35 | src: url(https://fonts.prefix.dev/moranga/MorangaBlack/font.woff2) format('woff2'); 36 | } -------------------------------------------------------------------------------- /examples/curl/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | version: "8.0.1" 3 | 4 | package: 5 | name: curl 6 | version: ${{ version }} 7 | 8 | source: 9 | url: http://curl.haxx.se/download/curl-${{ version }}.tar.bz2 10 | sha256: 9b6b1e96b748d04b968786b6bdf407aa5c75ab53a3d37c1c8c81cdb736555ccf 11 | 12 | build: 13 | number: 0 14 | 15 | requirements: 16 | build: 17 | - ${{ compiler('c') }} 18 | - if: win 19 | then: 20 | - cmake 21 | - ninja 22 | - if: unix 23 | then: 24 | - make 25 | - perl 26 | - pkg-config 27 | - libtool 28 | host: 29 | - if: linux 30 | then: 31 | - openssl 32 | - zlib 33 | 34 | tests: 35 | - script: 36 | - curl --version 37 | 38 | about: 39 | homepage: http://curl.haxx.se/ 40 | license: curl 41 | license_file: COPYING 42 | summary: tool and library for transferring data with URL syntax 43 | description: | 44 | Curl is an open source command line tool and library for transferring data 45 | with URL syntax. It is used in command lines or scripts to transfer data. 46 | documentation: https://curl.haxx.se/docs/ 47 | repository: https://github.com/curl/curl 48 | -------------------------------------------------------------------------------- /src/snapshots/rattler_build__conda_build_config__tests__conda_build_config__conda_forge_subset.yaml_true.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: src/conda_build_config.rs 3 | expression: config 4 | --- 5 | pin_run_as_build: 6 | libblst: 7 | max_pin: x.x 8 | min_pin: ~ 9 | netcdf-cxx4: 10 | max_pin: x.x 11 | min_pin: ~ 12 | vlfeat: 13 | max_pin: x.x.x 14 | min_pin: ~ 15 | zip_keys: 16 | - - c_compiler_version 17 | - cxx_compiler_version 18 | - fortran_compiler_version 19 | - cuda_compiler 20 | - - python 21 | - numpy 22 | - python_impl 23 | - is_python_min 24 | - - libarrow 25 | - libarrow_all 26 | blas_impl: 27 | - openblas 28 | c_compiler: 29 | - clang 30 | c_compiler_version: 31 | - "18" 32 | c_stdlib: 33 | - macosx_deployment_target 34 | c_stdlib_version: 35 | - "11.0" 36 | cxx_compiler: 37 | - clangxx 38 | cxx_compiler_version: 39 | - "18" 40 | environment_var: 41 | - CF_CUDA_ENABLED 42 | fortran_compiler_version: 43 | - "13" 44 | libblas: 45 | - 3.9.* *netlib 46 | libcblas: 47 | - 3.9.* *netlib 48 | liblapack: 49 | - 3.9.* *netlib 50 | liblapacke: 51 | - 3.9.* *netlib 52 | llvm_openmp: 53 | - "18" 54 | startswith: 55 | - truey 56 | -------------------------------------------------------------------------------- /test-data/recipes/strict-mode/recipe-many-files.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: test-strict-many 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "matched" > $PREFIX/matched.txt 10 | - echo "unmatched1" > $PREFIX/unmatched1.txt 11 | - echo "unmatched2" > $PREFIX/unmatched2.txt 12 | - echo "unmatched3" > $PREFIX/unmatched3.txt 13 | - echo "unmatched4" > $PREFIX/unmatched4.txt 14 | - echo "unmatched5" > $PREFIX/unmatched5.txt 15 | - echo "unmatched6" > $PREFIX/unmatched6.txt 16 | - echo "unmatched7" > $PREFIX/unmatched7.txt 17 | else: 18 | - echo "matched" > %PREFIX%\matched.txt 19 | - echo "unmatched1" > %PREFIX%\unmatched1.txt 20 | - echo "unmatched2" > %PREFIX%\unmatched2.txt 21 | - echo "unmatched3" > %PREFIX%\unmatched3.txt 22 | - echo "unmatched4" > %PREFIX%\unmatched4.txt 23 | - echo "unmatched5" > %PREFIX%\unmatched5.txt 24 | - echo "unmatched6" > %PREFIX%\unmatched6.txt 25 | - echo "unmatched7" > %PREFIX%\unmatched7.txt 26 | 27 | tests: 28 | - package_contents: 29 | strict: true 30 | files: 31 | - matched.txt 32 | -------------------------------------------------------------------------------- /test/end-to-end/conftest.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | 4 | import pytest 5 | from helpers import RattlerBuild 6 | from syrupy.extensions.json import JSONSnapshotExtension 7 | 8 | 9 | @pytest.fixture 10 | def rattler_build(): 11 | if os.environ.get("RATTLER_BUILD_PATH"): 12 | return RattlerBuild(os.environ["RATTLER_BUILD_PATH"]) 13 | else: 14 | base_path = Path(__file__).parent.parent.parent 15 | executable_name = "rattler-build" 16 | if os.name == "nt": 17 | executable_name += ".exe" 18 | 19 | release_path = base_path / f"target/release/{executable_name}" 20 | debug_path = base_path / f"target/debug/{executable_name}" 21 | 22 | if release_path.exists(): 23 | return RattlerBuild(release_path) 24 | elif debug_path.exists(): 25 | return RattlerBuild(debug_path) 26 | 27 | raise FileNotFoundError("Could not find rattler-build executable") 28 | 29 | 30 | @pytest.fixture 31 | def snapshot_json(snapshot): 32 | return snapshot.use_extension(JSONSnapshotExtension) 33 | 34 | 35 | @pytest.fixture 36 | def recipes(): 37 | return Path(__file__).parent.parent.parent / "test-data" / "recipes" 38 | -------------------------------------------------------------------------------- /examples/ros-humble-turtlebot4-msgs/bld_ament_cmake.bat: -------------------------------------------------------------------------------- 1 | :: Generated by vinca http://github.com/RoboStack/vinca. 2 | :: DO NOT EDIT! 3 | setlocal EnableDelayedExpansion 4 | 5 | set "PYTHONPATH=%LIBRARY_PREFIX%\lib\site-packages;%SP_DIR%" 6 | 7 | :: MSVC is preferred. 8 | set CC=cl.exe 9 | set CXX=cl.exe 10 | 11 | rd /s /q build 12 | mkdir build 13 | pushd build 14 | 15 | :: set "CMAKE_GENERATOR=Ninja" 16 | 17 | :: try to fix long paths issues by using default generator 18 | set "CMAKE_GENERATOR=Visual Studio %VS_MAJOR% %VS_YEAR%" 19 | set "SP_DIR_FORWARDSLASHES=%SP_DIR:\=/%" 20 | 21 | cmake ^ 22 | -G "%CMAKE_GENERATOR%" ^ 23 | -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ 24 | -DCMAKE_BUILD_TYPE=Release ^ 25 | -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^ 26 | -DPYTHON_EXECUTABLE=%PYTHON% ^ 27 | -DPython_EXECUTABLE=%PYTHON% ^ 28 | -DPython3_EXECUTABLE=%PYTHON% ^ 29 | -DSETUPTOOLS_DEB_LAYOUT=OFF ^ 30 | -DBUILD_SHARED_LIBS=ON ^ 31 | -DBUILD_TESTING=OFF ^ 32 | -DCMAKE_OBJECT_PATH_MAX=255 ^ 33 | -DPYTHON_INSTALL_DIR=%SP_DIR_FORWARDSLASHES% ^ 34 | %SRC_DIR%\%PKG_NAME%\src\work 35 | if errorlevel 1 exit 1 36 | 37 | cmake --build . --config Release --target install 38 | if errorlevel 1 exit 1 39 | -------------------------------------------------------------------------------- /test-data/recipes/output_order/order_1.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: some-pkg.foo 3 | name_a: ${{ name }}-a 4 | version: 1.0.0 5 | build_number: 0 6 | 7 | recipe: 8 | name: ${{ name }} 9 | version: ${{ version }} 10 | 11 | source: 12 | path: ../ 13 | 14 | # expected order of outputs: 15 | # 1. some-pkg.foo-a 16 | # 2. some-pkg.foo 17 | # 3. some_pkg.foo 18 | outputs: 19 | - package: 20 | name: ${{ name }} 21 | version: ${{ version }} 22 | build: 23 | noarch: python 24 | number: ${{ build_number }} 25 | requirements: 26 | host: 27 | - python >=3.10 28 | - pip 29 | - ${{ pin_subpackage(name_a, lower_bound="x.x.x") }} 30 | run: 31 | - python >=3.10 32 | - package: 33 | name: ${{ name_a }} 34 | version: ${{ version }} 35 | build: 36 | noarch: python 37 | number: ${{ build_number }} 38 | requirements: 39 | host: 40 | - python >=3.10 41 | - pip 42 | run: 43 | - python >=3.10 44 | - package: 45 | name: ${{ name | replace('-', '_') }} 46 | version: ${{ version }} 47 | build: 48 | noarch: generic 49 | requirements: 50 | host: 51 | - ${{ pin_subpackage(name, exact=true) }} 52 | -------------------------------------------------------------------------------- /test-data/patches/0001-cross.patch.fail: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile b/Makefile 2 | index 9754ddf..b5512de 100644 3 | --- a/Makefile 4 | +++ b/Makefile 5 | @@ -15,16 +15,16 @@ 6 | SHELL=/bin/sh 7 | 8 | # To assist in cross-compiling 9 | -CC=gcc 10 | -AR=ar 11 | -RANLIB=ranlib 12 | -LDFLAGS= 13 | +CC?=gcc 14 | +AR?=ar 15 | +RANLIB?=ranlib 16 | 17 | BIGFILES=-D_FILE_OFFSET_BITS=64 18 | -CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) 19 | +CFLAGS?=-Wall -Winline -O2 -g 20 | +CFLAGS=$(CFLAGS) $(BIGFILES) 21 | 22 | # Where you want it installed when you do 'make install' 23 | -PREFIX=/usr/local 24 | +PREFIX=$PREFIX 25 | 26 | 27 | OBJS= blocksort.o \ 28 | diff --git a/Makefile-libbz2_so b/Makefile-libbz2_so 29 | index e58791b..f4b9fa2 100644 30 | --- a/Makefile-libbz2_so 31 | +++ b/Makefile-libbz2_so 32 | @@ -22,9 +22,18 @@ 33 | 34 | 35 | SHELL=/bin/sh 36 | -CC=gcc 37 | + 38 | +# To assist in cross-compiling 39 | +CC?=gcc 40 | +AR?=ar 41 | +RANLIB?=ranlib 42 | + 43 | BIGFILES=-D_FILE_OFFSET_BITS=64 44 | -CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) 45 | +CFLAGS?=-Wall -Winline -O2 -g 46 | +CFLAGS=$(CFLAGS) $(BIGFILES) 47 | + 48 | +# Where you want it installed when you do 'make install' 49 | +PREFIX=$PREFIX 50 | 51 | OBJS= blocksort.o \ 52 | huffman.o \ 53 | -------------------------------------------------------------------------------- /examples/xtensor/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: xtensor 3 | version: 0.27.1 4 | 5 | package: 6 | name: ${{ name|lower }} 7 | version: ${{ version }} 8 | 9 | source: 10 | url: https://github.com/xtensor-stack/xtensor/archive/${{ version }}.tar.gz 11 | sha256: 117c192ae3b7c37c0156dedaa88038e0599a6b264666c3c6c2553154b500fe23 12 | build: 13 | number: 0 14 | 15 | requirements: 16 | build: 17 | - ${{ compiler('cxx') }} 18 | - cmake 19 | - ninja 20 | - nushell 21 | host: 22 | - xtl >=0.7,<0.8 23 | run: 24 | - xtl >=0.7,<0.8 25 | run_constraints: 26 | - xsimd >=8.0.3,<10 27 | 28 | tests: 29 | - package_contents: 30 | include: 31 | - xtensor/xarray.hpp 32 | files: 33 | - "**/share/cmake/xtensor/xtensorConfig.cmake" 34 | - "**/share/cmake/xtensor/xtensorConfigVersion.cmake" 35 | 36 | about: 37 | homepage: https://github.com/xtensor-stack/xtensor 38 | license: BSD-3-Clause 39 | license_file: LICENSE 40 | summary: The C++ tensor algebra library 41 | description: Multi dimensional arrays with broadcasting and lazy computing 42 | documentation: https://xtensor.readthedocs.io 43 | repository: https://github.com/xtensor-stack/xtensor 44 | 45 | extra: 46 | recipe-maintainers: 47 | - some-maintainer 48 | -------------------------------------------------------------------------------- /py-rattler-build/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "py-rattler-build" 3 | version = "0.55.0" 4 | edition = "2024" 5 | license = "BSD-3-Clause" 6 | publish = false 7 | 8 | [lib] 9 | name = "rattler_build" 10 | crate-type = ["cdylib"] 11 | 12 | [features] 13 | default = ["rustls-tls"] 14 | native-tls = ["rattler-build/native-tls"] 15 | rustls-tls = ["rattler-build/rustls-tls"] 16 | 17 | [dependencies] 18 | rattler-build = { path = "../" } 19 | pyo3 = { version = "0.27.1", features = [ 20 | "abi3-py38", 21 | "extension-module", 22 | "multiple-pymethods", 23 | "chrono", 24 | ] } 25 | tokio = { version = "1.48.0", features = [ 26 | "rt", 27 | "macros", 28 | "rt-multi-thread", 29 | "process", 30 | ] } 31 | rattler_conda_types = "0.42.1" 32 | rattler_config = "0.2.20" 33 | rattler_networking = { version = "0.25.26" } 34 | clap = "4.5.53" 35 | url = "2.5.7" 36 | chrono = "0.4.42" 37 | rattler_upload = "0.4.4" 38 | miette = "7.6.0" 39 | serde_json = "1.0.145" 40 | pythonize = "0.27.0" 41 | thiserror = "2.0.17" 42 | 43 | [build-dependencies] 44 | pyo3-build-config = "0.27.1" 45 | 46 | # Prevent package from thinking it's in the workspace 47 | [workspace] 48 | # 'local_dependencies' is generated by maturin and needs to be excluded 49 | exclude = ["local_dependencies/rattler-build"] 50 | -------------------------------------------------------------------------------- /test-data/recipes/abi3/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: python-abi3-package-sample 3 | version: 0.0.1 4 | 5 | source: 6 | url: https://github.com/joerick/python-abi3-package-sample/archive/6f74ae7b31e58ef5f8f09b647364854122e61155.tar.gz 7 | sha256: e81fd4d4c4f5b7bc9786d9ee990afc659e14a25ce11182b7b69f826407cc1718 8 | 9 | build: 10 | number: 0 11 | python: 12 | version_independent: true 13 | script: ${{ PYTHON }} -m pip install . -vv 14 | 15 | requirements: 16 | build: 17 | - ${{ compiler('c') }} 18 | - if: host_platform != build_platform 19 | then: cross-python_${{ host_platform }} 20 | host: 21 | - python-abi3 22 | - python 23 | - pip 24 | - setuptools 25 | run: 26 | - python 27 | 28 | tests: 29 | - python: 30 | imports: 31 | - spam 32 | - script: 33 | - export SP_DIR=$(python -c "import site; print(site.getsitepackages()[0])") 34 | - abi3audit $SP_DIR/spam.abi3.so -s -v --assume-minimum-abi3 ${{ python_min }} 35 | requirements: 36 | run: 37 | - abi3audit 38 | 39 | about: 40 | homepage: https://github.com/joerick/python-abi3-package-sample 41 | summary: "ABI3 example" 42 | license: Apache-2.0 43 | license_file: LICENSE 44 | 45 | extra: 46 | recipe-maintainers: 47 | - isuruf 48 | -------------------------------------------------------------------------------- /test-data/recipes/case-insensitive/recipe.yaml: -------------------------------------------------------------------------------- 1 | recipe: 2 | name: case-insensitive-test 3 | version: "1.0.0" 4 | 5 | outputs: 6 | - package: 7 | name: c1 8 | 9 | build: 10 | script: 11 | - if: win 12 | then: 13 | - mkdir %PREFIX%\CMake\ 14 | - echo "This is a test file for case insensitivity" > %PREFIX%\CMake\test_file.txt 15 | else: 16 | - mkdir -p $PREFIX/CMake/ 17 | - echo "This is a test file for case insensitivity" > $PREFIX/CMake/test_file.txt 18 | 19 | - package: 20 | name: c2 21 | 22 | requirements: 23 | host: 24 | - c1 25 | 26 | build: 27 | script: 28 | - if: win 29 | then: 30 | - rmdir /S /Q %PREFIX%\CMake\ 31 | - mkdir %PREFIX%\cmake\ 32 | - echo "foo" > %PREFIX%\TEST.txt 33 | - echo "bar" > %PREFIX%\test.txt 34 | - echo "This is a test file for case insensitivity" > %PREFIX%\cmake\test_file.txt 35 | else: 36 | - rm -rf $PREFIX/CMake/ 37 | - mkdir -p $PREFIX/cmake/ 38 | - echo "foo" > $PREFIX/TEST.txt 39 | - echo "bar" > $PREFIX/test.txt 40 | - echo "This is a test file for case insensitivity" > $PREFIX/cmake/test_file.txt 41 | -------------------------------------------------------------------------------- /src/script/interpreter/perl.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use rattler_conda_types::Platform; 4 | 5 | use crate::script::{ExecutionArgs, ResolvedScriptContents}; 6 | 7 | use super::{BashInterpreter, CmdExeInterpreter, Interpreter, InterpreterError, find_interpreter}; 8 | 9 | pub(crate) struct PerlInterpreter; 10 | 11 | // Perl interpreter calls either bash or cmd.exe interpreter for activation and then runs Perl script 12 | impl Interpreter for PerlInterpreter { 13 | async fn run(&self, args: ExecutionArgs) -> Result<(), InterpreterError> { 14 | let perl_script = args.work_dir.join("conda_build_script.pl"); 15 | tokio::fs::write(&perl_script, args.script.script()).await?; 16 | 17 | let args = ExecutionArgs { 18 | script: ResolvedScriptContents::Inline(format!("perl {:?}", perl_script)), 19 | ..args 20 | }; 21 | 22 | if cfg!(windows) { 23 | CmdExeInterpreter.run(args).await 24 | } else { 25 | BashInterpreter.run(args).await 26 | } 27 | } 28 | 29 | async fn find_interpreter( 30 | &self, 31 | build_prefix: Option<&PathBuf>, 32 | platform: &Platform, 33 | ) -> Result, which::Error> { 34 | find_interpreter("perl", build_prefix, platform) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/script/interpreter/ruby.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use rattler_conda_types::Platform; 4 | 5 | use crate::script::{ExecutionArgs, ResolvedScriptContents}; 6 | 7 | use super::{BashInterpreter, CmdExeInterpreter, Interpreter, InterpreterError, find_interpreter}; 8 | 9 | pub(crate) struct RubyInterpreter; 10 | 11 | // Ruby interpreter calls either bash or cmd.exe interpreter for activation and then runs Ruby script 12 | impl Interpreter for RubyInterpreter { 13 | async fn run(&self, args: ExecutionArgs) -> Result<(), InterpreterError> { 14 | let ruby_script = args.work_dir.join("conda_build_script.rb"); 15 | tokio::fs::write(&ruby_script, args.script.script()).await?; 16 | 17 | let args = ExecutionArgs { 18 | script: ResolvedScriptContents::Inline(format!("ruby {:?}", ruby_script)), 19 | ..args 20 | }; 21 | 22 | if cfg!(windows) { 23 | CmdExeInterpreter.run(args).await 24 | } else { 25 | BashInterpreter.run(args).await 26 | } 27 | } 28 | 29 | async fn find_interpreter( 30 | &self, 31 | build_prefix: Option<&PathBuf>, 32 | platform: &Platform, 33 | ) -> Result, which::Error> { 34 | find_interpreter("ruby", build_prefix, platform) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test-data/recipes/regex_post_process/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: regex-post-process 3 | version: 0.1.0 4 | 5 | build: 6 | script: 7 | - if: unix 8 | then: 9 | - echo "Building the regex-post-process package" > $PREFIX/test.txt 10 | - echo "Do not replace /some/path/to/sysroot/and/more this" >> $PREFIX/test.txt 11 | - cp $RECIPE_DIR/test.pc $PREFIX/test.pc 12 | - cp $RECIPE_DIR/test.cmake $PREFIX/test.cmake 13 | else: 14 | - echo Building the regex-post-process package> %PREFIX%\test.txt 15 | - echo Do not replace /some/path/to/sysroot/and/more this>> %PREFIX%\test.txt 16 | - copy %RECIPE_DIR%\test.pc %PREFIX%\test.pc 17 | - copy %RECIPE_DIR%\test.cmake %PREFIX%\test.cmake 18 | 19 | post_process: 20 | - files: 21 | - "*.txt" 22 | regex: "regex-post-process" 23 | replacement: "regex-post-process-replaced" 24 | - files: 25 | - "*.pc" 26 | regex: (?:-L|-I)?"?([^;\s]+/sysroot/) 27 | replacement: "$(CONDA_BUILD_SYSROOT_S)" 28 | - files: 29 | - "*.cmake" 30 | regex: ([^;\s"]+/sysroot) 31 | replacement: "$$ENV{CONDA_BUILD_SYSROOT}" 32 | - files: 33 | - "*.cmake" 34 | regex: ([^;\s"]+/MacOSX\d*\.?\d*\.sdk) 35 | replacement: "$$ENV{CONDA_BUILD_SYSROOT}" 36 | -------------------------------------------------------------------------------- /src/script/interpreter/nodejs.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use rattler_conda_types::Platform; 4 | 5 | use crate::script::{ExecutionArgs, ResolvedScriptContents}; 6 | 7 | use super::{BashInterpreter, CmdExeInterpreter, Interpreter, InterpreterError, find_interpreter}; 8 | 9 | pub(crate) struct NodeJsInterpreter; 10 | 11 | // NodeJS interpreter calls either bash or cmd.exe interpreter for activation and then runs Node script 12 | impl Interpreter for NodeJsInterpreter { 13 | async fn run(&self, args: ExecutionArgs) -> Result<(), InterpreterError> { 14 | let node_script = args.work_dir.join("conda_build_script.js"); 15 | tokio::fs::write(&node_script, args.script.script()).await?; 16 | 17 | let args = ExecutionArgs { 18 | script: ResolvedScriptContents::Inline(format!("node {:?}", node_script)), 19 | ..args 20 | }; 21 | 22 | if cfg!(windows) { 23 | CmdExeInterpreter.run(args).await 24 | } else { 25 | BashInterpreter.run(args).await 26 | } 27 | } 28 | 29 | async fn find_interpreter( 30 | &self, 31 | build_prefix: Option<&PathBuf>, 32 | platform: &Platform, 33 | ) -> Result, which::Error> { 34 | find_interpreter("node", build_prefix, platform) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/script/interpreter/python.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use rattler_conda_types::Platform; 4 | 5 | use crate::script::{ExecutionArgs, ResolvedScriptContents}; 6 | 7 | use super::{BashInterpreter, CmdExeInterpreter, Interpreter, InterpreterError, find_interpreter}; 8 | 9 | pub(crate) struct PythonInterpreter; 10 | 11 | // python interpreter calls either bash or cmd.exe interpreter for activation and then runs python script 12 | impl Interpreter for PythonInterpreter { 13 | async fn run(&self, args: ExecutionArgs) -> Result<(), InterpreterError> { 14 | let py_script = args.work_dir.join("conda_build_script.py"); 15 | tokio::fs::write(&py_script, args.script.script()).await?; 16 | 17 | let args = ExecutionArgs { 18 | script: ResolvedScriptContents::Inline(format!("python {:?}", py_script)), 19 | ..args 20 | }; 21 | 22 | if cfg!(windows) { 23 | CmdExeInterpreter.run(args).await 24 | } else { 25 | BashInterpreter.run(args).await 26 | } 27 | } 28 | 29 | async fn find_interpreter( 30 | &self, 31 | build_prefix: Option<&PathBuf>, 32 | platform: &Platform, 33 | ) -> Result, which::Error> { 34 | find_interpreter("python", build_prefix, platform) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test-data/recipes/test-sources/recipe.yaml: -------------------------------------------------------------------------------- 1 | context: 2 | name: test-sources 3 | version: 1.0.0 4 | 5 | package: 6 | name: ${{ name|lower }} 7 | version: ${{ version }} 8 | 9 | source: 10 | - file_name: test.avi 11 | url: https://github.com/opencv/opencv_extra/raw/master/testdata/highgui/video/VID00003-20100701-2204.avi 12 | sha256: 78884f64b564a3b06dc6ee731ed33b60c6d8cd864cea07f21d94ba0f90c7b310 13 | 14 | - path: ./test-folder/test-file-2.txt 15 | md5: d41d8cd98f00b204e9800998ecf8427e 16 | - path: ./test-folder 17 | target_directory: just-a-test 18 | - path: test-file.txt 19 | file_name: am-i-renamed.txt 20 | sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 21 | 22 | build: 23 | script: 24 | - echo "running build (test)" 25 | - test -f ./test-file-2.txt 26 | - test -f ./just-a-test/test-file-2.txt 27 | - test -f ./am-i-renamed.txt 28 | - test -f ./test.avi 29 | 30 | tests: 31 | - script: 32 | - echo "test" 33 | - test -f ./test.avi 34 | - test -f ./test-file.txt 35 | - test -d ./test-folder 36 | - test -f ./test-folder/test-file-2.txt 37 | - test -f ./test-folder/test-file-3.txt 38 | files: 39 | source: 40 | - test.avi 41 | recipe: 42 | - test-file.txt 43 | - test-folder/ 44 | -------------------------------------------------------------------------------- /crates/rattler_build_recipe_generator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rattler_build_recipe_generator" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | description = "Recipe generation for PyPI, CRAN, CPAN, and LuaRocks packages" 9 | 10 | [features] 11 | default = [] 12 | cli = ["dep:clap"] 13 | 14 | [dependencies] 15 | clap = { workspace = true, optional = true } 16 | async-once-cell = { workspace = true } 17 | async-recursion = { workspace = true } 18 | flate2 = { workspace = true } 19 | fs-err = { workspace = true } 20 | indexmap = { workspace = true } 21 | itertools = { workspace = true } 22 | miette = { workspace = true } 23 | rattler_conda_types = { workspace = true } 24 | rattler_digest = { workspace = true } 25 | regex = { workspace = true } 26 | reqwest = { workspace = true } 27 | serde = { workspace = true } 28 | serde_json = { workspace = true } 29 | serde_with = { workspace = true } 30 | serde_yaml = { workspace = true } 31 | sha2 = { workspace = true } 32 | tar = { workspace = true } 33 | tempfile = { workspace = true } 34 | toml = { workspace = true } 35 | tracing = { workspace = true } 36 | url = { workspace = true } 37 | zip = { workspace = true } 38 | 39 | [dev-dependencies] 40 | insta = { workspace = true } 41 | tokio = { workspace = true } 42 | -------------------------------------------------------------------------------- /test-data/recipes/ruby-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: ruby-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | interpreter: ruby 9 | content: | 10 | puts "Testing Ruby Interpreter" 11 | 12 | # Create test data and output file 13 | test_data = [ 14 | { name: "package1", version: "1.0" }, 15 | { name: "package2", version: "2.0" } 16 | ] 17 | 18 | # Write output to a file 19 | File.open("#{ENV['PREFIX']}/ruby_test_output.txt", "w") do |file| 20 | test_data.each do |pkg| 21 | file.puts "#{pkg[:name]}: #{pkg[:version]}" 22 | end 23 | end 24 | 25 | puts "Ruby test completed successfully" 26 | 27 | requirements: 28 | host: 29 | - ruby 30 | 31 | tests: 32 | - script: 33 | - if: unix 34 | then: 35 | - test -f $PREFIX/ruby_test_output.txt 36 | - grep "package1: 1.0" $PREFIX/ruby_test_output.txt 37 | - grep "package2: 2.0" $PREFIX/ruby_test_output.txt 38 | - if: win 39 | then: 40 | - if not exist %PREFIX%\ruby_test_output.txt exit 1 41 | - findstr "package1: 1.0" %PREFIX%\ruby_test_output.txt 42 | - findstr "package2: 2.0" %PREFIX%\ruby_test_output.txt 43 | 44 | about: 45 | summary: Test package for Ruby interpreter support 46 | license: MIT 47 | -------------------------------------------------------------------------------- /src/script/interpreter/r.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use rattler_conda_types::Platform; 4 | 5 | use crate::script::{ExecutionArgs, ResolvedScriptContents}; 6 | 7 | use super::{BashInterpreter, CmdExeInterpreter, Interpreter, InterpreterError, find_interpreter}; 8 | 9 | pub(crate) struct RInterpreter; 10 | 11 | // R interpreter calls either bash or cmd.exe interpreter for activation and then runs R script 12 | impl Interpreter for RInterpreter { 13 | async fn run(&self, args: ExecutionArgs) -> Result<(), InterpreterError> { 14 | let script = args.script.script(); 15 | let r_script = args.work_dir.join("conda_build_script.R"); 16 | tokio::fs::write(&r_script, script).await?; 17 | let r_command = format!("Rscript {:?}", r_script); 18 | 19 | let args = ExecutionArgs { 20 | script: ResolvedScriptContents::Inline(r_command), 21 | ..args 22 | }; 23 | 24 | if cfg!(windows) { 25 | CmdExeInterpreter.run(args).await 26 | } else { 27 | BashInterpreter.run(args).await 28 | } 29 | } 30 | 31 | async fn find_interpreter( 32 | &self, 33 | build_prefix: Option<&PathBuf>, 34 | platform: &Platform, 35 | ) -> Result, which::Error> { 36 | find_interpreter("Rscript", build_prefix, platform) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test-data/recipes/variants/issue_variant_ignore.yaml: -------------------------------------------------------------------------------- 1 | schema_version: 1 2 | 3 | context: 4 | version: 3.4.0 5 | eigen_max_align_bytes: ${{ "16" if eigen_abi_profile == "100" else ("32" if eigen_abi_profile == "80" else ("64" if eigen_abi_profile == "70" else "unsupported_eigen_abi_profile_value")) }} 6 | 7 | recipe: 8 | name: eigen-variant-example 9 | version: ${{ version }} 10 | 11 | build: 12 | number: 1 13 | 14 | outputs: 15 | - package: 16 | name: eigen 17 | version: ${{ version }} 18 | 19 | build: 20 | variant: 21 | ignore_keys: 22 | - eigen_abi_profile 23 | 24 | - package: 25 | name: eigen-abi 26 | version: ${{ version }}.${{ eigen_abi_profile }} 27 | requirements: 28 | run_exports: 29 | - ${{ pin_subpackage('eigen-abi', upper_bound='x.x.x.x') }} 30 | run: 31 | - ${{ pin_subpackage('eigen', upper_bound='x.x.x') }} 32 | tests: 33 | - script: 34 | - echo "This is a metapackage, no test is necessary." 35 | 36 | - package: 37 | name: eigen-abi-other 38 | version: ${{ version }} 39 | build: 40 | variant: 41 | use_keys: 42 | - some_key 43 | ignore_keys: 44 | - eigen_abi_profile 45 | 46 | about: 47 | homepage: http://eigen.tuxfamily.org/ 48 | license: MPL-2.0 49 | summary: C++ template library for linear algebra 50 | -------------------------------------------------------------------------------- /examples/mamba/build_mamba.sh: -------------------------------------------------------------------------------- 1 | if [[ $PKG_NAME == "mamba" ]]; then 2 | cd mamba 3 | $PYTHON -m pip install . -vv 4 | 5 | echo "Adding link to mamba into condabin"; 6 | mkdir -p $PREFIX/condabin 7 | ln -s $PREFIX/bin/mamba $PREFIX/condabin/mamba 8 | 9 | exit 0 10 | fi 11 | 12 | rm -rf build 13 | mkdir build 14 | cd build 15 | 16 | export CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY=1" 17 | 18 | if [[ $PKG_NAME == "libmamba" ]]; then 19 | cmake .. ${CMAKE_ARGS} \ 20 | -GNinja \ 21 | -DCMAKE_INSTALL_PREFIX=$PREFIX \ 22 | -DCMAKE_PREFIX_PATH=$PREFIX \ 23 | -DBUILD_LIBMAMBA=ON \ 24 | -DBUILD_SHARED=ON \ 25 | -DBUILD_MAMBA_PACKAGE=ON 26 | elif [[ $PKG_NAME == "libmambapy" ]]; then 27 | # TODO finds wrong python interpreter!!!! 28 | cmake .. ${CMAKE_ARGS} \ 29 | -GNinja \ 30 | -DCMAKE_PREFIX_PATH=$PREFIX \ 31 | -DCMAKE_INSTALL_PREFIX=$PREFIX \ 32 | -DPython_EXECUTABLE=$PYTHON \ 33 | -DBUILD_LIBMAMBAPY=ON 34 | fi 35 | 36 | ninja 37 | 38 | ninja install 39 | 40 | if [[ $PKG_NAME == "libmambapy" ]]; then 41 | cd ../libmambapy 42 | rm -rf build 43 | $PYTHON -m pip install . -vv 44 | find libmambapy/bindings* -type f -print0 | xargs -0 rm -f -- 45 | fi 46 | -------------------------------------------------------------------------------- /test-data/recipes/ruby-imports-test/recipe.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: ruby-imports-test 3 | version: 0.1.0 4 | 5 | build: 6 | number: 0 7 | script: 8 | interpreter: ruby 9 | content: | 10 | # Create a simple Ruby module that can be required 11 | require 'fileutils' 12 | 13 | # Create a lib directory in the PREFIX 14 | lib_dir = File.join(ENV['PREFIX'], 'lib', 'ruby') 15 | FileUtils.mkdir_p(lib_dir) 16 | 17 | # Write a simple module file 18 | module_content = <<~RUBY 19 | module MyTestModule 20 | def self.hello 21 | puts "Hello from MyTestModule!" 22 | end 23 | end 24 | RUBY 25 | 26 | File.write(File.join(lib_dir, 'my_test_module.rb'), module_content) 27 | 28 | # Also install a gem-like structure 29 | site_ruby_dir = File.join(ENV['PREFIX'], 'lib', 'ruby', 'site_ruby') 30 | FileUtils.mkdir_p(site_ruby_dir) 31 | 32 | gem_content = <<~RUBY 33 | module TestGem 34 | VERSION = "1.0.0" 35 | 36 | def self.version 37 | VERSION 38 | end 39 | end 40 | RUBY 41 | 42 | File.write(File.join(site_ruby_dir, 'test_gem.rb'), gem_content) 43 | 44 | requirements: 45 | build: 46 | - ruby 47 | 48 | tests: 49 | - ruby: 50 | requires: 51 | - fileutils 52 | - json 53 | - pathname 54 | 55 | about: 56 | summary: Test package for Ruby require testing 57 | license: MIT 58 | --------------------------------------------------------------------------------