Skip to content

Merge with main #3815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
c6450b2
fix a typo in deep_dive.rst (#3377)
rongpenl Sep 23, 2023
73e30ce
Several GitHub actions updates (#3397)
behackl Oct 9, 2023
571f79b
rtd: enable htmlzip build (#3355)
naveen521kk Oct 9, 2023
684014a
fix(docs): Remove extra curly bracket in LaTeX math expression to fix…
u7481690 Oct 10, 2023
7fab9cd
Bug fix: Use np.isclose for float equality in number line elongated t…
hari387 Oct 12, 2023
94df2c4
Updated several dependencies (#3399)
behackl Oct 22, 2023
7ad7e99
pyproject.toml: update manimpango version (#3405)
naveen521kk Oct 22, 2023
8320cdd
Added docs for functions in `mobject_update_utils` (#3325)
JasonGrace2282 Oct 23, 2023
b048695
Fix tests to run on Cairo 1.18.0 (#3416)
naveen521kk Oct 25, 2023
76b4061
Fix: Fixed a bug in regards to empty inputs in AddTextLetterByLetter …
Immanuel-Alvaro-Bhirawa Oct 26, 2023
5193e1c
Introduce new workflow creating a downloadable version of the documen…
behackl Oct 26, 2023
b7eefca
Fix incorrect submobject count of multi-part Tex/MathTex mobjects by …
behackl Oct 27, 2023
b7a8a2d
CI: fix caching of cairo (#3419)
naveen521kk Oct 27, 2023
5d73525
Fix CSV reader adding empty lists in rendering summary (#3430)
JasonGrace2282 Nov 2, 2023
190ae5d
Fix None check order in _tree_layout (#3421)
Nikhil-42 Nov 2, 2023
1b88099
Bump teatimeguest/setup-texlive-action from 2 to 3 (#3431)
dependabot[bot] Nov 2, 2023
25bb381
bump dependencies -- see #3241 (#3433)
haraldschilly Nov 3, 2023
d77a47a
Fix Typing (#3086)
MrDiver Nov 3, 2023
652f1b3
fix: issue with ImageMobject bounding box (#3340)
vaclavblazej Nov 4, 2023
8fe1665
chore(deps): add Python 3.12 support (#3395)
jeertmans Nov 4, 2023
3962a12
Added ability to remove non-svg LaTeX files (#3322)
JasonGrace2282 Nov 4, 2023
20028ce
feat: DecimalNumber() - added spacing between values and unit (#3366)
uwezi Nov 4, 2023
adfef5e
Add option to run examples directly with binder (#3427)
naveen521kk Nov 10, 2023
e66c580
Prepare v0.18.0 (#3439)
behackl Nov 11, 2023
4315549
Fixed wrong path in action building downloadable docs (#3450)
behackl Nov 12, 2023
94711f7
Allow accessing ghost vectors in :class:`.LinearTransformationScene` …
JasonGrace2282 Nov 19, 2023
212bca0
Add type hints to `_config` (#3440)
Viicos Nov 20, 2023
28bf4dd
Fix Idicate docs typo (#3461)
Lawqup Nov 20, 2023
7cead84
Update indication.py (#3477)
jcep Nov 30, 2023
6949c66
Optimized `get_unit_normal()` and replaced `np.cross()` with custom `…
chopan050 Dec 6, 2023
61a2d05
Update dependency constraints, fix deprecation warnings (#3376)
Viicos Dec 6, 2023
7590086
fix 360° to 180° in quickstart tutorial (#3498)
Dec 6, 2023
40766cb
Update Docker base image to python3.12-slim (#3458) (#3459)
melodysium Dec 6, 2023
27d5360
fix line_join to joint_type in example_scenes/basic.py (#3510)
Dec 9, 2023
0cba710
fix typo in docstring for DtUpdater example: line -> square (#3509)
yuan-xy Dec 9, 2023
370d883
Implement caching of fonts list to improve runtime performance (#3316)
MrDiver Dec 10, 2023
3f118e4
Removed deprecated new command (#3512)
chopan050 Dec 10, 2023
03f9d4b
Added `cap_style` feature to `VMobject` (#3516)
MathItYT Dec 10, 2023
018e4a3
feat(cli): optionally hide version splash (#3329)
jeertmans Dec 10, 2023
64a0e9d
Reformatting the `--save_sections` output to have the format `<Scene>…
doaamuham Dec 10, 2023
9a35756
Explain ``.Transform`` vs ``.ReplacementTransform`` in quickstart exa…
JasonGrace2282 Dec 10, 2023
18a7294
Fix formatting building blocks (#3515)
MrDiver Dec 12, 2023
912ae76
Bump jupyter-server from 2.9.1 to 2.11.2 (#3497)
dependabot[bot] Dec 12, 2023
0a24cad
Account for dtype in the pixel array so the maximum value stays corre…
jeertmans Dec 12, 2023
9938bf5
Added `grid_lines` attribute to `Rectangle` to add individual styling…
RobinPH Dec 12, 2023
d390978
Fix rectangle grid properties (#3082) (#3513)
pauluhlenbruck Dec 12, 2023
1704374
Fix animations with zero runtime length to give a useful error instea…
MrDiver Dec 12, 2023
98a7f42
fixed the stroke width issue with single color in streamlines (#3436)
yashm277 Dec 12, 2023
fc42710
Add Documentation to `.to_edge` and `to_corner` (#3408)
TheMathematicFanatic Dec 13, 2023
b69e1d7
Adding the ability to pass lists and generators to .play() (#3365)
MrDiver Dec 13, 2023
cac608b
follow-up to #3491, made errors more consistent. fixes #3527
behackl Dec 17, 2023
196fa1f
chore(docs): add some words about Cairo 1.18 (#3530)
jeertmans Dec 17, 2023
8ea8f25
Fix formatting of ``MoveAlongPath`` docs (#3541)
JasonGrace2282 Dec 21, 2023
dd327a3
Fixed Animate Type-hint (#3543)
JasonGrace2282 Dec 21, 2023
3037f0e
Remove wag method from Mobject (#3539)
JasonGrace2282 Dec 22, 2023
34e7d68
Fix typo of `get_y_axis_label` docstring (#3547)
yuan-xy Dec 23, 2023
9b18a86
Finish TODO's in ``contributing/typings.rst`` (#3545)
JasonGrace2282 Dec 24, 2023
472eaae
Fix use of `Mobject`'s deprecated `get_*()` and `set_*()` methods in …
JasonGrace2282 Dec 26, 2023
4a963c4
add note in docstring of ManimColor about class constructors (#3554)
JasonGrace2282 Dec 28, 2023
02391d7
Added support for Manim type aliases in Sphinx docs + Added new TypeA…
chopan050 Dec 29, 2023
286f366
Improve documentation section about contributing to docs (#3555)
chopan050 Dec 29, 2023
3b496ea
Add helpful hints to `VGroup.add()` error message (#3561)
vvolhejn Jan 2, 2024
4e3cfd2
exception add if new_rings is none (#3574)
hydromelvictor Jan 11, 2024
9a84ec6
Fix typing of `Animation` (#3568)
dandavison Jan 13, 2024
a57fb69
Add 'to be used in the future' TODOs to ManimFrame (#3553)
chopan050 Jan 15, 2024
68bd790
Refactor `TexTemplate` (#3520)
Viicos Jan 15, 2024
775482b
Bump github/codeql-action from 2 to 3 (#3567)
dependabot[bot] Jan 24, 2024
9d880c2
Bump actions/upload-artifact from 3 to 4 (#3566)
dependabot[bot] Jan 24, 2024
9289a5c
Bump actions/setup-python from 4 to 5 (#3565)
dependabot[bot] Jan 24, 2024
8264595
updated several packages (pillow, jupyterlab, notebook, jupyterlab-ls…
behackl Jan 24, 2024
7006d6b
Removed -s / --save_last_frame flag from CLI arguments (#3528)
gixtox Jan 24, 2024
175cb89
fix write_subcaption_file error when using opengl renderer (#3546)
yuan-xy Jan 24, 2024
f8b5066
Update docker.rst to use bash from the PATH (#3582)
NotWearingPants Jan 24, 2024
d0fe0c3
fix typo in value_tracker.py (#3594)
yuan-xy Jan 25, 2024
e2cec98
fix `get_arc_center()` returning reference of point (#3599)
sparshg Feb 1, 2024
f70980a
Add ref_class (#3598)
JasonGrace2282 Feb 1, 2024
65d352d
Fix typehint (#3592)
JasonGrace2282 Feb 1, 2024
1520481
Update ci.yml (#3611)
behackl Feb 2, 2024
ed1b203
fix type hint of indication.py (#3613)
yuan-xy Feb 4, 2024
011c36a
Revert vector type aliases to NumPy ndarrays (#3595)
chopan050 Feb 12, 2024
fcd81b2
Improve handling of specified font name (#3429)
staghado Feb 13, 2024
206f874
Remove support for dynamic plugin imports (#3524)
Viicos Feb 15, 2024
c7e7ca2
Run poetry lock --no-update (#3621)
JasonGrace2282 Feb 15, 2024
77d42d2
Update jupyter.rst (#3630)
abul4fia Feb 23, 2024
9f3d486
Fix Vector3 -> Vector3D in contributing docs (#3639)
JasonGrace2282 Mar 17, 2024
f65ebf2
Bump black from 23.12.1 to 24.3.0 (#3649)
dependabot[bot] Apr 1, 2024
d1cf1c5
Bump cryptography from 42.0.0 to 42.0.4 (#3629)
dependabot[bot] Apr 1, 2024
7a794e3
Code Cleanup: removing unused imports and global variables (#3620)
JasonGrace2282 Apr 1, 2024
909ffde
Fixing the behavior of `.become` to not modify target mobject via sid…
MrDiver Apr 1, 2024
afe1d18
Added some examples for `Mobject`/`VMobject` methods (#3641)
JasonGrace2282 Apr 1, 2024
ef675b6
Fix typehint of `Vector` direction parameter (#3640)
JasonGrace2282 Apr 2, 2024
c025be6
Fix bug in :class:`.VMobjectFromSVGPath` (#3677)
abul4fia Apr 8, 2024
1aad0c7
Flake8 rule C901 is about McCabe code complexity (#3673)
cclauss Apr 9, 2024
7936c7d
Fix broken link to Poetry's installation guide in the first time cont…
chinzhening Apr 11, 2024
d62a04f
Fix minor grammatical errors found in the index page of the documenta…
chinzhening Apr 11, 2024
a6da37b
fix(LICENSE): update year (#3689)
JasonGrace2282 Apr 11, 2024
294313d
Remove deprecated parameters and animations (#3688)
JasonGrace2282 Apr 11, 2024
93cf85c
Attempted fix for windows cp1252 encoding failure (#3687)
JasonGrace2282 Apr 11, 2024
b750152
Fix typo (#3696)
chinzhening Apr 12, 2024
aef8184
Docs: fix out-dated CLI option in Manim's Output Settings (#3674)
HairlessVillager Apr 13, 2024
902c3f4
only do actions if try succeeded (#3694)
JasonGrace2282 Apr 14, 2024
2a4c2da
Mention pixi in installation guide (#3678)
pavelzw Apr 14, 2024
2776612
Fix successive calls of :meth:`.LinearTransformationScene.apply_matri…
SirJamesClarkMaxwell Apr 14, 2024
a45c0d4
Bump actions/cache from 3 to 4 (#3607)
dependabot[bot] Apr 14, 2024
dc0db41
Bump FedericoCarboni/setup-ffmpeg from 2 to 3 (#3608)
dependabot[bot] Apr 14, 2024
04bfa22
Bump ssciwr/setup-mesa-dist-win from 1 to 2 (#3609)
dependabot[bot] Apr 14, 2024
5139765
docs: update typing guidelines (#3704)
JasonGrace2282 Apr 17, 2024
f9dc9c7
Update documentation and typings for `ParametricFunction` (#3703)
xyzqm Apr 19, 2024
679b89a
fix(copyright): automate copyright updating for docs (#3708)
JasonGrace2282 Apr 19, 2024
f8e3408
Fix some typehints in mobject.py (#3668)
JasonGrace2282 Apr 20, 2024
83957b9
Bump idna from 3.6 to 3.7 (#3693)
dependabot[bot] Apr 21, 2024
dff83be
Bump pillow from 10.2.0 to 10.3.0 (#3672)
dependabot[bot] Apr 21, 2024
563810a
Fix typo (#3721)
TheCrowned Apr 24, 2024
0fd16b8
Fixed `Mobject.put_start_and_end_on` with same start and end point (#…
MontroyJosh Apr 24, 2024
1aee37b
[pre-commit.ci] pre-commit autoupdate (#3332)
pre-commit-ci[bot] Apr 24, 2024
a4e5233
fix(autoaliasattr): search for type aliases under if TYPE_CHECKING (#…
JasonGrace2282 Apr 24, 2024
c32f0fd
build(deps): read-the-docs sphinx (#3720)
JasonGrace2282 Apr 24, 2024
aa3e2cf
Fix issue where SpiralIn doesn't show elements. (#3589)
gixtox Apr 24, 2024
a3adcaa
Clean Graph layouts and increase flexibility (#3434)
Nikhil-42 Apr 24, 2024
0f268e6
Follow-up to graph layout cleanup: improvements for tests and typing …
behackl Apr 24, 2024
791a892
Update coordinate_systems.py (#3730)
amrear Apr 26, 2024
a3d584b
build(ci): change from macos-latest to macos-13 (#3729)
JasonGrace2282 Apr 26, 2024
98641a2
Add ``--preview_command`` cli flag (#3615)
JasonGrace2282 Apr 27, 2024
1ce3edd
AnimationGroup: optimized interpolate() and fixed alpha bug on finish…
chopan050 Apr 27, 2024
c4e7502
Fixed ```get_anchors()``` Return Type Inconsistency (#3214)
JinchuLi2002 Apr 27, 2024
6cb89a0
fixed [""] being set as loaded plugins (#3734)
behackl Apr 27, 2024
33e5604
Prepare new release: v0.18.1 (#3719)
behackl Apr 28, 2024
4a0c705
feat: Add three animations that together simulate a typing animation …
VinhPhmCng Apr 28, 2024
a56c0c9
Fix release documentation building (#3737)
JasonGrace2282 Apr 28, 2024
31f1895
[pre-commit.ci] pre-commit autoupdate (#3739)
pre-commit-ci[bot] Apr 29, 2024
93c601f
Fixes #3744 (#3745)
anagorko May 3, 2024
e4ee9a0
Bump tqdm from 4.66.1 to 4.66.3 (#3746)
dependabot[bot] May 4, 2024
94cd27c
Bump jinja2 from 3.1.3 to 3.1.4 (#3750)
dependabot[bot] May 6, 2024
4bd2f86
Add typehints to `manim.utils.iterables` (#3751)
JasonGrace2282 May 12, 2024
1f249e4
Let `SceneFileWriter` access `ffmpeg` via `av` instead of via externa…
behackl May 15, 2024
203a536
Use --py39-plus in pre-commit (#3761)
JasonGrace2282 May 15, 2024
b415604
Optimized `manim.utils.bezier.is_closed()` (#3768)
chopan050 May 20, 2024
7b841c2
Created and optimized Bézier splitting functions such as `partial_bez…
chopan050 May 21, 2024
7399585
Bump requests to 2.32.0 (#3776)
dependabot[bot] May 21, 2024
0d67dcd
Fix assertions and improve error messages when adding submobjects (#3…
chopan050 May 21, 2024
21eb0b7
Add pyproject for ruff formatting (#3777)
JasonGrace2282 May 22, 2024
24025b6
pre-commit change to ruff (#3779)
JasonGrace2282 May 22, 2024
c9776be
Ignore Ruff format in git blame (#3781)
Viicos May 22, 2024
0a2fbbe
Fixed `there_and_back_with_pause()` rate function behaviour with diff…
jkjkil4 May 22, 2024
938b8fc
Optimize VMobject methods which append to points (#3765)
chopan050 May 23, 2024
90ae6ad
Add `@` shorthand for `CoordinateSystem` methods `coords_to_point` (`…
JasonGrace2282 May 27, 2024
31df6d0
[pre-commit.ci] pre-commit autoupdate (#3784)
pre-commit-ci[bot] May 27, 2024
aec3d86
[pre-commit.ci] pre-commit autoupdate (#3794)
pre-commit-ci[bot] Jun 4, 2024
252aac3
Add Ruff Lint (#3780)
JasonGrace2282 Jun 4, 2024
e74f37e
Replace Pyupgrade with Ruff rule (#3795)
JasonGrace2282 Jun 5, 2024
e30ed6e
Bump tornado from 6.4 to 6.4.1 (#3796)
dependabot[bot] Jun 10, 2024
c2fa4f9
Update opengl_vectorized_mobject.py (#3790)
yang-tsao Jun 10, 2024
ece1235
[pre-commit.ci] pre-commit autoupdate (#3801)
pre-commit-ci[bot] Jun 10, 2024
4641c0a
Add typings to `OpenGLMobject` (#3803)
chopan050 Jun 13, 2024
3ed86a8
fix: importing manim should not trigger pygments.styles.get_all_style…
goldenphoenix713 Jun 17, 2024
7802e73
[pre-commit.ci] pre-commit autoupdate (#3809)
pre-commit-ci[bot] Jun 17, 2024
56354af
Bump urllib3 from 2.2.1 to 2.2.2 (#3810)
dependabot[bot] Jun 18, 2024
82ff488
Update macos packages (#3812)
JasonGrace2282 Jun 19, 2024
89d5ed4
Fixed infinite loop in OpenGL `BackgroundRectangle.get_color()` (#3732)
camburd2 Jun 21, 2024
ec1a661
Merge branch 'main' of https://github.com/ManimCommunity/manim into m…
JasonGrace2282 Jun 21, 2024
0db003c
Some fixes for interpolation
MrDiver Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .codespell_ignorelines

This file was deleted.

5 changes: 5 additions & 0 deletions .codespell_ignorewords
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nam
sherif
falsy
medias
strager
6 changes: 3 additions & 3 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[codespell]
exclude-file=.codespell_ignorelines
check-hidden=True
ignore-words-list = nam,sherif,falsy
check-hidden = True
skip = .git,*.js,*.js.map,*.css,*.css.map,*.html,*.po,*.pot,poetry.lock,*.log,*.svg
ignore-words = .codespell_ignorewords
15 changes: 8 additions & 7 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
[flake8]
# Exclude the grpc generated code
exclude = ./manim/grpc/gen/*
max-complexity = 15
exclude = ./manim/grpc/gen/*, __pycache__,.git,
per-file-ignores = __init__.py:F401
max-complexity = 29
max-line-length = 88
statistics = True
# Prevents some flake8-rst-docstrings errors
rst-roles = attr,class,func,meth,mod,obj,ref,doc,exc
rst-directives = manim, SEEALSO, seealso
docstring-convention=numpy

select = A,A00,B,B9,C4,C90,D,E,F,F,PT,RST,SIM,W
select = A,A00,B,B9,C4,C90,D,E,F,F,PT,RST,SIM,W,F401

# General Compatibility
extend-ignore = E203, W503, D202, D212, D213, D404

# Misc
F401, F403, F405, F841, E501, E731, E402, F811, F821,

# multiple statements on one line (overload)
E704,

# Plug-in: flake8-builtins
A001, A002, A003,

Expand All @@ -26,9 +30,6 @@ extend-ignore = E203, W503, D202, D212, D213, D404
# Plug-in: flake8-simplify
SIM105, SIM106, SIM119,

# Plug-in: flake8-comprehensions
C901

# Plug-in: flake8-pytest-style
PT001, PT004, PT006, PT011, PT018, PT022, PT023,

Expand All @@ -40,4 +41,4 @@ extend-ignore = E203, W503, D202, D212, D213, D404

# Plug-in: flake8-rst-docstrings
RST201, RST203, RST210, RST212, RST213, RST215,
RST301, RST303,
RST301, RST303, RST499
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Switched to ruff format:
24025b60d57301b0a59754c38d77bccd8ed69feb
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,5 @@ PASTE HERE
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
PASTE HERE
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/installation_issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,5 @@ PASTE HERE
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
PASTE HERE
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->
10 changes: 8 additions & 2 deletions .github/manimdependency.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"standalone",
"preview",
"doublestroke",
"ms",
"count1to",
"multitoc",
"prelim2e",
"ragged2e",
"everysel",
"setspace",
"rsfs",
Expand All @@ -29,7 +32,10 @@
"standalone",
"preview",
"doublestroke",
"ms",
"count1to",
"multitoc",
"prelim2e",
"ragged2e",
"everysel",
"setspace",
"rsfs",
Expand Down
209 changes: 209 additions & 0 deletions .github/scripts/ci_build_cairo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# Logic is as follows:
# 1. Download cairo source code: https://cairographics.org/releases/cairo-<version>.tar.xz
# 2. Verify the downloaded file using the sha256sums file: https://cairographics.org/releases/cairo-<version>.tar.xz.sha256sum
# 3. Extract the downloaded file.
# 4. Create a virtual environment and install meson and ninja.
# 5. Run meson build in the extracted directory. Also, set required prefix.
# 6. Run meson compile -C build.
# 7. Run meson install -C build.

import hashlib
import logging
import os
import subprocess
import sys
import tarfile
import tempfile
import typing
import urllib.request
from contextlib import contextmanager
from pathlib import Path
from sys import stdout

CAIRO_VERSION = "1.18.0"
CAIRO_URL = f"https://cairographics.org/releases/cairo-{CAIRO_VERSION}.tar.xz"
CAIRO_SHA256_URL = f"{CAIRO_URL}.sha256sum"

VENV_NAME = "meson-venv"
BUILD_DIR = "build"
INSTALL_PREFIX = Path(__file__).parent.parent.parent / "third_party" / "cairo"

logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger(__name__)


def is_ci():
return os.getenv("CI", None) is not None


def download_file(url, path):
logger.info(f"Downloading {url} to {path}")
block_size = 1024 * 1024
with urllib.request.urlopen(url) as response, open(path, "wb") as file:
while True:
data = response.read(block_size)
if not data:
break
file.write(data)


def verify_sha256sum(path, sha256sum):
with open(path, "rb") as file:
file_hash = hashlib.sha256(file.read()).hexdigest()
if file_hash != sha256sum:
raise Exception("SHA256SUM does not match")


def extract_tar_xz(path, directory):
with tarfile.open(path) as file:
file.extractall(directory)


def run_command(command, cwd=None, env=None):
process = subprocess.Popen(command, cwd=cwd, env=env)
process.communicate()
if process.returncode != 0:
raise Exception("Command failed")


@contextmanager
def gha_group(title: str) -> typing.Generator:
if not is_ci():
yield
return
print(f"\n::group::{title}")
stdout.flush()
try:
yield
finally:
print("::endgroup::")
stdout.flush()


def set_env_var_gha(name: str, value: str) -> None:
if not is_ci():
return
env_file = os.getenv("GITHUB_ENV", None)
if env_file is None:
return
with open(env_file, "a") as file:
file.write(f"{name}={value}\n")
stdout.flush()


def get_ld_library_path(prefix: Path) -> str:
# given a prefix, the ld library path can be found at
# <prefix>/lib/* or sometimes just <prefix>/lib
# this function returns the path to the ld library path

# first, check if the ld library path exists at <prefix>/lib/*
ld_library_paths = list(prefix.glob("lib/*"))
if len(ld_library_paths) == 1:
return ld_library_paths[0].absolute().as_posix()

# if the ld library path does not exist at <prefix>/lib/*,
# return <prefix>/lib
ld_library_path = prefix / "lib"
if ld_library_path.exists():
return ld_library_path.absolute().as_posix()
return ""


def main():
if sys.platform == "win32":
logger.info("Skipping build on windows")
return

with tempfile.TemporaryDirectory() as tmpdir:
with gha_group("Downloading and Extracting Cairo"):
logger.info(f"Downloading cairo version {CAIRO_VERSION}")
download_file(CAIRO_URL, os.path.join(tmpdir, "cairo.tar.xz"))

logger.info("Downloading cairo sha256sum")
download_file(CAIRO_SHA256_URL, os.path.join(tmpdir, "cairo.sha256sum"))

logger.info("Verifying cairo sha256sum")
with open(os.path.join(tmpdir, "cairo.sha256sum")) as file:
sha256sum = file.read().split()[0]
verify_sha256sum(os.path.join(tmpdir, "cairo.tar.xz"), sha256sum)

logger.info("Extracting cairo")
extract_tar_xz(os.path.join(tmpdir, "cairo.tar.xz"), tmpdir)

with gha_group("Installing meson and ninja"):
logger.info("Creating virtual environment")
run_command([sys.executable, "-m", "venv", os.path.join(tmpdir, VENV_NAME)])

logger.info("Installing meson and ninja")
run_command(
[
os.path.join(tmpdir, VENV_NAME, "bin", "pip"),
"install",
"meson",
"ninja",
]
)

env_vars = {
# add the venv bin directory to PATH so that meson can find ninja
"PATH": f"{os.path.join(tmpdir, VENV_NAME, 'bin')}{os.pathsep}{os.environ['PATH']}",
}

with gha_group("Building and Installing Cairo"):
logger.info("Running meson setup")
run_command(
[
os.path.join(tmpdir, VENV_NAME, "bin", "meson"),
"setup",
BUILD_DIR,
f"--prefix={INSTALL_PREFIX.absolute().as_posix()}",
"--buildtype=release",
"-Dtests=disabled",
],
cwd=os.path.join(tmpdir, f"cairo-{CAIRO_VERSION}"),
env=env_vars,
)

logger.info("Running meson compile")
run_command(
[
os.path.join(tmpdir, VENV_NAME, "bin", "meson"),
"compile",
"-C",
BUILD_DIR,
],
cwd=os.path.join(tmpdir, f"cairo-{CAIRO_VERSION}"),
env=env_vars,
)

logger.info("Running meson install")
run_command(
[
os.path.join(tmpdir, VENV_NAME, "bin", "meson"),
"install",
"-C",
BUILD_DIR,
],
cwd=os.path.join(tmpdir, f"cairo-{CAIRO_VERSION}"),
env=env_vars,
)

logger.info(f"Successfully built cairo and installed it to {INSTALL_PREFIX}")


if __name__ == "__main__":
if "--set-env-vars" in sys.argv:
with gha_group("Setting environment variables"):
# append the pkgconfig directory to PKG_CONFIG_PATH
set_env_var_gha(
"PKG_CONFIG_PATH",
f"{Path(get_ld_library_path(INSTALL_PREFIX), 'pkgconfig').as_posix()}{os.pathsep}"
f'{os.getenv("PKG_CONFIG_PATH", "")}',
)
set_env_var_gha(
"LD_LIBRARY_PATH",
f"{get_ld_library_path(INSTALL_PREFIX)}{os.pathsep}"
f'{os.getenv("LD_LIBRARY_PATH", "")}',
)
sys.exit(0)
main()
2 changes: 1 addition & 1 deletion .github/workflows/cffconvert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check whether the citation metadata from CITATION.cff is valid
uses: citation-file-format/cffconvert-github-action@2.0.0
Expand Down
Loading
Loading