File tree Expand file tree Collapse file tree
{{ cookiecutter.pypi_package_name }}/{{ cookiecutter.python_package_name }} Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import logging
12import os
3+ from pathlib import Path , PurePath
24import shutil
35import subprocess
46import sys
57
8+ from cookiecutter .config import get_user_config
9+
10+
11+ logger = logging .getLogger (__name__ )
12+
13+ logger .info ('Saving replay file for red-port' )
14+ config_dict = get_user_config ()
15+ template_name = '{{ cookiecutter._repo_dir.split(' / ')[-1] }}'
16+ target_replay_path = Path ('.redport' ) / 'cookiecutter_replay'
17+ target_replay_path .mkdir (exist_ok = True )
18+ shutil .copy (
19+ (PurePath (config_dict ['replay_dir' ]) / template_name ).with_suffix ('.json' ),
20+ target_replay_path ,
21+ )
22+
623shutil .rmtree ('licenses' )
724
825{% if cookiecutter .include_executable != "y" - % }
Original file line number Diff line number Diff line change 22
33import json
44import os
5- {% if cookiecutter .use_alternative_union_syntax == "y" - % }
65from typing import Any
7- {% - else - % }
8- from typing import Any , Optional
9- {% - endif % }
106
117import xdg .BaseDirectory # type: ignore
128
1612logger = get_logger (__name__ )
1713
1814
19- {% if cookiecutter .use_alternative_union_syntax == "y" - % }
2015def config_get (key : str , default : Any | None = None ) -> Any | None :
21- {% - else - % }
22- def config_get (
23- key : str , default : Optional [Any ] = None
24- ) -> Optional [Any ]:
25- {% - endif % }
2616 """Reads a config from the first level of a JSON file by key.
2717
2818 :param key: the name of the top-level JSON property.
@@ -84,11 +74,7 @@ def config_set(key: str, value: Any) -> None:
8474 logger .info ('New value written' )
8575
8676
87- {% if cookiecutter .use_alternative_union_syntax == "y" - % }
8877def config_dir (subdir : str | None = None ) -> str :
89- {% - else - % }
90- def config_dir (subdir : Optional [str ] = None ) -> str :
91- {% - endif % }
9278 """Returns the configuration directory for this package.
9379
9480 Respects the XDG settings. Also creates the directory if it does
You can’t perform that action at this time.
0 commit comments