File tree Expand file tree Collapse file tree 2 files changed +28
-17
lines changed
Expand file tree Collapse file tree 2 files changed +28
-17
lines changed Original file line number Diff line number Diff line change 1919
2020# Make sphinx_utilities modules importable
2121sys .path .append (os .path .join (os .path .dirname (__file__ ), "../sphinx_utilities" ))
22+ from version_filtering import get_tutorial_version_requirements
2223
2324# Manage errors
2425pyvista .set_error_output_file ("errors.txt" )
6364print (f"Doc built for DPF server version { server_version } at:\n { server_instance .ansys_path } " )
6465print ("" .rjust (40 , '*' ))
6566
66- def get_tutorial_version_requirements (tutorial_path : str ) -> str :
67- note_flag = r".. note::"
68- version_flag = "This tutorial requires DPF"
69- previous_line_is_note = False
70- minimum_version = "0.0"
71- tutorial_path = Path (tutorial_path )
72- with tutorial_path .open (mode = "rt" , encoding = "utf-8" ) as tuto :
73- for line in tuto :
74- if (version_flag in line ) and previous_line_is_note :
75- minimum_version = line .strip (version_flag ).split ()[0 ]
76- break
77- if note_flag in line :
78- previous_line_is_note = True
79- else :
80- previous_line_is_note = False
81- return minimum_version
82-
8367# Build ignore pattern
8468ignored_pattern = r"(ignore"
8569for example in sorted (glob (r"../../examples/**/*.py" )):
@@ -101,6 +85,8 @@ def get_tutorial_version_requirements(tutorial_path: str) -> str:
10185 print (f"Tutorial { Path (tutorial_file ).name } skipped as it requires DPF { minimum_version_str } ." )
10286 exclude_patterns .append (tutorial_file )
10387
88+ print (f"{ exclude_patterns = } " )
89+
10490# Autoapi ignore pattern
10591autoapi_ignore_list = [
10692 "*/log.py" ,
Original file line number Diff line number Diff line change 1+ #
2+ from pathlib import Path
3+
4+
5+ def get_tutorial_version_requirements (tutorial_path : str ) -> str :
6+ note_flag = r".. note::"
7+ version_flag = "This tutorial requires DPF"
8+ previous_line_is_note = False
9+ minimum_version = "0.0"
10+ tutorial_path = Path (tutorial_path )
11+ skip_empty_line = False
12+ with tutorial_path .open (mode = "rt" , encoding = "utf-8" ) as tutorial_file :
13+ for line in tutorial_file :
14+ if (version_flag in line ) and previous_line_is_note :
15+ minimum_version = line .strip (version_flag ).split ()[0 ]
16+ break
17+ if note_flag in line :
18+ previous_line_is_note = True
19+ skip_empty_line = True
20+ else :
21+ if skip_empty_line :
22+ skip_empty_line = False
23+ else :
24+ previous_line_is_note = False
25+ return minimum_version
You can’t perform that action at this time.
0 commit comments