Skip to content

Commit 97b00d2

Browse files
committed
fix: integration bugs
remove non-linux browsers fix applications path handle case where the wine binary is stored as the path rather than the sigil Tested: - debian 12 snap firefox - install correctly switch to -devel - (install failed due to a fuse issue, unrelated) - debian 12 flatpak firefox - install correctly switch to -devel - (installed failed due to running out of space in VM) - debian 13 Dooble correctly switched to -devel - aborted install once text was obsered - debian 13 Opera correctly switched to -devel - aborted install once text was obsered - debian 13 Chromium correctly switched to -devel - aborted install once text was obsered - debian 13 Qutebrowser correctly switched to -devel - aborted install once text was obsered - debian 13 Vivaldi correctly switched to -devel - aborted install once text was obsered - debian 13 Brave correctly switched to -devel - aborted install once text was obsered - debian 13 Falkon correctly switched to -devel - aborted install once text was obsered - debian 13 Google Chrome correctly switched to -devel - aborted install once text was obsered - debian 12 Chromium correctly switched to -devel - install success - logged in - got to the "Download your Logos Library page"
1 parent 7d71ba4 commit 97b00d2

3 files changed

Lines changed: 84 additions & 47 deletions

File tree

ou_dedetai/config.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ def install_dir(self, value: Optional[str | Path]):
814814
def installer_binary_dir(self) -> str:
815815
if self._overrides.installer_binary_dir is not None:
816816
return self._overrides.installer_binary_dir
817-
return f"{self.install_dir}/data/bin"
817+
return f"{self.install_dir}/{constants.RELATIVE_BINARY_DIR}"
818818

819819
@property
820820
def _logos_appdata_dir(self) -> Optional[str]:
@@ -1061,6 +1061,17 @@ def wine_appimage_recommended_url(self) -> str:
10611061
else:
10621062
return versions.latest.download_url
10631063

1064+
@property
1065+
def wine_appimage_beta_url(self) -> Optional[str]:
1066+
"""URL to beta appimage.
1067+
1068+
Talks to the network if required"""
1069+
versions = self._network.wine_appimage_versions()
1070+
if versions.pre_release is None:
1071+
return None
1072+
else:
1073+
return versions.pre_release.download_url
1074+
10641075
@property
10651076
def wine_appimage_beta_file_name(self) -> Optional[str]:
10661077
"""Returns the file name of the recommended appimage with extension"""

ou_dedetai/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ def get_runmode() -> str:
7272
DEFAULT_APP_WINE_LOG_PATH = os.path.expanduser(f"{STATE_DIR}/wine.log")
7373
DEFAULT_APP_LOG_PATH = os.path.expanduser(f"{STATE_DIR}/{BINARY_NAME}.log")
7474
NETWORK_CACHE_PATH = f"{CACHE_DIR}/network.json"
75+
76+
RELATIVE_BINARY_DIR = "data/bin"
77+
7578
DEFAULT_WINEDEBUG = "err+all"
7679
LEGACY_CONFIG_FILES = [
7780
# If the user didn't have XDG_CONFIG_HOME set before, but now does.

ou_dedetai/installer.py

Lines changed: 69 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,46 @@ def ensure_choices(app: App):
4040

4141
app.status("Install is running…")
4242

43+
def ensure_install_dirs(app: App):
44+
app.installer_step_count += 1
45+
ensure_choices(app=app)
46+
app.installer_step += 1
47+
app.status("Ensuring installation directories…")
48+
wine_dir = Path("")
49+
50+
bin_dir = Path(app.conf.installer_binary_dir)
51+
bin_dir.mkdir(parents=True, exist_ok=True)
52+
logging.debug(f"> {bin_dir} exists?: {bin_dir.is_dir()}")
53+
54+
logging.debug(f"> {app.conf.install_dir=}")
55+
logging.debug(f"> {app.conf.installer_binary_dir=}")
56+
57+
wine_dir = Path(f"{app.conf.wine_prefix}")
58+
wine_dir.mkdir(parents=True, exist_ok=True)
59+
60+
logging.debug(f"> {wine_dir} exists: {wine_dir.is_dir()}")
61+
logging.debug(f"> {app.conf.wine_prefix=}")
62+
63+
64+
def ensure_sys_deps(app: App):
65+
app.installer_step_count += 1
66+
ensure_install_dirs(app=app)
67+
app.installer_step += 1
68+
app.status("Ensuring system dependencies are met…")
69+
70+
if not app.conf.skip_install_system_dependencies:
71+
utils.install_dependencies(app)
72+
logging.debug("> Done.")
73+
else:
74+
logging.debug("> Skipped.")
75+
4376

4477
def check_for_known_bugs(app: App):
4578
"""Checks for any known bug conditions and recommends user action.
4679
This is a best-effort check
4780
"""
4881
app.installer_step_count += 1
49-
ensure_choices(app=app)
82+
ensure_sys_deps(app=app)
5083
app.installer_step += 1
5184

5285
# Begin workaround #435
@@ -66,43 +99,47 @@ def check_for_known_bugs(app: App):
6699
)
67100
if result:
68101
command_output: str = result.stdout
69-
command_output = command_output.strip().lower()
102+
desktop_file_name = command_output.strip()
103+
command_output = desktop_file_name.lower()
70104

71105
# Abbr. list from https://en.wikipedia.org/wiki/Chromium_(web_browser)#Browsers_based_on_Chromium
72106
# Known chromium based .desktops:
73107
# chromium_chromium.desktop - Debian Chromium (.deb and snap)
74108
# google-chrome and com.google.Chrome.desktop - Debian Google Chrome
75109
# brave-browser.desktop and com.brave.Browser.desktop - Debian Brave
76110
# vivaldi-stable.desktop - Debian Vivaldi
111+
# dooble.desktop - Debian Dooble
112+
# opera.desktop - Debian Opera
113+
# org.qutebrowser.qutebrowser.desktop - Debian Qutebrowser
114+
# org.kde.falkon.desktop - Debian Falkon
77115
if (
78116
"chromium" in command_output
79117
or "chrome" in command_output
80118
or "brave" in command_output
81119
or "vivaldi" in command_output
82120
or "dooble" in command_output
83-
or "dooble" in command_output
84121
or "falkon" in command_output
85-
or "otter" in command_output
86122
or "qutebrowser" in command_output
87-
or "supermium" in command_output
88-
or "ecosia" in command_output
89-
or "edge" in command_output
90123
or "opera" in command_output
91-
or "puffin" in command_output
92124
):
93125
chromium_detected = True
94126

95127
# Now check the .desktop's Exec line for either "flatpak" or "/snap/bin" if either are found, fail as well.
96128
xdg_data_dirs = os.getenv("XDG_DATA_DIRS", "/usr/local/share:/usr/share")
97129

130+
found: bool = False
131+
98132
for xdg_data_dir in xdg_data_dirs.split(":"):
99-
desktop_file_path = (Path(xdg_data_dir) / command_output)
133+
desktop_file_path = (Path(xdg_data_dir) / "applications" / desktop_file_name)
100134
if desktop_file_path.exists():
135+
found = True
101136
lines = desktop_file_path.read_text().splitlines()
102137
lines = list(filter(lambda line: line.lower().startswith("exec="), lines))
103138
if any("/snap/bin" in line or "flatpak" in line for line in lines):
104139
snap_or_flatpak_detected = True
105-
break
140+
141+
if not found:
142+
logging.warning("Cannot find the desktop file in question")
106143
except subprocess.CalledProcessError as e:
107144
logging.warning(
108145
"Failed to check if chromium will be used - "
@@ -118,53 +155,22 @@ def check_for_known_bugs(app: App):
118155
if app.conf.wine_binary == constants.WINE_RECOMMENDED_SIGIL:
119156
logging.info("Switching user to the beta wine branch due to issue #435")
120157
app.conf.wine_binary = constants.WINE_BETA_SIGIL
158+
elif app.conf.wine_binary == constants.WINE_BETA_SIGIL:
159+
# No need to do anything
160+
pass
121161
else:
122162
logging.warning("Sign In button may not launch the browser due to issue #435")
123163

124164
# End workaround #435
125165

126166

127-
def ensure_install_dirs(app: App):
167+
def ensure_appimage_download(app: App):
128168
app.installer_step_count += 1
129169
try:
130170
check_for_known_bugs(app=app)
131171
except Exception:
132172
logging.exception("Failed to check for known bugs - assuming everything is fine and continuing install.")
133173
app.installer_step += 1
134-
app.status("Ensuring installation directories…")
135-
wine_dir = Path("")
136-
137-
bin_dir = Path(app.conf.installer_binary_dir)
138-
bin_dir.mkdir(parents=True, exist_ok=True)
139-
logging.debug(f"> {bin_dir} exists?: {bin_dir.is_dir()}")
140-
141-
logging.debug(f"> {app.conf.install_dir=}")
142-
logging.debug(f"> {app.conf.installer_binary_dir=}")
143-
144-
wine_dir = Path(f"{app.conf.wine_prefix}")
145-
wine_dir.mkdir(parents=True, exist_ok=True)
146-
147-
logging.debug(f"> {wine_dir} exists: {wine_dir.is_dir()}")
148-
logging.debug(f"> {app.conf.wine_prefix=}")
149-
150-
151-
def ensure_sys_deps(app: App):
152-
app.installer_step_count += 1
153-
ensure_install_dirs(app=app)
154-
app.installer_step += 1
155-
app.status("Ensuring system dependencies are met…")
156-
157-
if not app.conf.skip_install_system_dependencies:
158-
utils.install_dependencies(app)
159-
logging.debug("> Done.")
160-
else:
161-
logging.debug("> Skipped.")
162-
163-
164-
def ensure_appimage_download(app: App):
165-
app.installer_step_count += 1
166-
ensure_sys_deps(app=app)
167-
app.installer_step += 1
168174
if (
169175
app.conf.faithlife_product_version != '9'
170176
and not str(app.conf.wine_binary).lower().endswith('appimage')
@@ -175,12 +181,29 @@ def ensure_appimage_download(app: App):
175181

176182
downloaded_file = None
177183
appimage_path = app.conf.wine_appimage_recommended_file_name
184+
download_url = app.conf.wine_appimage_recommended_url
185+
186+
if (
187+
app.conf.wine_binary == constants.WINE_BETA_SIGIL
188+
or (
189+
app.conf.wine_appimage_beta_file_name is not None
190+
# It was set to this manually.
191+
and app.conf.wine_binary == f"{constants.RELATIVE_BINARY_DIR}/{app.conf.wine_appimage_beta_file_name}"
192+
)
193+
):
194+
if (
195+
app.conf.wine_appimage_beta_file_name is not None
196+
and app.conf.wine_appimage_beta_url is not None
197+
):
198+
appimage_path = app.conf.wine_appimage_beta_file_name
199+
download_url = app.conf.wine_appimage_beta_url
200+
178201
filename = Path(appimage_path).name
179202
downloaded_file = utils.get_downloaded_file_path(app.conf.download_dir, filename)
180203
if not downloaded_file:
181204
downloaded_file = f"{app.conf.download_dir}/{filename}"
182205
network.logos_reuse_download(
183-
app.conf.wine_appimage_recommended_url,
206+
download_url,
184207
filename,
185208
app.conf.download_dir,
186209
app=app,

0 commit comments

Comments
 (0)