Skip to content

Commit

Permalink
Ensure that project can be built.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 12, 2025
1 parent 5fc0c6d commit 01cbb5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 51 deletions.
15 changes: 15 additions & 0 deletions TODO.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Colour - TODO
=============

TODO
----



About
-----

| **Colour** by Colour Developers
| Copyright 2024 Colour Developers - `[email protected] <[email protected]>`__
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour <https://github.com/colour-science/colour>`__
53 changes: 2 additions & 51 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"PYPI_PACKAGE_NAME",
"PYPI_ARCHIVE_NAME",
"BIBLIOGRAPHY_NAME",
"literalise",
"clean",
"formatting",
"quality",
Expand All @@ -66,7 +65,7 @@

PYTHON_PACKAGE_NAME: str = colour_clf_io.__name__

PYPI_PACKAGE_NAME: str = "colour-science-clf-io"
PYPI_PACKAGE_NAME: str = "colour-clf-io"
PYPI_ARCHIVE_NAME: str = PYPI_PACKAGE_NAME.replace("-", "_")

BIBLIOGRAPHY_NAME: str = "BIBLIOGRAPHY.bib"
Expand Down Expand Up @@ -151,24 +150,6 @@ def inner(text: str) -> str:
print_callable("=" * width)


@task
def literalise(ctx: Context) -> None:
"""
Write various literals in the `colour.hints` module.
Parameters
----------
ctx
Context.
"""

message_box("Literalising...")
with ctx.cd("utilities"):
ctx.run("./literalise.py")

ctx.run("pre-commit run --files colour/hints/__init__.py", warn=True)


@task
def clean(
ctx: Context,
Expand Down Expand Up @@ -432,7 +413,7 @@ def requirements(ctx: Context) -> None:
)


@task(literalise, clean, preflight, docs, todo, requirements)
@task(clean, preflight, docs, todo, requirements)
def build(ctx: Context) -> None:
"""
Build the project and runs dependency tasks, i.e., *docs*, *todo*, and
Expand All @@ -445,34 +426,7 @@ def build(ctx: Context) -> None:
"""

message_box("Building...")
if "modified: README.rst" in ctx.run("git status").stdout: # pyright: ignore
msg = 'Please commit your changes to the "README.rst" file!'
raise RuntimeError(msg)

with open("README.rst") as readme_file:
readme_content = readme_file.read()

with open("README.rst", "w") as readme_file:
# Adding the *Colour* logo as the first content line because the *raw*
# directive to support light and dark theme is later trimmed.
readme_content = (
".. image:: https://raw.githubusercontent.com/colour-science/"
"colour-branding/master/images/Colour_Logo_001.png\n" + readme_content
)
readme_file.write(
re.sub(
(
"(\\.\\. begin-trim-long-description.*?"
"\\.\\. end-trim-long-description)"
),
"",
readme_content,
flags=re.DOTALL,
)
)

ctx.run("uv build")
ctx.run("git checkout -- README.rst")
ctx.run("twine check dist/*")


Expand All @@ -495,9 +449,6 @@ def virtualise(ctx: Context, tests: bool = True) -> None:
ctx.run(f"mv {PYPI_ARCHIVE_NAME}-{APPLICATION_VERSION} {unique_name}")
with ctx.cd(unique_name):
ctx.run("uv sync --all-extras --no-dev")
ctx.run(
'uv run python -c "import imageio;imageio.plugins.freeimage.download()"'
)
if tests:
ctx.run(
"source .venv/bin/activate && "
Expand Down

0 comments on commit 01cbb5a

Please sign in to comment.