├── requirements.txt ├── umu-scout ├── __init__.py └── __main__.py ├── LICENSE ├── .github └── workflows │ └── umu-scout.yml └── .gitignore /requirements.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /umu-scout/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /.github/workflows/umu-scout.yml: -------------------------------------------------------------------------------- 1 | name: umu-scout 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: '0 12 * * *' 7 | push: 8 | branches: 9 | - master 10 | paths: 11 | - umu-scout/* 12 | 13 | 14 | permissions: 15 | contents: write 16 | 17 | 18 | jobs: 19 | build: 20 | name: Build 21 | runs-on: ubuntu-latest 22 | outputs: 23 | tag: ${{ steps.package.outputs.tag }} 24 | steps: 25 | - uses: actions/checkout@v4 26 | with: 27 | fetch-depth: 0 28 | fetch-tags: true 29 | - uses: actions/setup-python@v5 30 | with: 31 | cache: pip 32 | python-version: '3.12' 33 | check-latest: true 34 | architecture: x64 35 | - name: Install dependencies 36 | run: | 37 | pip3 install -r requirements.txt 38 | - name: Package umu-scout compatibility tool 39 | id: package 40 | shell: bash 41 | env: 42 | UMU_SCOUT_REPO: ${{ github.repository }} 43 | run: | 44 | tag=$(python3 -m umu-scout update) 45 | echo "tag=$tag" >> "$GITHUB_OUTPUT" 46 | - name: Create release 47 | if: ${{ steps.package.outputs.tag != '' }} 48 | shell: bash 49 | env: 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | run: >- 52 | gh 53 | release create 54 | "${{ steps.package.outputs.tag }}" 55 | --latest 56 | --title "Version ${{ steps.package.outputs.tag }}" 57 | --notes-file dist/umu-scout.version.json 58 | - name: Upload umu-scout.tar.xz to release 59 | if: ${{ steps.package.outputs.tag != '' }} 60 | shell: bash 61 | env: 62 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 63 | run: >- 64 | gh 65 | release upload 66 | "${{ steps.package.outputs.tag }}" 67 | dist/umu-scout.tar.xz 68 | --clobber 69 | - name: Upload umu-scout.sha512sum to release 70 | if: ${{ steps.package.outputs.tag != '' }} 71 | shell: bash 72 | env: 73 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 74 | run: >- 75 | gh 76 | release upload 77 | "${{ steps.package.outputs.tag }}" 78 | dist/umu-scout.sha512sum 79 | --clobber 80 | - name: Upload umu-scout.version.json to release 81 | if: ${{ steps.package.outputs.tag != '' }} 82 | shell: bash 83 | env: 84 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 85 | run: >- 86 | gh 87 | release upload 88 | "${{ steps.package.outputs.tag }}" 89 | dist/umu-scout.version.json 90 | --clobber 91 | 92 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # UV 98 | # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | #uv.lock 102 | 103 | # poetry 104 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 105 | # This is especially recommended for binary packages to ensure reproducibility, and is more 106 | # commonly ignored for libraries. 107 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 108 | #poetry.lock 109 | 110 | # pdm 111 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 112 | #pdm.lock 113 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 114 | # in version control. 115 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control 116 | .pdm.toml 117 | .pdm-python 118 | .pdm-build/ 119 | 120 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 121 | __pypackages__/ 122 | 123 | # Celery stuff 124 | celerybeat-schedule 125 | celerybeat.pid 126 | 127 | # SageMath parsed files 128 | *.sage.py 129 | 130 | # Environments 131 | .env 132 | .venv 133 | env/ 134 | venv/ 135 | ENV/ 136 | env.bak/ 137 | venv.bak/ 138 | 139 | # Spyder project settings 140 | .spyderproject 141 | .spyproject 142 | 143 | # Rope project settings 144 | .ropeproject 145 | 146 | # mkdocs documentation 147 | /site 148 | 149 | # mypy 150 | .mypy_cache/ 151 | .dmypy.json 152 | dmypy.json 153 | 154 | # Pyre type checker 155 | .pyre/ 156 | 157 | # pytype static type analyzer 158 | .pytype/ 159 | 160 | # Cython debug symbols 161 | cython_debug/ 162 | 163 | # PyCharm 164 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 165 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 166 | # and can be added to the global gitignore or merged into this file. For a more nuclear 167 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 168 | #.idea/ 169 | 170 | # Ruff stuff: 171 | .ruff_cache/ 172 | 173 | # PyPI configuration file 174 | .pypirc 175 | -------------------------------------------------------------------------------- /umu-scout/__main__.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import json 3 | import os 4 | import shutil 5 | import sys 6 | import tarfile 7 | from datetime import date 8 | from io import BytesIO 9 | from pathlib import Path 10 | from urllib.request import urlopen, urlretrieve 11 | 12 | dist = Path("dist").resolve() 13 | 14 | app1070560_tar_url = "https://repo.steampowered.com/pressure-vessel/snapshots/latest/app1070560/SteamLinuxRuntime.tar.xz" 15 | app1070560_ver_url = "https://repo.steampowered.com/pressure-vessel/snapshots/latest/VERSION.txt" 16 | 17 | steam_runtime_tar_url = "https://repo.steampowered.com/steamrt1/images/latest-public-beta/steam-runtime.tar.xz" 18 | steam_runtime_ver_url = "https://repo.steampowered.com/steamrt1/images/latest-public-beta/steam-runtime.version.txt" 19 | steam_runtime_csum_url = "https://repo.steampowered.com/steamrt1/images/latest-public-beta/steam-runtime.tar.xz.checksum" 20 | 21 | package_parts = ("app1070560", "steam-runtime") 22 | package_name = "umu-scout" 23 | package_version_file = f"{package_name}.version.json" 24 | 25 | github_repo = os.environ.get("UMU_SCOUT_REPO", f"Open-Wine-Components/{package_name}") 26 | github_headers: dict[str, str] = { 27 | "Accept": "application/vnd.github+json", 28 | "X-GitHub-Api-Version": "2022-11-28", 29 | "User-Agent": "", 30 | } 31 | github_latest_url = f"https://api.github.com/repos/{github_repo}/releases/latest" 32 | 33 | 34 | def get_latest_release() -> dict | None: 35 | latest: dict | None = None 36 | 37 | with urlopen(github_latest_url) as url_fd: 38 | release = json.load(url_fd) 39 | 40 | if release is not None: 41 | asset = next((a for a in release["assets"] if a["name"] == package_version_file), None) 42 | if asset is not None: 43 | with urlopen(asset["browser_download_url"]) as url_fd: 44 | latest = json.load(url_fd) 45 | else: 46 | print(f"Could not find asset {package_version_file} at https://github.com/{github_repo}", file=sys.stderr) 47 | else: 48 | print(f"Could not find latest release at https://github.com/{github_repo}", file=sys.stderr) 49 | 50 | return latest 51 | 52 | 53 | if __name__ == "__main__": 54 | old_ver: dict | None = None 55 | if len(sys.argv) > 1 and sys.argv[1] == "update": 56 | try: 57 | old_ver = get_latest_release() 58 | except Exception as e: 59 | print(f"Could not read old versions from {github_latest_url}: {str(e)}", file=sys.stderr) 60 | print("Downloading latest", file=sys.stderr) 61 | else: 62 | print("Downloading latest", file=sys.stderr) 63 | 64 | versions = { 65 | "app1070560": urlopen(app1070560_ver_url).read().strip().decode("utf-8"), 66 | "steam-runtime": urlopen(steam_runtime_ver_url).read().strip().decode("utf-8"), 67 | "tag": str(date.today()).replace("-", "") 68 | } 69 | 70 | for part in package_parts: 71 | print(f"{part}: {old_ver.get(part) if old_ver else None} -> {versions[part]}", file=sys.stderr) 72 | print(f"tag: {old_ver.get('tag') if old_ver else None} -> {versions['tag']}", file=sys.stderr) 73 | 74 | if old_ver is not None and all([old_ver.get(p) == versions[p] for p in package_parts]): 75 | print("Already up to date", file=sys.stderr) 76 | sys.exit(0) 77 | 78 | if dist.exists(): 79 | shutil.rmtree(dist) 80 | dist.mkdir(exist_ok=True) 81 | 82 | with tarfile.open(name=None, fileobj=BytesIO(urlopen(app1070560_tar_url).read())) as tar: 83 | tar.extractall(dist, filter="fully_trusted") 84 | 85 | with tarfile.open(name=None, fileobj=BytesIO(urlopen(steam_runtime_tar_url).read())) as tar: 86 | tar.extractall(dist.joinpath("SteamLinuxRuntime"), filter="fully_trusted") 87 | 88 | urlretrieve(steam_runtime_csum_url, dist.joinpath("SteamLinuxRuntime", "steam-runtime.tar.xz.checksum")) 89 | 90 | shutil.move(dist.joinpath("SteamLinuxRuntime"), dist.joinpath(package_name)) 91 | archive = shutil.make_archive( 92 | dist.joinpath(package_name).as_posix(), 93 | format="xztar", 94 | root_dir=dist.relative_to(os.getcwd()).as_posix(), 95 | base_dir=dist.joinpath(package_name).relative_to(dist).as_posix() 96 | ) 97 | 98 | archive = dist.joinpath(archive) 99 | with open(archive, "rb") as tar: 100 | sha512sum = hashlib.sha512(tar.read()).hexdigest() 101 | 102 | with open(dist.joinpath(package_name).with_suffix(".sha512sum"), "w") as fd: 103 | fd.write(f"{sha512sum} {archive.name}") 104 | 105 | with open(dist.joinpath(package_version_file), "w") as versions_json: 106 | versions_json.write(json.dumps(versions)) 107 | 108 | # to stdout to be captured as tag 109 | print(versions["tag"], file=sys.stdout) 110 | 111 | sys.exit(0) 112 | --------------------------------------------------------------------------------