From 4951255424b2b85bd303d825bd957f3566e529e2 Mon Sep 17 00:00:00 2001 From: developomp Date: Fri, 1 Jul 2022 14:15:53 +0900 Subject: [PATCH] remove need to change vars in `src/constatnts.py` --- src/constants.py | 15 +++++++++------ src/interface/choose_action.py | 7 +------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/constants.py b/src/constants.py index 0e81554..204ff43 100644 --- a/src/constants.py +++ b/src/constants.py @@ -1,9 +1,12 @@ -# must be synced with `setup.py` -# this variable may be altered by the script -# most notably by `src/interface/choose_action.py` - from os import environ +from os.path import abspath, dirname + +# used to look for resources +# points to repo root +content_dir = abspath(dirname(dirname(__file__))) + +# used to temporarily save files +# must be synced with `setup.py` +tmp_dir = "/tmp/com.developomp.setup" -content_dir = "/tmp/com.developomp.setup" -tmp_dir = content_dir home_dir = environ.get("HOME") diff --git a/src/interface/choose_action.py b/src/interface/choose_action.py index f6d9db0..698e80e 100644 --- a/src/interface/choose_action.py +++ b/src/interface/choose_action.py @@ -4,15 +4,10 @@ from os.path import exists, abspath from src.util import import_file from src.log import log -import src.constants +from src.constants import content_dir def choose_action(): - if exists(".git/") and exists("src/"): - src.constants.content_dir = abspath(".") - - content_dir = src.constants.content_dir - files = glob(f"{content_dir}/src/setup/**/*.py") files = [ s.removeprefix(f"{content_dir}/src/setup/")