Skip to content

Commit d09f593

Browse files
authored
Merge pull request #551 from ManimCommunity/build-docs
Fix Manim directive on Windows
2 parents d3ff3fe + d8019cd commit d09f593

File tree

3 files changed

+45
-22
lines changed

3 files changed

+45
-22
lines changed

.github/manimdependency.json

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
{
2-
"windows": {
3-
"ffmpeg": "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.3.1-2020-09-21-full_build.zip",
4-
"pango": "v0.1.0"
5-
}
2+
"windows": {
3+
"ffmpeg": "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.3.1-2020-09-21-full_build.zip",
4+
"pango": "v0.1.0",
5+
"tinytex": [
6+
"standalone",
7+
"preview",
8+
"doublestroke",
9+
"ms",
10+
"setspace",
11+
"rsfs",
12+
"relsize",
13+
"ragged2e",
14+
"fundus-calligra",
15+
"microtype",
16+
"wasysym",
17+
"physics",
18+
"dvisvgm",
19+
"jknapltx",
20+
"wasy",
21+
"cm-super",
22+
"babel-english"
23+
]
24+
}
625
}

.github/workflows/ci.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
- master
4+
branches:
5+
- master
66
pull_request:
7-
branches:
8-
- master
7+
branches:
8+
- master
99

1010
jobs:
1111
test:
1212
runs-on: ${{ matrix.os }}
1313
env:
14-
POETRY_VIRTUALENVS_CREATE: false
14+
POETRY_VIRTUALENVS_CREATE: false
1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
os: [ubuntu-latest, macos-latest, windows-latest]
19-
python: [3.6,3.7, 3.8]
19+
python: [3.6, 3.7, 3.8]
2020

2121
steps:
2222
- name: Checkout the repository
@@ -36,8 +36,8 @@ jobs:
3636
shell: bash
3737
id: pip-cache-and-time
3838
run: |
39-
echo "::set-output name=dir::$(pip cache dir)"
40-
echo "::set-output name=date::$(/bin/date -u "+%m%Y")"
39+
echo "::set-output name=dir::$(pip cache dir)"
40+
echo "::set-output name=date::$(/bin/date -u "+%m%Y")"
4141
4242
- name: pip cache
4343
uses: actions/cache@v2
@@ -73,27 +73,31 @@ jobs:
7373
if: runner.os == 'Windows'
7474
uses: actions/cache@v2
7575
with:
76-
path: ${{ github.workspace }}\ManimCache
77-
key: ${{ runner.os }}-dependencies-ffmpeg-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.pip-cache-and-time.outputs.date }}
76+
path: ${{ github.workspace }}\ManimCache
77+
key: ${{ runner.os }}-dependencies-ffmpeg-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.pip-cache-and-time.outputs.date }}
7878

7979
- name: Download system dependencies (Windows)
8080
if: runner.os == 'Windows' && steps.cache-windows.outputs.cache-hit != 'true'
8181
run: |
8282
$ffmpegUrl = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['ffmpeg'])"
8383
$pangoVersion = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['pango'])"
84+
$tinyTexPackages = $(python -c "import json;print(' '.join(json.load(open('.github/manimdependency.json'))['windows']['tinytex']))") -Split ' '
8485
$OriPath = $env:PATH
8586
echo "Install Tinytex"
8687
Invoke-WebRequest "https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.zip?job=image:%20Visual%20Studio%202019" -O "$($env:TMP)\TinyTex.zip"
8788
Expand-Archive -LiteralPath "$($env:TMP)\TinyTex.zip" -DestinationPath "$($PWD)\ManimCache\LatexWindows"
8889
$env:Path = "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\win32;$($env:PATH)"
8990
tlmgr update --self
90-
tlmgr install standalone preview doublestroke ms setspace rsfs relsize ragged2e fundus-calligra microtype wasysym physics dvisvgm jknapltx wasy cm-super babel-english
91+
foreach ($c in $tinyTexPackages){
92+
$c=$c.Trim()
93+
tlmgr install $c
94+
}
9195
$env:PATH=$OriPath
9296
echo "Completed Latex"
9397
Invoke-WebRequest "$ffmpegUrl" -O "$($env:TMP)\ffmpeg.zip"
9498
7z x "$($env:TMP)\ffmpeg.zip" -o"$($PWD)\ManimCache"
9599
Move-Item "ManimCache\ffmpeg-*" "ManimCache\FFmpeg"
96-
Invoke-WebRequest "https://github.com/ManimCommunity/manim-windows/releases/download/$($pangoVersion)/pango-windows-binaires-x64.zip" -O "$($env:TMP)\Pango.zip"
100+
Invoke-WebRequest "https://github.com/ManimCommunity/pango-windows-binaries/releases/download/$($pangoVersion)/pango-windows-binaires-x64.zip" -O "$($env:TMP)\Pango.zip"
97101
mkdir "$($PWD)\ManimCache\Pango"
98102
7z x "$($env:TMP)\Pango.zip" -o"$($PWD)\ManimCache\Pango"
99103

docs/source/manim_directive.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ def run(self):
172172
f'config["frame_rate"] = {frame_rate}',
173173
f'config["pixel_height"] = {pixel_height}',
174174
f'config["pixel_width"] = {pixel_width}',
175-
f'file_writer_config["media_dir"] = "{media_dir}"',
176-
f'file_writer_config["images_dir"] = "{images_dir}"',
177-
f'file_writer_config["tex_dir"] = "{tex_dir}"',
178-
f'file_writer_config["text_dir"] = "{text_dir}"',
179-
f'file_writer_config["video_dir"] = "{video_dir}"',
175+
f'file_writer_config["media_dir"] = r"{media_dir}"',
176+
f'file_writer_config["images_dir"] = r"{images_dir}"',
177+
f'file_writer_config["tex_dir"] = r"{tex_dir}"',
178+
f'file_writer_config["text_dir"] = r"{text_dir}"',
179+
f'file_writer_config["video_dir"] = r"{video_dir}"',
180180
f'file_writer_config["save_last_frame"] = {save_last_frame}',
181181
f'file_writer_config["save_as_gif"] = {save_as_gif}',
182-
f'file_writer_config["output_file"] = "{output_file}"',
182+
f'file_writer_config["output_file"] = r"{output_file}"',
183183
]
184184

185185
user_code = self.content

0 commit comments

Comments
 (0)