Skip to main content

Checks what os is running

Project description

Checks what os is running

Tested against Windows 10/Android/Linux / Python 3.11 / Anaconda

pip install osversionchecker

The main focus is differentiating classic Linux / Android

    Determines the operating system by analyzing various system characteristics
    and assigns points based on detected features. The OS with the highest points
    is considered the active operating system.

    Returns:
        tuple: A dictionary with the points for each operating system and the 
        name of the detected active operating system.

    The function checks the following:
    - If the sys.executable path indicates a Windows system.
    - If the sys.executable path starts with '/data/data/' indicating an Android system.
    - The count of backslashes and slashes in the environment variables string.
    - The presence of certain files or directories that are specific to Windows or Android.
    - The output of certain shell commands that indicate an Android system.
    - The content of the uname command output to check for Linux, Darwin (macOS), or Android.
    - The platform information from the platform module to check for Linux, Darwin (macOS), or Android.
    - The sys.platform value to check for Linux, Darwin (macOS), Windows, or Android.
    - The sys.version string to check for Linux, Darwin (macOS), or Windows.

from osversionchecker import check_os

os_system_points, active_os_system = check_os()
print(active_os_system)
print(os_system_points)


windows
{'windows': 5, 'linux': 0, 'darwin': 0, 'android': 0}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osversionchecker-0.10.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

osversionchecker-0.10-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file osversionchecker-0.10.tar.gz.

File metadata

  • Download URL: osversionchecker-0.10.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for osversionchecker-0.10.tar.gz
Algorithm Hash digest
SHA256 eac17ae86ac196d845c46c797b02c4db485de74888a5bd112e2c32efa2c39c21
MD5 2bcaf8142cd438ffdd18a7474af194ef
BLAKE2b-256 09a1560a1ed6f0b4623ba097b3e080d83feb96b503eea76240d07f93faaa882c

See more details on using hashes here.

File details

Details for the file osversionchecker-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for osversionchecker-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a4eda7e1a4e8642defb4db0dca8f25c2415d52a5ed74bc7fabc1d37fccdc0df3
MD5 31c26b498264f5d4e3d7de2db5161d87
BLAKE2b-256 349bd378068e4b1c43a62f0fdac4001d8b2a062a7a2e27bf5301c51e31003ac6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page