Revert "Expose tools.toml config file to users."

This reverts commit 01bb09cb7d.
- Problem is, the later changes of the config file in eris aren't
  seen by the user.
This commit is contained in:
Andrew Hamilton 2021-12-14 11:31:16 +10:00
parent 01bb09cb7d
commit f8177ef58d
4 changed files with 9 additions and 16 deletions

View file

@ -1073,16 +1073,13 @@ def manage_cache(root_path):
timestamp_path = os.path.join(cache_path, "creation_time")
if os.path.exists(cache_path):
timestamp = os.stat(timestamp_path).st_mtime
is_updated = False
for resource_path in ["__main__.py", "tools.py"]:
for resource_path in ["__main__.py", "tools.py", "tools.toml"]:
with importlib.resources.path(eris, resource_path) as resource:
if resource.stat().st_mtime > timestamp:
is_updated = True
print("Eris has been updated, so clearing the cache and"
" recalculating all results…")
shutil.rmtree(cache_path)
break
is_updated = is_updated or os.stat(tools.CONFIG_PATH).st_mtime > timestamp
if is_updated:
print("Eris has been updated, so clearing the cache and recalculating all results…")
shutil.rmtree(cache_path)
if not os.path.exists(cache_path):
os.mkdir(cache_path)
open(timestamp_path, "w").close()

View file

@ -460,13 +460,8 @@ def make_tool_function(dependencies, command, url=None, error_status=None,
elinks, git_diff, git_blame = None, None, None # For linters.
CONFIG_PATH = os.path.join(os.environ["HOME"], ".config", "eris-tools.toml")
if not os.path.exists(CONFIG_PATH):
with importlib.resources.path(eris, "eris-tools.toml") as toml_path:
shutil.copy(toml_path, CONFIG_PATH)
tools_toml = toml.load(CONFIG_PATH)
with importlib.resources.open_text(eris, "tools.toml") as tools_toml_file:
tools_toml = toml.load(tools_toml_file)
tools_for_extensions = tools_toml["tools_for_extensions"]
del tools_toml["tools_for_extensions"]
for tool_name, tool_toml in tools_toml.items():
@ -728,7 +723,7 @@ def tool_name_colored(tool, path):
if __name__ == "__main__":
# Let tools be tested individually...
# ./tools.py <tool> <path>
# e.g. ./tools.py contents README.md
# e.g. ./tools.py contents tools.toml
tool_name, path = sys.argv[1:3]
tool = locals()[tool_name]
valid_tools = tools_for_path(path)

View file

@ -4,6 +4,7 @@ tools_for_extensions = [
[["py"], ["python_syntax", "python_unittests", "pytest", "pydoc", "mypy",
"python_coverage", "pycodestyle", "pydocstyle", "pyflakes",
"pylint", "python_gut", "python_mccabe", "bandit"]],
# [["pyc"], ["pydisasm"]],
[["pl", "pm", "t"], ["perl_syntax", "perldoc"]],
[["p6", "pm6"], ["perl6_syntax"]],
[["pod", "pod6"], ["perldoc"]],

View file

@ -16,7 +16,7 @@ setup(name="eris",
license="Artistic 2.0",
packages=["eris"],
py_modules=["lscolors", "sorted_collection"],
package_data={"eris": ["LS_COLORS.sh", "eris-tools.toml"]},
package_data={"eris": ["LS_COLORS.sh", "tools.toml"]},
entry_points={"console_scripts": ["eris=eris.__main__:entry_point",
"eris-worker=eris.worker:main",
"eris-webserver=eris.webserver:main",