Skip to content

Commit 22ec175

Browse files
committed
No longer create mplstyle files in CONFIG_DIR
1 parent 5a55044 commit 22ec175

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

stagpy/__init__.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@
1818

1919
from __future__ import annotations
2020

21-
import importlib.resources as imlr
2221
import os
23-
import shutil
2422
import signal
2523
import sys
2624
import typing
2725

28-
from . import _styles, config
26+
from . import config
2927

3028
if typing.TYPE_CHECKING:
31-
from typing import Any, Iterator, NoReturn
29+
from typing import Any, NoReturn
3230

3331

3432
def _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-
7452
if DEBUG:
7553
print(
7654
"StagPy runs in DEBUG mode because the environment variable",
@@ -88,7 +66,6 @@ def _check_config() -> None:
8866

8967
conf = config.Config.default_()
9068
if not ISOLATED:
91-
_check_config()
9269
if config.CONFIG_LOCAL.is_file():
9370
conf.update_from_file_(config.CONFIG_LOCAL)
9471

0 commit comments

Comments
 (0)