Fix README and add urls for Tesla drivers

* support adding tesla drivers

* linux: patch for 535.104.12
This commit is contained in:
MoetaYuko 2023-10-08 16:02:36 +08:00 committed by GitHub
parent 2bd1fcb521
commit 4ce52a4b5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 25 deletions

View File

@ -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. 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 ## Requirements
@ -45,17 +45,21 @@ Here is real commands used for Windows driver 441.28 and 512.95 series:
``` ```
$ ./add_driver.py --help $ ./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 Adds new Nvidia driver into drivers.json file of in your repo working copy
positional arguments: positional arguments:
version driver version version driver version
optional arguments: options:
-h, --help show this help message and exit -h, --help show this help message and exit
-U URL, --url URL override driver link (default: None) -U URL, --url URL override driver link (default: None)
--skip-url-check skip driver URL check (default: False) --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: OS options:
-L, --linux add Linux driver (default: None) -L, --linux add Linux driver (default: None)

View File

@ -6,12 +6,11 @@ import json
import os.path import os.path
import posixpath import posixpath
from string import Template from string import Template
from itertools import groupby
from functools import partial from functools import partial
import urllib.request import urllib.request
from constants import OSKind, Product, WinSeries, DATAFILE_PATH, \ 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 from utils import find_driver, linux_driver_key, windows_driver_key
def parse_args(): def parse_args():
@ -119,25 +118,33 @@ def validate_unique(drivers, new_driver, kf):
def main(): def main():
args = parse_args() args = parse_args()
if args.url is None: if not args.url:
if args.os is OSKind.Linux: 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: else:
url_tmpl = Template(DRIVER_URL_TEMPLATE[(args.os, url_tmpl = DRIVER_URL_TEMPLATE[(args.os,
args.product, args.product,
args.winseries, args.winseries,
args.variant)]) args.variant)]
url = url_tmpl.substitute(version=args.version) if isinstance(url_tmpl, str):
url_tmpl = [url_tmpl]
urls = [Template(i).substitute(version=args.version) for i in url_tmpl if i]
else: else:
url = args.url urls = [args.url]
if url and not args.skip_url_check: url = ""
if urls and not args.skip_url_check:
last_exc = None
for url in urls:
try: try:
validate_url(url) validate_url(url)
break
except KeyboardInterrupt: except KeyboardInterrupt:
raise raise
except Exception as exc: except Exception as exc:
print("Driver URL validation failed with error: %s" % str(exc), file=sys.stderr) last_exc = exc
print("Driver URL: %s" % str(url), file=sys.stderr) 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("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) print("or use option --skip-url-check to submit incorrect URL.", file=sys.stderr)
return return

View File

@ -37,11 +37,14 @@ WINDOWS_README_PATH = os.path.join(BASE_PATH,
ENCODING='utf-8' ENCODING='utf-8'
DRIVER_URL_TEMPLATE = { 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, ''): "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, '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.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.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, ''): "https://international.download.nvidia.com/Windows/$version/$version-desktop-win8-win7-64bit-international-whql.exe",
(OSKind.Windows, Product.GeForce, WinSeries.win7, 'Vulkan Beta'): "", (OSKind.Windows, Product.GeForce, WinSeries.win7, 'Vulkan Beta'): "",