hack to switch between CLI folder setup and local setup

This commit is contained in:
svlandeg 2020-02-19 16:22:48 +02:00
parent 5c2f645470
commit 9834527f2c
1 changed files with 15 additions and 5 deletions

View File

@ -8,11 +8,21 @@ def test_build_dependencies(en_vocab):
libs_ignore_setup = ["fugashi", "natto-py", "pythainlp"] libs_ignore_setup = ["fugashi", "natto-py", "pythainlp"]
# check requirements.txt # check requirements.txt
try:
# for CLI usage
root_dir = Path(__file__).parent.parent root_dir = Path(__file__).parent.parent
req_file = root_dir / "requirements.txt" req_file = root_dir / "requirements.txt"
req_dict = {} req_dict = {}
with req_file.open() as f: with req_file.open() as f:
lines = f.readlines() lines = f.readlines()
except FileNotFoundError as e:
# for local usage
root_dir = Path(__file__).parent.parent.parent
req_file = root_dir / "requirements.txt"
req_dict = {}
with req_file.open() as f:
lines = f.readlines()
for line in lines: for line in lines:
line = line.strip() line = line.strip()
if not line.startswith("#"): if not line.startswith("#"):