File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed
{{cookiecutter.package_name}}/scripts Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change 33import shutil
44from pathlib import Path
55
6- paths = [
7- "docs/build" ,
8- "docs/source/api/modules.rst" ,
9- "docs/source/api/{{cookiecutter.package_name}}*.rst" ,
6+ _LITERAL_PATHS = [
7+ Path ("docs/build" ),
8+ Path ("docs/source/api/modules.rst" ),
109]
10+ _GLOB_PATTERNS = [
11+ ("docs/source/api" , "reposcan*.rst" ),
12+ ]
13+
14+
15+ def clean () -> None :
16+ """Delete build artefacts and generated API documentation files."""
17+ for path in _LITERAL_PATHS :
18+ if path .exists ():
19+ if path .is_dir ():
20+ shutil .rmtree (path )
21+ else :
22+ path .unlink ()
23+
24+ for parent_str , pattern in _GLOB_PATTERNS :
25+ for match in Path (parent_str ).glob (pattern ):
26+ match .unlink ()
27+
1128
12- for path in paths :
13- p = Path (path )
14- if p .exists ():
15- if p .is_dir ():
16- shutil .rmtree (p )
17- else :
18- p .unlink ()
29+ if __name__ == "__main__" :
30+ clean ()
You can’t perform that action at this time.
0 commit comments