Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: Release candidate v4.1.0 #191

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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