Skip to content

Commit

Permalink
Use package resources
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Jan 16, 2023
1 parent 78fbec8 commit a909292
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/ert/_c_wrappers/enkf/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import sys
from datetime import date
from os.path import isfile
from pathlib import Path
from typing import Any, Dict, List, Optional

import pkg_resources

from ert._c_wrappers.config import ConfigContent, ConfigParser
from ert._c_wrappers.config.config_parser import ConfigValidationError
from ert._c_wrappers.enkf.analysis_config import AnalysisConfig
Expand All @@ -30,16 +31,7 @@ def site_config_location():

if "ERT_SITE_CONFIG" in os.environ:
return os.environ["ERT_SITE_CONFIG"]

path = Path(__file__).parent
for p in path.parents:
npath = p / "ert" / "shared" / "share" / "ert" / "site-config"
if npath.is_file():
path = npath
break
else:
raise SystemError("Could not find `share/ert/site-config`")
return str(path)
return pkg_resources.resource_filename("ert.shared", "share/ert/site-config")


class ResConfig:
Expand Down

0 comments on commit a909292

Please sign in to comment.