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

added tuxedo os addressing #93 #94

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions extra_platforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
is_sles,
is_solaris,
is_sunos,
is_tuxedo,
is_ubuntu,
is_unknown_linux,
is_windows,
Expand Down Expand Up @@ -125,6 +126,7 @@
SLES,
SOLARIS,
SUNOS,
TUXEDO,
UBUNTU,
UNKNOWN_LINUX,
WINDOWS,
Expand Down Expand Up @@ -273,6 +275,7 @@ def current_os() -> Platform:
"is_solaris", # noqa: F405
"is_sunos", # noqa: F405
"is_system_v", # noqa: F405, F822
"is_tuxedo", # noqa: F405, F822
"is_ubuntu", # noqa: F405
"is_unix", # noqa: F405, F822
"is_unix_layers", # noqa: F405, F822
Expand Down Expand Up @@ -310,6 +313,7 @@ def current_os() -> Platform:
"SOLARIS", # noqa: F405
"SUNOS", # noqa: F405
"SYSTEM_V", # noqa: F405
"TUXEDO", # noqa: F405
"UBUNTU", # noqa: F405
"UNIX", # noqa: F405
"UNIX_LAYERS", # noqa: F405
Expand Down
7 changes: 7 additions & 0 deletions extra_platforms/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ def is_sunos() -> bool:
return platform.platform(aliased=True, terse=True).startswith("SunOS")


@cache
def is_tuxedo() -> bool:
"""Return `True` only if current platform is Tuxedo OS."""
return distro.id() == "tuxedo"


@cache
def is_ubuntu() -> bool:
"""Return `True` only if current platform is Ubuntu."""
Expand Down Expand Up @@ -313,6 +319,7 @@ def is_unknown_linux() -> bool:
or is_scientific()
or is_slackware()
or is_sles()
or is_tuxedo()
or is_ubuntu()
or is_xenserver()
or is_wsl1()
Expand Down
3 changes: 3 additions & 0 deletions extra_platforms/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
SLES,
SOLARIS,
SUNOS,
TUXEDO,
UBUNTU,
UNKNOWN_LINUX,
WINDOWS,
Expand Down Expand Up @@ -189,6 +190,7 @@ def issuperset(self, other: Group | Iterable[Platform] | Platform) -> bool:
SLES,
SOLARIS,
SUNOS,
TUXEDO,
UBUNTU,
UNKNOWN_LINUX,
WINDOWS,
Expand Down Expand Up @@ -286,6 +288,7 @@ def issuperset(self, other: Group | Iterable[Platform] | Platform) -> bool:
SCIENTIFIC,
SLACKWARE,
SLES,
TUXEDO,
UBUNTU,
UNKNOWN_LINUX,
XENSERVER,
Expand Down
1 change: 1 addition & 0 deletions extra_platforms/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def _windows_infos() -> dict[str, Any]:
SLES = Platform("sles", "SUSE Linux Enterprise Server", "🦎")
SOLARIS = Platform("solaris", "Solaris", "🌞")
SUNOS = Platform("sunos", "SunOS", "☀️")
TUXEDO = Platform("tuxedo", "Tuxedo OS")
UBUNTU = Platform("ubuntu", "Ubuntu", "🎯")
UNKNOWN_LINUX = Platform("unknown_linux", "Unknown Linux", "🐧")
WINDOWS = Platform("windows", "Windows", "🪟")
Expand Down
12 changes: 11 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ List all platforms of a family:
>>> from extra_platforms import LINUX

>>> LINUX
Group(id='linux', name='Any Linux', platform_ids=frozenset({'ibm_powerkvm', 'rocky', 'debian', 'ubuntu', 'mageia', 'xenserver', 'opensuse', 'buildroot', 'rhel', 'parallels', 'pidora', 'sles', 'amzn', 'scientific', 'linuxmint', 'centos', 'android', 'gentoo', 'raspbian', 'unknown_linux', 'mandriva', 'exherbo', 'cloudlinux', 'fedora', 'guix', 'arch', 'altlinux', 'slackware', 'oracle', 'kvmibm'}))
Group(id='linux', name='Any Linux', platform_ids=frozenset({'ibm_powerkvm', 'rocky', 'debian', 'tuxedo', 'ubuntu', 'mageia', 'xenserver', 'opensuse', 'buildroot', 'rhel', 'parallels', 'pidora', 'sles', 'amzn', 'scientific', 'linuxmint', 'centos', 'android', 'gentoo', 'raspbian', 'unknown_linux', 'mandriva', 'exherbo', 'cloudlinux', 'fedora', 'guix', 'arch', 'altlinux', 'slackware', 'oracle', 'kvmibm'}))

>>> print("\n".join([p.name for p in LINUX]))
ALT Linux
Expand Down Expand Up @@ -128,6 +128,7 @@ Rocky Linux
Scientific Linux
Slackware
SUSE Linux Enterprise Server
Tuxedo OS
Ubuntu
Unknown Linux
XenServer
Expand Down Expand Up @@ -202,6 +203,7 @@ all_platforms,slackware,1
all_platforms,sles,1
all_platforms,solaris,1
all_platforms,sunos,1
all_platforms,tuxedo,1
all_platforms,ubuntu,1
all_platforms,unknown_linux,1
all_platforms,windows,1
Expand Down Expand Up @@ -245,6 +247,7 @@ unix,slackware,1
unix,sles,1
unix,solaris,1
unix,sunos,1
unix,tuxedo,1
unix,ubuntu,1
unix,unknown_linux,1
unix,wsl1,1
Expand Down Expand Up @@ -318,6 +321,7 @@ linux_like,rocky,1
linux_like,scientific,1
linux_like,slackware,1
linux_like,sles,1
linux_like,tuxedo,1
linux_like,ubuntu,1
linux_like,unknown_linux,1
linux_like,wsl1,1
Expand Down Expand Up @@ -350,6 +354,7 @@ linux,rocky,1
linux,scientific,1
linux,slackware,1
linux,sles,1
linux,tuxedo,1
linux,ubuntu,1
linux,unknown_linux,1
linux,xenserver,1
Expand Down Expand Up @@ -424,6 +429,7 @@ flowchart
linux_scientific(<code>scientific</code><br/>❓ <em>Scientific Linux</em>)
linux_slackware(<code>slackware</code><br/>❓ <em>Slackware</em>)
linux_sles(<code>sles</code><br/>🦎 <em>SUSE Linux Enterprise Server</em>)
linux_tuxedo(<code>tuxedo</code><br/>❓ <em>Tuxedo OS</em>)
linux_ubuntu(<code>ubuntu</code><br/>🎯 <em>Ubuntu</em>)
linux_unknown_linux(<code>unknown_linux</code><br/>🐧 <em>Unknown Linux</em>)
linux_xenserver(<code>xenserver</code><br/>❓ <em>XenServer</em>)
Expand Down Expand Up @@ -494,6 +500,7 @@ flowchart
all_platforms_sles(<code>sles</code><br/>🦎 <em>SUSE Linux Enterprise Server</em>)
all_platforms_solaris(<code>solaris</code><br/>🌞 <em>Solaris</em>)
all_platforms_sunos(<code>sunos</code><br/>☀️ <em>SunOS</em>)
all_platforms_tuxedo(<code>tuxedo</code><br/>❓ <em>Tuxedo OS</em>)
all_platforms_ubuntu(<code>ubuntu</code><br/>🎯 <em>Ubuntu</em>)
all_platforms_unknown_linux(<code>unknown_linux</code><br/>🐧 <em>Unknown Linux</em>)
all_platforms_windows(<code>windows</code><br/>🪟 <em>Windows</em>)
Expand Down Expand Up @@ -536,6 +543,7 @@ flowchart
linux_like_scientific(<code>scientific</code><br/>❓ <em>Scientific Linux</em>)
linux_like_slackware(<code>slackware</code><br/>❓ <em>Slackware</em>)
linux_like_sles(<code>sles</code><br/>🦎 <em>SUSE Linux Enterprise Server</em>)
linux_like_tuxedo(<code>tuxedo</code><br/>❓ <em>Tuxedo OS</em>)
linux_like_ubuntu(<code>ubuntu</code><br/>🎯 <em>Ubuntu</em>)
linux_like_unknown_linux(<code>unknown_linux</code><br/>🐧 <em>Unknown Linux</em>)
linux_like_wsl1(<code>wsl1</code><br/>⊞ <em>Windows Subsystem for Linux v1</em>)
Expand Down Expand Up @@ -580,6 +588,7 @@ flowchart
unix_sles(<code>sles</code><br/>🦎 <em>SUSE Linux Enterprise Server</em>)
unix_solaris(<code>solaris</code><br/>🌞 <em>Solaris</em>)
unix_sunos(<code>sunos</code><br/>☀️ <em>SunOS</em>)
unix_tuxedo(<code>tuxedo</code><br/>❓ <em>Tuxedo OS</em>)
unix_ubuntu(<code>ubuntu</code><br/>🎯 <em>Ubuntu</em>)
unix_unknown_linux(<code>unknown_linux</code><br/>🐧 <em>Unknown Linux</em>)
unix_wsl1(<code>wsl1</code><br/>⊞ <em>Windows Subsystem for Linux v1</em>)
Expand Down Expand Up @@ -623,6 +632,7 @@ flowchart
unix_without_macos_sles(<code>sles</code><br/>🦎 <em>SUSE Linux Enterprise Server</em>)
unix_without_macos_solaris(<code>solaris</code><br/>🌞 <em>Solaris</em>)
unix_without_macos_sunos(<code>sunos</code><br/>☀️ <em>SunOS</em>)
unix_without_macos_tuxedo(<code>tuxedo</code><br/>❓ <em>Tuxedo OS</em>)
unix_without_macos_ubuntu(<code>ubuntu</code><br/>🎯 <em>Ubuntu</em>)
unix_without_macos_unknown_linux(<code>unknown_linux</code><br/>🐧 <em>Unknown Linux</em>)
unix_without_macos_wsl1(<code>wsl1</code><br/>⊞ <em>Windows Subsystem for Linux v1</em>)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
SOLARIS,
SUNOS,
SYSTEM_V,
TUXEDO,
UBUNTU,
UNIX,
UNIX_LAYERS,
Expand Down Expand Up @@ -126,6 +127,7 @@
is_sles,
is_solaris,
is_sunos,
is_tuxedo,
is_ubuntu,
is_unknown_linux,
is_windows,
Expand Down Expand Up @@ -229,6 +231,7 @@ def test_mutual_exclusion():
assert not is_sles()
assert not is_solaris()
assert not is_sunos()
assert not is_tuxedo()
# assert not is_ubuntu()
assert not is_unknown_linux()
assert not is_windows()
Expand Down Expand Up @@ -276,6 +279,7 @@ def test_mutual_exclusion():
assert not is_sles()
assert not is_solaris()
assert not is_sunos()
assert not is_tuxedo()
assert not is_ubuntu()
assert not is_unknown_linux()
assert not is_windows()
Expand Down Expand Up @@ -323,6 +327,7 @@ def test_mutual_exclusion():
assert not is_sles()
assert not is_solaris()
assert not is_sunos()
assert not is_tuxedo()
assert not is_ubuntu()
assert not is_unknown_linux()
# assert not is_windows()
Expand Down Expand Up @@ -634,6 +639,7 @@ def test_overlapping_groups():
SLES,
SOLARIS,
SUNOS,
TUXEDO,
UBUNTU,
UNKNOWN_LINUX,
WINDOWS,
Expand Down
Loading