Use correct sys.platform convention
This commit is contained in:
@@ -76,7 +76,7 @@ class Source(Iterable):
|
||||
|
||||
@property
|
||||
def is_available(self) -> bool:
|
||||
return sys.platform in self.available_on
|
||||
return any(sys.platform.startswith(platform) for platform in self.available_on)
|
||||
|
||||
def make_executable(self, *args, **kwargs) -> str:
|
||||
"""
|
||||
@@ -120,14 +120,15 @@ class URLExecutableSource(ExecutableFormatSource):
|
||||
|
||||
@property
|
||||
def executable_format(self) -> str:
|
||||
match sys.platform:
|
||||
case "win32":
|
||||
return "start " + self.url_format
|
||||
case "linux":
|
||||
return "xdg-open " + self.url_format
|
||||
case "darwin":
|
||||
return "open " + self.url_format
|
||||
case other:
|
||||
raise NotImplementedError(
|
||||
f"No URL handler command available for {other}"
|
||||
)
|
||||
if sys.platform.startswith("win32"):
|
||||
return f"start {self.url_format}"
|
||||
|
||||
if sys.platform.startswith("linux"):
|
||||
return f"xdg-open {self.url_format}"
|
||||
|
||||
if sys.platform.startswith("darwin"):
|
||||
return f"open {self.url_format}"
|
||||
|
||||
raise NotImplementedError(
|
||||
f"No URL handler command available for {sys.platform}"
|
||||
)
|
||||
|
||||
@@ -58,7 +58,7 @@ from cartridges.store.store import Store
|
||||
from cartridges.utils.run_executable import run_executable
|
||||
from cartridges.window import CartridgesWindow
|
||||
|
||||
if sys.platform == "darwin":
|
||||
if sys.platform.startswith("darwin"):
|
||||
from AppKit import NSApp # type: ignore
|
||||
from PyObjCTools import AppHelper
|
||||
|
||||
@@ -94,7 +94,7 @@ class CartridgesApplication(Adw.Application):
|
||||
|
||||
self.add_main_option_entries((search, launch))
|
||||
|
||||
if sys.platform == "darwin":
|
||||
if sys.platform.startswith("darwin"):
|
||||
if settings := Gtk.Settings.get_default():
|
||||
settings.props.gtk_decoration_layout = "close,minimize,maximize:"
|
||||
|
||||
@@ -405,7 +405,7 @@ class CartridgesApplication(Adw.Application):
|
||||
f"app.{action[0]}" if scope == self else f"win.{action[0]}",
|
||||
(
|
||||
tuple(s.replace("<primary>", "<meta>") for s in action[1])
|
||||
if sys.platform == "darwin"
|
||||
if sys.platform.startswith("darwin")
|
||||
else action[1]
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user