Skip to content

Commit 9a7250d

Browse files
author
Jessica Lin
authored
Merge branch 'master' into master
2 parents 8d32bae + 43e3eb7 commit 9a7250d

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ beginner
33
intermediate
44
advanced
55
pytorch_basics
6+
recipes
67

78
#data things
89
_data/
@@ -31,6 +32,7 @@ __pycache__/
3132
*.so
3233

3334
# Distribution / packaging
35+
src/
3436
.Python
3537
env/
3638
build/

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ docs:
108108
touch docs/.nojekyll
109109

110110
html-noplot:
111-
make clean
112111
$(SPHINXBUILD) -D plot_gallery=0 -b html $(SPHINXOPTS) "$(SOURCEDIR)" "$(BUILDDIR)/html"
113112
# bash .jenkins/remove_invisible_code_block_batch.sh "$(BUILDDIR)/html"
114113
@echo

conf.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import glob
3636
import shutil
3737
from custom_directives import IncludeDirective, GalleryItemDirective, CustomGalleryItemDirective, CustomCalloutItemDirective, CustomCardItemDirective
38+
import distutils.file_util
39+
import re
3840

3941

4042
try:
@@ -63,10 +65,19 @@
6365
'examples_dirs': ['beginner_source', 'intermediate_source',
6466
'advanced_source', 'recipes_source'],
6567
'gallery_dirs': ['beginner', 'intermediate', 'advanced', 'recipes'],
66-
'filename_pattern': os.environ.get('GALLERY_PATTERN', r'tutorial.py'),
6768
'backreferences_dir': False
6869
}
6970

71+
if os.getenv('GALLERY_PATTERN'):
72+
# GALLERY_PATTERN is to be used when you want to work on a single
73+
# tutorial. Previously this was fed into filename_pattern, but
74+
# if you do that, you still end up parsing all of the other Python
75+
# files which takes a few seconds. This strategy is better, as
76+
# ignore_pattern also skips parsing.
77+
# See https://github.com/sphinx-gallery/sphinx-gallery/issues/721
78+
# for a more detailed description of the issue.
79+
sphinx_gallery_conf['ignore_pattern'] = r'/(?!' + re.escape(os.getenv('GALLERY_PATTERN')) + r')[^/]+$'
80+
7081
for i in range(len(sphinx_gallery_conf['examples_dirs'])):
7182
gallery_dir = sphinx_gallery_conf['gallery_dirs'][i]
7283
source_dir = sphinx_gallery_conf['examples_dirs'][i]
@@ -78,7 +89,7 @@
7889

7990
# Copy rst files from source dir to gallery dir
8091
for f in glob.glob(os.path.join(source_dir, '*.rst')):
81-
shutil.copy(f, gallery_dir)
92+
distutils.file_util.copy_file(f, gallery_dir, update=True)
8293

8394

8495
# Add any paths that contain templates here, relative to this directory.

0 commit comments

Comments
 (0)