1818
1919from __future__ import annotations
2020
21- import importlib .resources as imlr
2221import os
23- import shutil
2422import signal
2523import sys
2624import typing
2725
28- from . import _styles , config
26+ from . import config
2927
3028if typing .TYPE_CHECKING :
31- from typing import Any , Iterator , NoReturn
29+ from typing import Any , NoReturn
3230
3331
3432def _env (var : str ) -> bool :
@@ -51,26 +49,6 @@ def sigint_handler(*_: Any) -> NoReturn:
5149 sys .exit ()
5250
5351
54- def _iter_styles () -> Iterator [str ]:
55- for resource in imlr .contents (_styles ):
56- if resource .endswith (".mplstyle" ):
57- yield resource
58-
59-
60- def _check_config () -> None :
61- """Create config files as necessary."""
62- config .CONFIG_DIR .mkdir (parents = True , exist_ok = True )
63- verfile = config .CONFIG_DIR / ".version"
64- uptodate = verfile .is_file () and verfile .read_text () == __version__
65- if not uptodate :
66- verfile .write_text (__version__ )
67- for stfile in _iter_styles ():
68- stfile_conf = config .CONFIG_DIR / stfile
69- if not (uptodate and stfile_conf .is_file ()):
70- with imlr .path (_styles , stfile ) as stfile_local :
71- shutil .copy (str (stfile_local ), str (stfile_conf ))
72-
73-
7452if DEBUG :
7553 print (
7654 "StagPy runs in DEBUG mode because the environment variable" ,
@@ -88,7 +66,6 @@ def _check_config() -> None:
8866
8967conf = config .Config .default_ ()
9068if not ISOLATED :
91- _check_config ()
9269 if config .CONFIG_LOCAL .is_file ():
9370 conf .update_from_file_ (config .CONFIG_LOCAL )
9471
0 commit comments