Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,18 @@ jobs:
if: ${{ contains(github.event.pull_request.labels.*.name, 'need-patch-apply-tests') && matrix.os == 'windows-latest' }}
run: Add-Content $env:GITHUB_PATH "C:\Program Files\Git\usr\bin"
- uses: prefix-dev/setup-pixi@v0.9.1
if: ${{ contains(github.event.pull_request.labels.*.name, 'need-patch-apply-tests') && matrix.os == 'macos-latest' }}
if: ${{ matrix.os == 'macos-latest' }}
with:
cache: true
- name: Set up GNU patch on MacOS
# Needed to use GNU patch instead of whatever is builtin on macos (1 test fails)
if: ${{ contains(github.event.pull_request.labels.*.name, 'need-patch-apply-tests') && matrix.os == 'macos-latest' }}
run: pixi global install patch=2.7.6
- name: Set up patchelf on MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: pixi global install patchelf
- name: Run tests
run: cargo test --features=tui,recipe-generation --verbose -- --nocapture
run: cargo test --all --features=tui,recipe-generation --verbose -- --nocapture
- name: Run patch apply tests
# https://github.com/orgs/community/discussions/26261#discussioncomment-3251039
if: ${{ contains(github.event.pull_request.labels.*.name, 'need-patch-apply-tests') }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
source: crates/rattler_build_recipe_generator/src/pypi.rs
expression: recipe
---
context:
version: 3.1.0
package:
name: flask
version: "${{ version }}"
source:
- url: "https://pypi.org/packages/source/f/flask/flask-${{ version }}.tar.gz"
sha256: 5f873c5184c897c8d9d1b05df1e3d01b14910ce69607a117bd3277098a5836ac
build:
script: "${{ PYTHON }} -m pip install ."
python:
entry_points:
- "flask = flask.cli:main"
noarch: python
requirements:
host:
- python >=3.9
- flit_core<4
- pip
run:
- python >=3.9
- werkzeug >=3.1
- jinja2 >=3.1.2
- itsdangerous >=2.2
- click >=8.1.3
- blinker >=1.9
- "importlib-metadata >=3.6 ;MARKER; python_version < \"3.10\""
- "asgiref >=3.2 ;MARKER; extra == \"async\""
- "python-dotenv ;MARKER; extra == \"dotenv\""
tests:
- python:
imports:
- Flask
pip_check: true
about:
summary: A simple framework for building complex web applications.
description: "# Flask\n\nFlask is a lightweight [WSGI][] web application framework. It is designed\nto make getting started quick and easy, with the ability to scale up to\ncomplex applications. It began as a simple wrapper around [Werkzeug][]\nand [Jinja][], and has become one of the most popular Python web\napplication frameworks.\n\nFlask offers suggestions, but doesn't enforce any dependencies or\nproject layout. It is up to the developer to choose the tools and\nlibraries they want to use. There are many extensions provided by the\ncommunity that make adding new functionality easy.\n\n[WSGI]: https://wsgi.readthedocs.io/\n[Werkzeug]: https://werkzeug.palletsprojects.com/\n[Jinja]: https://jinja.palletsprojects.com/\n\n\n## A Simple Example\n\n```python\n# save this as app.py\nfrom flask import Flask\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef hello():\n return \"Hello, World!\"\n```\n\n```\n$ flask run\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n```\n\n\n## Donate\n\nThe Pallets organization develops and supports Flask and the libraries\nit uses. In order to grow the community of contributors and users, and\nallow the maintainers to devote more time to the projects, [please\ndonate today][].\n\n[please donate today]: https://palletsprojects.com/donate\n\n"
documentation: "https://flask.palletsprojects.com/"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
source: crates/rattler_build_recipe_generator/src/pypi.rs
expression: recipe
---
context:
version: 1.24.0
package:
name: numpy
version: "${{ version }}"
source:
- url: "https://pypi.org/packages/source/n/numpy/numpy-${{ version }}.tar.gz"
sha256: c4ab7c9711fe6b235e86487ca74c1b092a6dd59a3cb45b63241ea0a148501853
build:
script: "${{ PYTHON }} -m pip install ."
python:
entry_points:
- "f2py = numpy.f2py.f2py2e:main"
- "f2py3 = numpy.f2py.f2py2e:main"
- "f2py3.10 = numpy.f2py.f2py2e:main"
requirements:
host:
- python >=3.8
- setuptools==59.2.0
- wheel==0.37.0
- "Cython>=0.29.30,<3.0"
- pip
run:
- python >=3.8
tests:
- python:
imports:
- numpy
pip_check: true
about:
homepage: "https://www.numpy.org"
summary: Fundamental package for array computing in Python
description: "<h1 align=\"center\">\n<img src=\"/branding/logo/primary/numpylogo.svg\" width=\"300\">\n</h1><br>\n\n\n[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](\nhttps://numfocus.org)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/numpy.svg?label=PyPI%20downloads)](\nhttps://pypi.org/project/numpy/)\n[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/numpy.svg?label=Conda%20downloads)](\nhttps://anaconda.org/conda-forge/numpy)\n[![Stack Overflow](https://img.shields.io/badge/stackoverflow-Ask%20questions-blue.svg)](\nhttps://stackoverflow.com/questions/tagged/numpy)\n[![Nature Paper](https://img.shields.io/badge/DOI-10.1038%2Fs41592--019--0686--2-blue)](\nhttps://doi.org/10.1038/s41586-020-2649-2)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/numpy/numpy/badge)](https://api.securityscorecards.dev/projects/github.com/numpy/numpy)\n\n\nNumPy is the fundamental package for scientific computing with Python.\n\n- **Website:** https://www.numpy.org\n- **Documentation:** https://numpy.org/doc\n- **Mailing list:** https://mail.python.org/mailman/listinfo/numpy-discussion\n- **Source code:** https://github.com/numpy/numpy\n- **Contributing:** https://www.numpy.org/devdocs/dev/index.html\n- **Bug reports:** https://github.com/numpy/numpy/issues\n- **Report a security vulnerability:** https://tidelift.com/docs/security\n\nIt provides:\n\n- a powerful N-dimensional array object\n- sophisticated (broadcasting) functions\n- tools for integrating C/C++ and Fortran code\n- useful linear algebra, Fourier transform, and random number capabilities\n\nTesting:\n\nNumPy requires `pytest` and `hypothesis`. Tests can then be run after installation with:\n\n python -c 'import numpy; numpy.test()'\n\nCode of Conduct\n----------------------\n\nNumPy is a community-driven open source project developed by a diverse group of\n[contributors](https://numpy.org/teams/). The NumPy leadership has made a strong\ncommitment to creating an open, inclusive, and positive community. Please read the\n[NumPy Code of Conduct](https://numpy.org/code-of-conduct/) for guidance on how to interact\nwith others in a way that makes our community thrive.\n\nCall for Contributions\n----------------------\n\nThe NumPy project welcomes your expertise and enthusiasm!\n\nSmall improvements or fixes are always appreciated. If you are considering larger contributions\nto the source code, please contact us through the [mailing\nlist](https://mail.python.org/mailman/listinfo/numpy-discussion) first.\n\nWriting code isn’t the only way to contribute to NumPy. You can also:\n- review pull requests\n- help us stay on top of new and old issues\n- develop tutorials, presentations, and other educational materials\n- maintain and improve [our website](https://github.com/numpy/numpy.org)\n- develop graphic design for our brand assets and promotional materials\n- translate website content\n- help with outreach and onboard new contributors\n- write grant proposals and help with other fundraising efforts\n\nFor more information about the ways you can contribute to NumPy, visit [our website](https://numpy.org/contribute/). \nIf you’re unsure where to start or how your skills fit in, reach out! You can\nask on the mailing list or here, on GitHub, by opening a new issue or leaving a\ncomment on a relevant issue that is already open.\n\nOur preferred channels of communication are all public, but if you’d like to\nspeak to us in private first, contact our community coordinators at\nnumpy-team@googlegroups.com or on Slack (write numpy-team@googlegroups.com for\nan invitation).\n\nWe also have a biweekly community call, details of which are announced on the\nmailing list. You are very welcome to join.\n\nIf you are new to contributing to open source, [this\nguide](https://opensource.guide/how-to-contribute/) helps explain why, what,\nand how to successfully get involved.\n\n\n"
license: BSD-3-Clause
repository: "https://github.com/numpy/numpy"
documentation: "https://numpy.org/doc/1.24"
15 changes: 9 additions & 6 deletions test-data/recipes/binary_prefix_test/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ build:
- |
setlocal enabledelayedexpansion
set "PREFIX_ESC=%PREFIX:\=\\%"
echo #include ^<stdio.h^> > test_binary.c
echo int main() { >> test_binary.c
echo const char* prefix = "!PREFIX_ESC!"; >> test_binary.c
echo printf("Prefix is: %%s\\n", prefix); >> test_binary.c
echo return 0; >> test_binary.c
echo } >> test_binary.c
(
echo #include ^<stdio.h^>
echo int main() {
echo const char* prefix = "!PREFIX_ESC!";
echo printf("Prefix is: %%s\\n", prefix^);
echo return 0;
echo }
) > test_binary.c
gcc test_binary.c -o "%PREFIX%\Library\bin\test_binary.exe"
if %errorlevel% neq 0 exit /b %errorlevel%

requirements:
build:
Expand Down
16 changes: 13 additions & 3 deletions test/end-to-end/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@ def __call__(self, *args: Any, **kwds: Any) -> Any:
return result
else:
try:
output = check_output([str(self.path), *args], **kwds)
if "text" not in kwds:
return output.decode("utf-8")
# Explicitly handle encoding for UTF-8 output on all platforms
kwds_copy = dict(kwds)
# Check if we need to add encoding
needs_encoding = "text" not in kwds_copy and "encoding" not in kwds_copy
if needs_encoding:
kwds_copy["encoding"] = "utf-8"
kwds_copy["errors"] = "replace"

output = check_output([str(self.path), *args], **kwds_copy)

# If we added encoding, output is already a string
# If text was in kwds, output is also a string
# Otherwise, it's bytes and needs decoding (but we added encoding, so this won't happen)
return output
except CalledProcessError as e:
if kwds.get("stderr") is None:
Expand Down
9 changes: 5 additions & 4 deletions test/end-to-end/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ def test_missing_pin_subpackage(
tmp_path,
stderr=STDOUT,
)
stdout = e.value.output.decode("utf-8")
stdout = e.value.output
assert "Missing output: test1 (used in pin_subpackage)" in stdout


Expand All @@ -1476,7 +1476,7 @@ def test_cycle_detection(rattler_build: RattlerBuild, recipes: Path, tmp_path: P
tmp_path,
stderr=STDOUT,
)
stdout = e.value.output.decode("utf-8")
stdout = e.value.output
assert "Found a cycle in the recipe outputs: bazbus" in stdout


Expand Down Expand Up @@ -1694,7 +1694,7 @@ def test_python_version_spec(
args = rattler_build.build_args(recipes / "python-version-spec", tmp_path)
rattler_build(*args, stderr=STDOUT)

error_output = exc_info.value.output.decode("utf-8")
error_output = exc_info.value.output
assert (
"failed to parse match spec: unable to parse version spec: =.*" in error_output
)
Expand Down Expand Up @@ -2048,6 +2048,7 @@ def test_merge_build_and_host(
)


@pytest.mark.skipif(os.name == "nt", reason="Not applicable on Windows")
def test_error_on_binary_prefix(
rattler_build: RattlerBuild, recipes: Path, tmp_path: Path
):
Expand All @@ -2071,7 +2072,7 @@ def test_error_on_binary_prefix(
rattler_build(*args, stderr=STDOUT)
pytest.fail("Expected build to fail with binary prefix error")
except CalledProcessError as e:
output = e.output.decode("utf-8") if e.output else ""
output = e.output
assert "Binary file" in output and "contains host prefix" in output


Expand Down