Skip to content

Commit

Permalink
fix: renaming icu file with version
Browse files Browse the repository at this point in the history
Pros:
- removes need for state file
- doesn't rely on the name of the released icu tarball
- similar handling to how we download the Logos msi installer today

Cons:
- ?

Fixes: #220
  • Loading branch information
ctrlaltf24 authored and thw26 committed Nov 7, 2024
1 parent bb4f715 commit 5a54b93
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions ou_dedetai/wine.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,28 +441,20 @@ def enforce_icu_data_files(app=None):
icu_url = network.get_first_asset_url(json_data)
icu_latest_version = network.get_tag_name(json_data).lstrip('v')

# This file with the tag name of the downloaded release. If it doesn't match latest override the ICU files then write this file
config_dir = os.path.expanduser(f"~/.local/state/FaithLife-Community/")
icu_version_path = Path(f"{config_dir}/ICU_Version.txt")
if icu_version_path.exists() and icu_version_path.read_text().strip() == f"{repo}\n{icu_latest_version}":
logging.debug(f"ICU Data files already up to date, no need to install.")
if hasattr(app, 'status_evt'):
app.status_q.put("ICU files were already up to date.")
app.root.event_generate(app.status_evt)
return

if icu_url is None:
logging.critical(f"Unable to set {config.name_app} release without URL.") # noqa: E501
return
icu_filename = os.path.basename(icu_url)
icu_filename = os.path.basename(icu_url).removesuffix(".tar.gz")
# Append the version to the file name so it doesn't collide with previous versions
icu_filename = f"{icu_filename}-{icu_latest_version}.tar.gz"
network.logos_reuse_download(
icu_url,
icu_filename,
config.MYDOWNLOADS,
app=app
)
drive_c = f"{config.INSTALLDIR}/data/wine64_bottle/drive_c"
utils.untar_file(f"{config.MYDOWNLOADS}/icu-win.tar.gz", drive_c)
utils.untar_file(f"{config.MYDOWNLOADS}/{icu_filename}", drive_c)

# Ensure the target directory exists
icu_win_dir = f"{drive_c}/icu-win/windows"
Expand All @@ -474,8 +466,6 @@ def enforce_icu_data_files(app=None):
app.status_q.put("ICU files copied.")
app.root.event_generate(app.status_evt)

icu_version_path.write_text(f"{repo}\n{icu_latest_version}")

if app:
if config.DIALOG == "curses":
app.install_icu_e.set()
Expand Down

0 comments on commit 5a54b93

Please sign in to comment.