From 394fb50d73ddca7b4891e43ba0ad2172de0b107d Mon Sep 17 00:00:00 2001 From: Iwan Aucamp Date: Sun, 19 Mar 2023 15:50:11 +0100 Subject: [PATCH] fix: include docs and examples in the sdist tarball (#2289) The sdists generated by setuptools included the `docs` and `examples` directories, and they are needed for building docs and running tests using the sdist. This change includes these directories in the sdist tarball. A `test:sdist` task is also added to `Taskfile.yml` which uses the sdists to run pytest and build docs. --- Taskfile.yml | 17 +++++++++++++++++ pyproject.toml | 2 ++ 2 files changed, 19 insertions(+) diff --git a/Taskfile.yml b/Taskfile.yml index ec50b23b3..feb7624c2 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -218,6 +218,8 @@ tasks: - task: venv:clean - task: _rimraf vars: { RIMRAF_TARGET: ".var/devcontainer" } + - task: _rimraf + vars: { RIMRAF_TARGET: "var/test-sdist" } test:data:fetch: desc: Fetch test data. @@ -342,6 +344,21 @@ tasks: > "${plantuml_file%.*}.svg" done + test:sdist: + desc: Run tests on the sdist artifact + cmds: + - task: _rimraf + vars: { RIMRAF_TARGET: "dist" } + - task: _rimraf + vars: { RIMRAF_TARGET: "var/test-sdist" } + - poetry build + - python -c 'import tarfile, glob; tarfile.open(glob.glob("dist/*.tar.gz")[0]).extractall("var/test-sdist")' + - | + cd var/test-sdist/rdflib-* + poetry install + poetry run mypy --show-error-context --show-error-codes -p rdflib + poetry run sphinx-build -T -W -b html -d docs/_build/doctree docs docs/_build/html + poetry run pytest _rimraf: # This task is a utility task for recursively removing directories, it is # similar to rm -rf but not identical and it should work wherever there is diff --git a/pyproject.toml b/pyproject.toml index aa53bdac7..47bfa0943 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,8 @@ packages = [ ] include = [ { path = "test", format = "sdist" }, + { path = "docs", format = "sdist" }, + { path = "examples", format = "sdist" }, ] [tool.poetry.scripts]