File tree Expand file tree Collapse file tree 3 files changed +25
-16
lines changed
{{cookiecutter.package_name}} Expand file tree Collapse file tree 3 files changed +25
-16
lines changed Original file line number Diff line number Diff line change 11"""Quickstart example
22
3- This example script imports the {{cookiecutter.package_name}} package and prints out
4- the version.
3+ This example script imports our package and prints out the version.
54"""
65
76import logging
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 ()
Original file line number Diff line number Diff line change @@ -50,9 +50,7 @@ def run_in_venv(
5050 else :
5151 # Unix-like systems
5252 activate_cmd = f". { VENV_DIR } /bin/activate"
53- args = shlex .split (
54- f'sh -c "{ activate_cmd } && python { filename } "'
55- )
53+ args = shlex .split (f'sh -c "{ activate_cmd } && python { filename } "' )
5654
5755 env : dict [str , str ] = {}
5856 if os .environ .get ("PATH" ):
You can’t perform that action at this time.
0 commit comments