We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Auto update latest DXVK versions
https://github.com/lutris/lutris/blob/525c84d9da173e84fd5585eed6b9d2fef5bef2b2/lutris/util/dxvk.py#L11-L12

Instead of writing static versions, use GitHub API to get the latest versions of DXVK:
```bash
curl -s https://api.github.com/repos/doitsujin/dxvk/tags  | jq '[.[] | .name] | join(", ")'
"v0.62, v0.61, v0.60, v0.54, v0.53, v0.52, v0.51, v0.50, v0.42, v0.41, v0.40, v0.31, v0.30, v0.21, v0.20"
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lutris/util/dxvk.py`
Content:
```
1 """DXVK helper module"""
2 import os
3 import time
4 import shutil
5 
6 from lutris.settings import RUNTIME_DIR
7 from lutris.util.log import logger
8 from lutris.util.extract import extract_archive
9 from lutris.util.downloader import Downloader
10 
11 DXVK_LATEST = "0.52"
12 DXVK_PAST_RELEASES = ["0.51", "0.50", "0.42", "0.31", "0.21"]
13 
14 
15 class DXVKManager:
16     """Utility class to install DXVK dlls to a Wine prefix"""
17     base_url = "https://github.com/doitsujin/dxvk/releases/download/v{}/dxvk-{}.tar.gz"
18     base_dir = os.path.join(RUNTIME_DIR, 'dxvk')
19     dxvk_dlls = ('dxgi', 'd3d11')
20     latest_version = DXVK_LATEST
21 
22     def __init__(self, prefix, arch='win64', version=None):
23         self.prefix = prefix
24         if not os.path.isdir(self.base_dir):
25             os.makedirs(self.base_dir)
26         self._version = version
27         self.wine_arch = arch
28 
29     @property
30     def version(self):
31         """Return version of DXVK (latest known version if not provided)"""
32         if self._version:
33             return self._version
34         return self.latest_version
35 
36     @property
37     def dxvk_path(self):
38         """Return path to DXVK local cache"""
39         return os.path.join(self.base_dir, self.version)
40 
41     @staticmethod
42     def is_dxvk_dll(dll_path):
43         """Check if a given DLL path is provided by DXVK
44 
45         Very basic check to see if a dll exists and is over 1MB. If this is the
46         case, then consider the DLL to be from DXVK
47         """
48         if os.path.exists(dll_path):
49             dll_stats = os.stat(dll_path)
50             dll_size = dll_stats.st_size
51         else:
52             dll_size = 0
53         return dll_size > 1024 * 1024
54 
55     def is_available(self):
56         """Return whether DXVK is cached locally"""
57         return os.path.exists(self.dxvk_path)
58 
59     def download(self):
60         """Download DXVK to the local cache"""
61         # There's a glitch in one of the archive's names
62         fixed_version = 'v0.40' if self.version == '0.40' else self.version
63         dxvk_url = self.base_url.format(self.version, fixed_version)
64         if self.is_available():
65             logger.warning("DXVK already available at %s", self.dxvk_path)
66 
67         dxvk_archive_path = os.path.join(self.base_dir, os.path.basename(dxvk_url))
68         downloader = Downloader(dxvk_url, dxvk_archive_path)
69         downloader.start()
70         while downloader.check_progress() < 1:
71             time.sleep(1)
72         if not os.path.exists(dxvk_archive_path):
73             logger.error("DXVK %s not downloaded")
74             return
75         if os.stat(dxvk_archive_path).st_size:
76             extract_archive(dxvk_archive_path, self.dxvk_path, merge_single=True)
77         else:
78             logger.error("%s is an empty file", self.dxvk_path)
79         os.remove(dxvk_archive_path)
80 
81     def enable_dxvk_dll(self, system_dir, dxvk_arch, dll):
82         """Copies DXVK dlls to the appropriate destination"""
83         wine_dll_path = os.path.join(system_dir, '%s.dll' % dll)
84         logger.info("Replacing %s/%s with DXVK version", system_dir, dll)
85         if not self.is_dxvk_dll(wine_dll_path):
86             # Backing up original version (may not be needed)
87             if os.path.exists(wine_dll_path):
88                 shutil.move(wine_dll_path, wine_dll_path + ".orig")
89         # Copying DXVK's version
90         dxvk_dll_path = os.path.join(self.dxvk_path, dxvk_arch, "%s.dll" % dll)
91         shutil.copy(dxvk_dll_path, wine_dll_path)
92 
93     def disable_dxvk_dll(self, system_dir, dxvk_arch, dll):
94         """Remove DXVK DLL from Wine prefix"""
95         wine_dll_path = os.path.join(system_dir, '%s.dll' % dll)
96         if self.is_dxvk_dll(wine_dll_path):
97             logger.info("Removing DXVK dll %s/%s", system_dir, dll)
98             os.remove(wine_dll_path)
99         # Restoring original version (may not be needed)
100         if os.path.exists(wine_dll_path + '.orig'):
101             shutil.move(wine_dll_path + '.orig', wine_dll_path)
102 
103     def _iter_dxvk_dlls(self):
104         windows_path = os.path.join(self.prefix, 'drive_c/windows')
105         if self.wine_arch == 'win64':
106             system_dirs = {
107                 'x64': os.path.join(windows_path, 'system32'),
108                 'x32': os.path.join(windows_path, 'syswow64')
109             }
110         elif self.wine_arch == 'win32':
111             system_dirs = {
112                 'x32': os.path.join(windows_path, 'system32'),
113             }
114 
115         for dxvk_arch, system_dir in system_dirs.items():
116             for dll in self.dxvk_dlls:
117                 yield system_dir, dxvk_arch, dll
118 
119     def enable(self):
120         """Enable DXVK for the current prefix"""
121         if not os.path.exists(self.dxvk_path):
122             logger.error("DXVK %s is not availble locally" % self.version)
123             return
124         for system_dir, dxvk_arch, dll in self._iter_dxvk_dlls():
125             self.enable_dxvk_dll(system_dir, dxvk_arch, dll)
126 
127     def disable(self):
128         """Disable DXVK for the current prefix"""
129         for system_dir, dxvk_arch, dll in self._iter_dxvk_dlls():
130             self.disable_dxvk_dll(system_dir, dxvk_arch, dll)
131
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lutris/util/dxvk.py b/lutris/util/dxvk.py
--- a/lutris/util/dxvk.py
+++ b/lutris/util/dxvk.py
@@ -1,16 +1,41 @@
 """DXVK helper module"""
 import os
+import json
 import time
 import shutil
+import urllib.request
 
 from lutris.settings import RUNTIME_DIR
 from lutris.util.log import logger
 from lutris.util.extract import extract_archive
 from lutris.util.downloader import Downloader
 
-DXVK_LATEST = "0.52"
-DXVK_PAST_RELEASES = ["0.51", "0.50", "0.42", "0.31", "0.21"]
 
+def get_latest_dxvk_versions():
+    """Get latest DXVK versions from GitHub"""
+    dxvk_url = "https://api.github.com/repos/doitsujin/dxvk/tags"
+    cache = os.path.join(RUNTIME_DIR, 'dxvk', 'dxvk_versions.json')
+
+    # If the DXVK cache does not exist then download it
+    if not os.path.exists(cache):
+        urllib.request.urlretrieve(dxvk_url, cache)
+
+    # Re-download DXVK versions cache if more than a day old
+    if os.path.getmtime(cache)+86400 < time.time():
+        urllib.request.urlretrieve(dxvk_url, cache)
+
+    with open(cache, "r") as f:
+        dxvk_json = json.load(f)
+        DXVK_LATEST = dxvk_json[0]['name'].replace('v','')
+        DXVK_PAST_RELEASES = [x['name'].replace('v', '') for x in dxvk_json][1:]
+
+    return DXVK_LATEST, DXVK_PAST_RELEASES
+
+try:
+    DXVK_LATEST, DXVK_PAST_RELEASES = get_latest_dxvk_versions()
+except:
+    DXVK_LATEST = "0.52"
+    DXVK_PAST_RELEASES = ["0.51", "0.50", "0.42", "0.31", "0.21"]
 
 class DXVKManager:
     """Utility class to install DXVK dlls to a Wine prefix"""

{"golden_diff": "diff --git a/lutris/util/dxvk.py b/lutris/util/dxvk.py\n--- a/lutris/util/dxvk.py\n+++ b/lutris/util/dxvk.py\n@@ -1,16 +1,41 @@\n \"\"\"DXVK helper module\"\"\"\n import os\n+import json\n import time\n import shutil\n+import urllib.request\n \n from lutris.settings import RUNTIME_DIR\n from lutris.util.log import logger\n from lutris.util.extract import extract_archive\n from lutris.util.downloader import Downloader\n \n-DXVK_LATEST = \"0.52\"\n-DXVK_PAST_RELEASES = [\"0.51\", \"0.50\", \"0.42\", \"0.31\", \"0.21\"]\n \n+def get_latest_dxvk_versions():\n+    \"\"\"Get latest DXVK versions from GitHub\"\"\"\n+    dxvk_url = \"https://api.github.com/repos/doitsujin/dxvk/tags\"\n+    cache = os.path.join(RUNTIME_DIR, 'dxvk', 'dxvk_versions.json')\n+\n+    # If the DXVK cache does not exist then download it\n+    if not os.path.exists(cache):\n+        urllib.request.urlretrieve(dxvk_url, cache)\n+\n+    # Re-download DXVK versions cache if more than a day old\n+    if os.path.getmtime(cache)+86400 < time.time():\n+        urllib.request.urlretrieve(dxvk_url, cache)\n+\n+    with open(cache, \"r\") as f:\n+        dxvk_json = json.load(f)\n+        DXVK_LATEST = dxvk_json[0]['name'].replace('v','')\n+        DXVK_PAST_RELEASES = [x['name'].replace('v', '') for x in dxvk_json][1:]\n+\n+    return DXVK_LATEST, DXVK_PAST_RELEASES\n+\n+try:\n+    DXVK_LATEST, DXVK_PAST_RELEASES = get_latest_dxvk_versions()\n+except:\n+    DXVK_LATEST = \"0.52\"\n+    DXVK_PAST_RELEASES = [\"0.51\", \"0.50\", \"0.42\", \"0.31\", \"0.21\"]\n \n class DXVKManager:\n     \"\"\"Utility class to install DXVK dlls to a Wine prefix\"\"\"\n", "issue": "Auto update latest DXVK versions\nhttps://github.com/lutris/lutris/blob/525c84d9da173e84fd5585eed6b9d2fef5bef2b2/lutris/util/dxvk.py#L11-L12\r\n\r\nInstead of writing static versions, use GitHub API to get the latest versions of DXVK:\r\n```bash\r\ncurl -s https://api.github.com/repos/doitsujin/dxvk/tags  | jq '[.[] | .name] | join(\", \")'\r\n\"v0.62, v0.61, v0.60, v0.54, v0.53, v0.52, v0.51, v0.50, v0.42, v0.41, v0.40, v0.31, v0.30, v0.21, v0.20\"\r\n```\n", "before_files": [{"content": "\"\"\"DXVK helper module\"\"\"\nimport os\nimport time\nimport shutil\n\nfrom lutris.settings import RUNTIME_DIR\nfrom lutris.util.log import logger\nfrom lutris.util.extract import extract_archive\nfrom lutris.util.downloader import Downloader\n\nDXVK_LATEST = \"0.52\"\nDXVK_PAST_RELEASES = [\"0.51\", \"0.50\", \"0.42\", \"0.31\", \"0.21\"]\n\n\nclass DXVKManager:\n    \"\"\"Utility class to install DXVK dlls to a Wine prefix\"\"\"\n    base_url = \"https://github.com/doitsujin/dxvk/releases/download/v{}/dxvk-{}.tar.gz\"\n    base_dir = os.path.join(RUNTIME_DIR, 'dxvk')\n    dxvk_dlls = ('dxgi', 'd3d11')\n    latest_version = DXVK_LATEST\n\n    def __init__(self, prefix, arch='win64', version=None):\n        self.prefix = prefix\n        if not os.path.isdir(self.base_dir):\n            os.makedirs(self.base_dir)\n        self._version = version\n        self.wine_arch = arch\n\n    @property\n    def version(self):\n        \"\"\"Return version of DXVK (latest known version if not provided)\"\"\"\n        if self._version:\n            return self._version\n        return self.latest_version\n\n    @property\n    def dxvk_path(self):\n        \"\"\"Return path to DXVK local cache\"\"\"\n        return os.path.join(self.base_dir, self.version)\n\n    @staticmethod\n    def is_dxvk_dll(dll_path):\n        \"\"\"Check if a given DLL path is provided by DXVK\n\n        Very basic check to see if a dll exists and is over 1MB. If this is the\n        case, then consider the DLL to be from DXVK\n        \"\"\"\n        if os.path.exists(dll_path):\n            dll_stats = os.stat(dll_path)\n            dll_size = dll_stats.st_size\n        else:\n            dll_size = 0\n        return dll_size > 1024 * 1024\n\n    def is_available(self):\n        \"\"\"Return whether DXVK is cached locally\"\"\"\n        return os.path.exists(self.dxvk_path)\n\n    def download(self):\n        \"\"\"Download DXVK to the local cache\"\"\"\n        # There's a glitch in one of the archive's names\n        fixed_version = 'v0.40' if self.version == '0.40' else self.version\n        dxvk_url = self.base_url.format(self.version, fixed_version)\n        if self.is_available():\n            logger.warning(\"DXVK already available at %s\", self.dxvk_path)\n\n        dxvk_archive_path = os.path.join(self.base_dir, os.path.basename(dxvk_url))\n        downloader = Downloader(dxvk_url, dxvk_archive_path)\n        downloader.start()\n        while downloader.check_progress() < 1:\n            time.sleep(1)\n        if not os.path.exists(dxvk_archive_path):\n            logger.error(\"DXVK %s not downloaded\")\n            return\n        if os.stat(dxvk_archive_path).st_size:\n            extract_archive(dxvk_archive_path, self.dxvk_path, merge_single=True)\n        else:\n            logger.error(\"%s is an empty file\", self.dxvk_path)\n        os.remove(dxvk_archive_path)\n\n    def enable_dxvk_dll(self, system_dir, dxvk_arch, dll):\n        \"\"\"Copies DXVK dlls to the appropriate destination\"\"\"\n        wine_dll_path = os.path.join(system_dir, '%s.dll' % dll)\n        logger.info(\"Replacing %s/%s with DXVK version\", system_dir, dll)\n        if not self.is_dxvk_dll(wine_dll_path):\n            # Backing up original version (may not be needed)\n            if os.path.exists(wine_dll_path):\n                shutil.move(wine_dll_path, wine_dll_path + \".orig\")\n        # Copying DXVK's version\n        dxvk_dll_path = os.path.join(self.dxvk_path, dxvk_arch, \"%s.dll\" % dll)\n        shutil.copy(dxvk_dll_path, wine_dll_path)\n\n    def disable_dxvk_dll(self, system_dir, dxvk_arch, dll):\n        \"\"\"Remove DXVK DLL from Wine prefix\"\"\"\n        wine_dll_path = os.path.join(system_dir, '%s.dll' % dll)\n        if self.is_dxvk_dll(wine_dll_path):\n            logger.info(\"Removing DXVK dll %s/%s\", system_dir, dll)\n            os.remove(wine_dll_path)\n        # Restoring original version (may not be needed)\n        if os.path.exists(wine_dll_path + '.orig'):\n            shutil.move(wine_dll_path + '.orig', wine_dll_path)\n\n    def _iter_dxvk_dlls(self):\n        windows_path = os.path.join(self.prefix, 'drive_c/windows')\n        if self.wine_arch == 'win64':\n            system_dirs = {\n                'x64': os.path.join(windows_path, 'system32'),\n                'x32': os.path.join(windows_path, 'syswow64')\n            }\n        elif self.wine_arch == 'win32':\n            system_dirs = {\n                'x32': os.path.join(windows_path, 'system32'),\n            }\n\n        for dxvk_arch, system_dir in system_dirs.items():\n            for dll in self.dxvk_dlls:\n                yield system_dir, dxvk_arch, dll\n\n    def enable(self):\n        \"\"\"Enable DXVK for the current prefix\"\"\"\n        if not os.path.exists(self.dxvk_path):\n            logger.error(\"DXVK %s is not availble locally\" % self.version)\n            return\n        for system_dir, dxvk_arch, dll in self._iter_dxvk_dlls():\n            self.enable_dxvk_dll(system_dir, dxvk_arch, dll)\n\n    def disable(self):\n        \"\"\"Disable DXVK for the current prefix\"\"\"\n        for system_dir, dxvk_arch, dll in self._iter_dxvk_dlls():\n            self.disable_dxvk_dll(system_dir, dxvk_arch, dll)\n", "path": "lutris/util/dxvk.py"}], "after_files": [{"content": "\"\"\"DXVK helper module\"\"\"\nimport os\nimport json\nimport time\nimport shutil\nimport urllib.request\n\nfrom lutris.settings import RUNTIME_DIR\nfrom lutris.util.log import logger\nfrom lutris.util.extract import extract_archive\nfrom lutris.util.downloader import Downloader\n\n\ndef get_latest_dxvk_versions():\n    \"\"\"Get latest DXVK versions from GitHub\"\"\"\n    dxvk_url = \"https://api.github.com/repos/doitsujin/dxvk/tags\"\n    cache = os.path.join(RUNTIME_DIR, 'dxvk', 'dxvk_versions.json')\n\n    # If the DXVK cache does not exist then download it\n    if not os.path.exists(cache):\n        urllib.request.urlretrieve(dxvk_url, cache)\n\n    # Re-download DXVK versions cache if more than a day old\n    if os.path.getmtime(cache)+86400 < time.time():\n        urllib.request.urlretrieve(dxvk_url, cache)\n\n    with open(cache, \"r\") as f:\n        dxvk_json = json.load(f)\n        DXVK_LATEST = dxvk_json[0]['name'].replace('v','')\n        DXVK_PAST_RELEASES = [x['name'].replace('v', '') for x in dxvk_json][1:]\n\n    return DXVK_LATEST, DXVK_PAST_RELEASES\n\ntry:\n    DXVK_LATEST, DXVK_PAST_RELEASES = get_latest_dxvk_versions()\nexcept:\n    DXVK_LATEST = \"0.52\"\n    DXVK_PAST_RELEASES = [\"0.51\", \"0.50\", \"0.42\", \"0.31\", \"0.21\"]\n\nclass DXVKManager:\n    \"\"\"Utility class to install DXVK dlls to a Wine prefix\"\"\"\n    base_url = \"https://github.com/doitsujin/dxvk/releases/download/v{}/dxvk-{}.tar.gz\"\n    base_dir = os.path.join(RUNTIME_DIR, 'dxvk')\n    dxvk_dlls = ('dxgi', 'd3d11')\n    latest_version = DXVK_LATEST\n\n    def __init__(self, prefix, arch='win64', version=None):\n        self.prefix = prefix\n        if not os.path.isdir(self.base_dir):\n            os.makedirs(self.base_dir)\n        self._version = version\n        self.wine_arch = arch\n\n    @property\n    def version(self):\n        \"\"\"Return version of DXVK (latest known version if not provided)\"\"\"\n        if self._version:\n            return self._version\n        return self.latest_version\n\n    @property\n    def dxvk_path(self):\n        \"\"\"Return path to DXVK local cache\"\"\"\n        return os.path.join(self.base_dir, self.version)\n\n    @staticmethod\n    def is_dxvk_dll(dll_path):\n        \"\"\"Check if a given DLL path is provided by DXVK\n\n        Very basic check to see if a dll exists and is over 1MB. If this is the\n        case, then consider the DLL to be from DXVK\n        \"\"\"\n        if os.path.exists(dll_path):\n            dll_stats = os.stat(dll_path)\n            dll_size = dll_stats.st_size\n        else:\n            dll_size = 0\n        return dll_size > 1024 * 1024\n\n    def is_available(self):\n        \"\"\"Return whether DXVK is cached locally\"\"\"\n        return os.path.exists(self.dxvk_path)\n\n    def download(self):\n        \"\"\"Download DXVK to the local cache\"\"\"\n        # There's a glitch in one of the archive's names\n        fixed_version = 'v0.40' if self.version == '0.40' else self.version\n        dxvk_url = self.base_url.format(self.version, fixed_version)\n        if self.is_available():\n            logger.warning(\"DXVK already available at %s\", self.dxvk_path)\n\n        dxvk_archive_path = os.path.join(self.base_dir, os.path.basename(dxvk_url))\n        downloader = Downloader(dxvk_url, dxvk_archive_path)\n        downloader.start()\n        while downloader.check_progress() < 1:\n            time.sleep(1)\n        if not os.path.exists(dxvk_archive_path):\n            logger.error(\"DXVK %s not downloaded\")\n            return\n        if os.stat(dxvk_archive_path).st_size:\n            extract_archive(dxvk_archive_path, self.dxvk_path, merge_single=True)\n        else:\n            logger.error(\"%s is an empty file\", self.dxvk_path)\n        os.remove(dxvk_archive_path)\n\n    def enable_dxvk_dll(self, system_dir, dxvk_arch, dll):\n        \"\"\"Copies DXVK dlls to the appropriate destination\"\"\"\n        wine_dll_path = os.path.join(system_dir, '%s.dll' % dll)\n        logger.info(\"Replacing %s/%s with DXVK version\", system_dir, dll)\n        if not self.is_dxvk_dll(wine_dll_path):\n            # Backing up original version (may not be needed)\n            if os.path.exists(wine_dll_path):\n                shutil.move(wine_dll_path, wine_dll_path + \".orig\")\n        # Copying DXVK's version\n        dxvk_dll_path = os.path.join(self.dxvk_path, dxvk_arch, \"%s.dll\" % dll)\n        shutil.copy(dxvk_dll_path, wine_dll_path)\n\n    def disable_dxvk_dll(self, system_dir, dxvk_arch, dll):\n        \"\"\"Remove DXVK DLL from Wine prefix\"\"\"\n        wine_dll_path = os.path.join(system_dir, '%s.dll' % dll)\n        if self.is_dxvk_dll(wine_dll_path):\n            logger.info(\"Removing DXVK dll %s/%s\", system_dir, dll)\n            os.remove(wine_dll_path)\n        # Restoring original version (may not be needed)\n        if os.path.exists(wine_dll_path + '.orig'):\n            shutil.move(wine_dll_path + '.orig', wine_dll_path)\n\n    def _iter_dxvk_dlls(self):\n        windows_path = os.path.join(self.prefix, 'drive_c/windows')\n        if self.wine_arch == 'win64':\n            system_dirs = {\n                'x64': os.path.join(windows_path, 'system32'),\n                'x32': os.path.join(windows_path, 'syswow64')\n            }\n        elif self.wine_arch == 'win32':\n            system_dirs = {\n                'x32': os.path.join(windows_path, 'system32'),\n            }\n\n        for dxvk_arch, system_dir in system_dirs.items():\n            for dll in self.dxvk_dlls:\n                yield system_dir, dxvk_arch, dll\n\n    def enable(self):\n        \"\"\"Enable DXVK for the current prefix\"\"\"\n        if not os.path.exists(self.dxvk_path):\n            logger.error(\"DXVK %s is not availble locally\" % self.version)\n            return\n        for system_dir, dxvk_arch, dll in self._iter_dxvk_dlls():\n            self.enable_dxvk_dll(system_dir, dxvk_arch, dll)\n\n    def disable(self):\n        \"\"\"Disable DXVK for the current prefix\"\"\"\n        for system_dir, dxvk_arch, dll in self._iter_dxvk_dlls():\n            self.disable_dxvk_dll(system_dir, dxvk_arch, dll)\n", "path": "lutris/util/dxvk.py"}]}