From 4ce52a4b5b9a1c3a9090f1670d303b694b461523 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Sun, 8 Oct 2023 16:02:36 +0800 Subject: [PATCH] Fix README and add urls for Tesla drivers * support adding tesla drivers * linux: patch for 535.104.12 --- README.md | 2 +- tools/readme-autogen/README.md | 10 +++-- tools/readme-autogen/add_driver.py | 43 +++++++++++-------- tools/readme-autogen/constants.py | 7 ++- .../templates/linux_readme_master.tmpl | 2 +- 5 files changed, 39 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 798f5a4..467a37b 100644 --- a/README.md +++ b/README.md @@ -314,7 +314,7 @@ bash ./patch-fbc.sh -f -r ## See also -* Plex Media Server: enable HW **decoding**: +* Plex Media Server: enable HW **decoding**: * [GH Issue](https://github.com/keylase/nvidia-patch/issues/51) * PMS Forum: 1. [https://forums.plex.tv/t/hardware-accelerated-decode-nvidia-for-linux/233510/158](https://forums.plex.tv/t/hardware-accelerated-decode-nvidia-for-linux/233510/158) diff --git a/tools/readme-autogen/README.md b/tools/readme-autogen/README.md index fd15e14..adc5fc4 100644 --- a/tools/readme-autogen/README.md +++ b/tools/readme-autogen/README.md @@ -3,7 +3,7 @@ readme-autogen readme-autogen is a tool for internal usage, which purpose is to simplify maintenance of fresh and correct README files for this project. -It rebuilds REAME files from templates located in `templates` directory and driver data specified in `drivers.json` file. +It rebuilds README files from templates located in `templates` directory and driver data specified in `drivers.json` file. ## Requirements @@ -45,17 +45,21 @@ Here is real commands used for Windows driver 441.28 and 512.95 series: ``` $ ./add_driver.py --help -usage: add_driver.py [-h] (-L | -W) [--variant VARIANT] [-P {GeForce,Quadro}] [-w {win10,win7,ws2012,ws2016}] [--patch32 PATCH32] [--patch64 PATCH64] [--skip-patch-check] [-U URL] [--skip-url-check] version +usage: add_driver.py [-h] (-L | -W) [--variant VARIANT] [-P {GeForce,Quadro}] [-w {win10,win7,ws2012,ws2016}] [--patch32 PATCH32] [--patch64 PATCH64] [--skip-patch-check] [-U URL] + [--skip-url-check] [--no-fbc] [--no-enc] + version Adds new Nvidia driver into drivers.json file of in your repo working copy positional arguments: version driver version -optional arguments: +options: -h, --help show this help message and exit -U URL, --url URL override driver link (default: None) --skip-url-check skip driver URL check (default: False) + --no-fbc add driver w/o NvFBC patch (default: True) + --no-enc add driver w/o NVENC patch (default: True) OS options: -L, --linux add Linux driver (default: None) diff --git a/tools/readme-autogen/add_driver.py b/tools/readme-autogen/add_driver.py index bb1464f..fc4ec1e 100755 --- a/tools/readme-autogen/add_driver.py +++ b/tools/readme-autogen/add_driver.py @@ -6,12 +6,11 @@ import json import os.path import posixpath from string import Template -from itertools import groupby from functools import partial import urllib.request from constants import OSKind, Product, WinSeries, DATAFILE_PATH, \ - DRIVER_URL_TEMPLATE, DRIVER_DIR_PREFIX, BASE_PATH, REPO_BASE + DRIVER_URL_TEMPLATE, DRIVER_DIR_PREFIX, BASE_PATH from utils import find_driver, linux_driver_key, windows_driver_key def parse_args(): @@ -119,25 +118,33 @@ def validate_unique(drivers, new_driver, kf): def main(): args = parse_args() - if args.url is None: + if not args.url: if args.os is OSKind.Linux: - url_tmpl = Template(DRIVER_URL_TEMPLATE[(args.os, None, None, None)]) + url_tmpl = DRIVER_URL_TEMPLATE[(args.os, None, None, None)] else: - url_tmpl = Template(DRIVER_URL_TEMPLATE[(args.os, - args.product, - args.winseries, - args.variant)]) - url = url_tmpl.substitute(version=args.version) + url_tmpl = DRIVER_URL_TEMPLATE[(args.os, + args.product, + args.winseries, + args.variant)] + if isinstance(url_tmpl, str): + url_tmpl = [url_tmpl] + urls = [Template(i).substitute(version=args.version) for i in url_tmpl if i] else: - url = args.url - if url and not args.skip_url_check: - try: - validate_url(url) - except KeyboardInterrupt: - raise - except Exception as exc: - print("Driver URL validation failed with error: %s" % str(exc), file=sys.stderr) - print("Driver URL: %s" % str(url), file=sys.stderr) + urls = [args.url] + url = "" + if urls and not args.skip_url_check: + last_exc = None + for url in urls: + try: + validate_url(url) + break + except KeyboardInterrupt: + raise + except Exception as exc: + last_exc = exc + else: + print("Driver URL validation failed with error: %s" % str(last_exc), file=sys.stderr) + print("Driver URL: %s" % ", ".join(urls), file=sys.stderr) print("Please use option -U to override driver link manually", file=sys.stderr) print("or use option --skip-url-check to submit incorrect URL.", file=sys.stderr) return diff --git a/tools/readme-autogen/constants.py b/tools/readme-autogen/constants.py index ef48043..02e4f04 100644 --- a/tools/readme-autogen/constants.py +++ b/tools/readme-autogen/constants.py @@ -37,11 +37,14 @@ WINDOWS_README_PATH = os.path.join(BASE_PATH, ENCODING='utf-8' DRIVER_URL_TEMPLATE = { - (OSKind.Linux, None, None, None): "https://international.download.nvidia.com/XFree86/Linux-x86_64/$version/NVIDIA-Linux-x86_64-$version.run", + (OSKind.Linux, None, None, None): ["https://international.download.nvidia.com/XFree86/Linux-x86_64/$version/NVIDIA-Linux-x86_64-$version.run", + "https://international.download.nvidia.com/tesla/$version/NVIDIA-Linux-x86_64-$version.run"], (OSKind.Windows, Product.GeForce, WinSeries.win10, ''): "https://international.download.nvidia.com/Windows/$version/$version-desktop-win10-win11-64bit-international-whql.exe", - (OSKind.Windows, Product.GeForce, WinSeries.win10, 'DCH'): "https://international.download.nvidia.com/Windows/$version/$version-desktop-win10-win11-64bit-international-dch-whql.exe", + (OSKind.Windows, Product.GeForce, WinSeries.win10, 'DCH'): ["https://international.download.nvidia.com/Windows/$version/$version-desktop-win10-win11-64bit-international-dch-whql.exe", + "https://international.download.nvidia.com/tesla/$version/$version-data-center-tesla-desktop-win10-win11-64bit-dch-international.exe"], (OSKind.Windows, Product.GeForce, WinSeries.win10, 'Studio Driver'): "https://international.download.nvidia.com/Windows/$version/$version-desktop-win10-win11-64bit-international-nsd-dch-whql.exe", (OSKind.Windows, Product.GeForce, WinSeries.win10, 'Vulkan Beta'): "", + (OSKind.Windows, Product.GeForce, WinSeries.ws2016, 'DCH'): "https://international.download.nvidia.com/tesla/$version/$version-data-center-tesla-desktop-winserver-2016-2019-2022-dch-international.exe", (OSKind.Windows, Product.Quadro, WinSeries.win10, ''): "https://international.download.nvidia.com/Windows/Quadro_Certified/$version/$version-quadro-rtx-desktop-notebook-win10-win11-64bit-international-whql.exe", (OSKind.Windows, Product.GeForce, WinSeries.win7, ''): "https://international.download.nvidia.com/Windows/$version/$version-desktop-win8-win7-64bit-international-whql.exe", (OSKind.Windows, Product.GeForce, WinSeries.win7, 'Vulkan Beta'): "", diff --git a/tools/readme-autogen/templates/linux_readme_master.tmpl b/tools/readme-autogen/templates/linux_readme_master.tmpl index 323883c..8818c84 100644 --- a/tools/readme-autogen/templates/linux_readme_master.tmpl +++ b/tools/readme-autogen/templates/linux_readme_master.tmpl @@ -152,7 +152,7 @@ bash ./patch-fbc.sh -f -r ## See also -* Plex Media Server: enable HW **decoding**: +* Plex Media Server: enable HW **decoding**: * [GH Issue](https://github.com/keylase/nvidia-patch/issues/51) * PMS Forum: 1. [https://forums.plex.tv/t/hardware-accelerated-decode-nvidia-for-linux/233510/158](https://forums.plex.tv/t/hardware-accelerated-decode-nvidia-for-linux/233510/158)