Skip to content

Commit

Permalink
enable setting of config dir by env var
Browse files Browse the repository at this point in the history
  • Loading branch information
MialLewis committed Dec 19, 2023
1 parent 81e22c9 commit 9388cf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pr_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ jobs:
# Runs System tests
- name: Run EVSVesuvio Analysis System Tests
run: python -m unittest discover -s ./EVSVesuvio/system_tests
run: |
export VESUVIOPROPERTIES=$(pwd)/EVSVesuvio/config/vesuvio.user.properties
python -m unittest discover -s ./EVSVesuvio/system_tests
- name: Run EVSVesuvio Calibration Unit Tests
run: |
Expand Down
13 changes: 11 additions & 2 deletions EVSVesuvio/scripts/handle_config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
from shutil import copyfile, copytree, ignore_patterns

VESUVIO_CONFIG_PATH = os.path.join(os.path.expanduser("~"), ".mvesuvio")
VESUVIO_CONFIG_FILE = "vesuvio.user.properties"
VESUVIO_CONFIG_PATH, VESUVIO_CONFIG_FILE = __parse_properties_env_var()
VESUVIO_INPUTS_FILE = "analysis_inputs.py"
VESUVIO_PACKAGE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MANTID_CONFIG_FILE = "Mantid.user.properties"
Expand Down Expand Up @@ -117,3 +116,13 @@ def check_dir_exists(type, path):
print(f"Directory of {type} could not be found at location: {path}")
return False
return True


def __parse_properties_env_var():
env_var = os.getenv('VESUVIOPROPERTIES')
if env_var:
config_path, config_file = os.path.split(env_var)
else:
config_path = os.path.join(os.path.expanduser("~"), ".mvesuvio")
config_file = "vesuvio.user.properties"
return config_path, config_file

0 comments on commit 9388cf5

Please sign in to comment.