Skip to content

Commit

Permalink
Merge pull request #191 from Clinical-Genomics/rc410
Browse files Browse the repository at this point in the history
### Added

- Realease candidate microSALT v4.1.0
  • Loading branch information
karlnyr authored Jan 7, 2025
2 parents c08d466 + 1f39989 commit 1a93071
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions microSALT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from flask import Flask
from distutils.sysconfig import get_python_lib

__version__ = "4.0.0"
__version__ = "4.1.0"

app = Flask(__name__, template_folder="server/templates")
app.config.setdefault("SQLALCHEMY_DATABASE_URI", "sqlite:///:memory:")
Expand Down Expand Up @@ -47,11 +47,15 @@
# Load flask info
app.config.update(preset_config["database"])

# Add `folders` configuration
app.config["folders"] = preset_config.get("folders", {})

# Ensure PubMLST configuration is included
app.config["pubmlst"] = preset_config.get("pubmlst", {"client_id": "", "client_secret": ""})

# Add extrapaths to config
preset_config["folders"]["expec"] = os.path.abspath(
os.path.join(
pathlib.Path(__file__).parent.parent, "unique_references/ExPEC.fsa"
)
os.path.join(pathlib.Path(__file__).parent.parent, "unique_references/ExPEC.fsa")
)
# Check if release install exists
for entry in os.listdir(get_python_lib()):
Expand Down Expand Up @@ -104,22 +108,14 @@
):
# Special string, mangling
if thing == "log_file":
unmade_fldr = os.path.dirname(
preset_config[entry][thing]
)
bash_cmd = "touch {}".format(
preset_config[entry][thing]
)
proc = subprocess.Popen(
bash_cmd.split(), stdout=subprocess.PIPE
)
unmade_fldr = os.path.dirname(preset_config[entry][thing])
bash_cmd = "touch {}".format(preset_config[entry][thing])
proc = subprocess.Popen(bash_cmd.split(), stdout=subprocess.PIPE)
output, error = proc.communicate()
elif thing == "SQLALCHEMY_DATABASE_URI":
unmade_fldr = os.path.dirname(db_file)
bash_cmd = "touch {}".format(db_file)
proc = subprocess.Popen(
bash_cmd.split(), stdout=subprocess.PIPE
)
proc = subprocess.Popen(bash_cmd.split(), stdout=subprocess.PIPE)
output, error = proc.communicate()
if proc.returncode != 0:
logger.error(
Expand All @@ -132,12 +128,8 @@
os.makedirs(unmade_fldr)
logger.info("Created path {}".format(unmade_fldr))

fh = logging.FileHandler(
os.path.expanduser(preset_config["folders"]["log_file"])
)
fh.setFormatter(
logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
)
fh = logging.FileHandler(os.path.expanduser(preset_config["folders"]["log_file"]))
fh.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
logger.addHandler(fh)

# Integrity check database
Expand Down

0 comments on commit 1a93071

Please sign in to comment.