Skip to content

Commit

Permalink
fixed issues with importing legacy setups
Browse files Browse the repository at this point in the history
  • Loading branch information
giumas committed Jan 11, 2025
1 parent 9b21448 commit 85e7809
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions hyo2/ssm2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
logger.addHandler(logging.NullHandler())

name = "Sound Speed"
__version__ = '2025.0.0'
__copyright__ = 'Copyright 2024 University of New Hampshire, Center for Coastal and Ocean Mapping'
__version__ = '2025.0.1'
__copyright__ = 'Copyright 2025 University of New Hampshire, Center for Coastal and Ocean Mapping'

pkg_info = PkgInfo(
name=name,
Expand Down
6 changes: 5 additions & 1 deletion hyo2/ssm2/lib/base/setup_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from hyo2.ssm2.lib.base.basedb import BaseDb
from hyo2.ssm2.lib.base.setup_sql import CREATE_SETTINGS, CREATE_SETTINGS_VIEW, CREATE_CLIENT_LIST, \
RENAME_SETTINGS, RENAME_CLIENT_LIST, DROP_OLD_SETTINGS, DROP_OLD_CLIENT_LIST, DROP_SETTINGS_VIEW, \
V1_V7_COPY_SETTINGS, V1_V7_COPY_CLIENT_LIST
V1_V7_COPY_SETTINGS, V1_V7_COPY_CLIENT_LIST, ALTER_OLD_SETTINGS_USE_WOA23, ALTER_OLD_SETTINGS_CUSTOM_WOA23_FOLDER

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -39,6 +39,10 @@ def update_from_v1_to_v7(self) -> bool:
self.conn.execute(CREATE_CLIENT_LIST)
self.conn.execute(CREATE_SETTINGS_VIEW)

with self.conn:
self.conn.execute(ALTER_OLD_SETTINGS_USE_WOA23)
self.conn.execute(ALTER_OLD_SETTINGS_CUSTOM_WOA23_FOLDER)

with self.conn:
self.conn.execute(V1_V7_COPY_SETTINGS)
self.conn.execute(V1_V7_COPY_CLIENT_LIST)
Expand Down
16 changes: 11 additions & 5 deletions hyo2/ssm2/lib/base/setup_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@
DROP VIEW settings_view
"""

# ALTER TABLES/VIEWS

ALTER_OLD_SETTINGS_USE_WOA23 = """-- noinspection SqlResolveForFile
ALTER TABLE general_old ADD COLUMN use_woa23 INTEGER DEFAULT 0
"""

ALTER_OLD_SETTINGS_CUSTOM_WOA23_FOLDER = """-- noinspection SqlResolveForFile
ALTER TABLE general_old ADD COLUMN custom_woa23_folder TEXT DEFAULT ''
"""

# COPY V1 -> V6

V1_V7_COPY_SETTINGS = """-- noinspection SqlResolveForFile
Expand Down Expand Up @@ -210,11 +220,7 @@
ELSE
use_woa18
END,
CASE WHEN typeof(use_woa23) == 'text' THEN
use_woa23 == 'False'
ELSE
use_woa23
END,
use_woa23,
CASE WHEN typeof(use_rtofs) == 'text' THEN
use_rtofs == 'True'
ELSE
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def read(*parts):
# intentionally *not* adding an encoding option to open, See:
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
with codecs.open(os.path.join(here, *parts), 'r') as fp:
with codecs.open(str(os.path.join(here, *parts)), 'r') as fp:
return fp.read()


Expand Down Expand Up @@ -55,7 +55,7 @@ def find_version(*file_paths):
"coverage"
],
install_requires=[
"hyo2.abc2>=2.3.12",
"hyo2.abc2>=2.4.0",
"appdirs",
"cartopy",
"gsw",
Expand Down

0 comments on commit 85e7809

Please sign in to comment.