diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:09:22 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:09:22 -0500 |
| commit | 3baa73a9130adb13d340a79299bd3fc7e8663473 (patch) | |
| tree | ec7b1923b1b36823f6030c3f19b4b1e8ce139d69 /scripts/run_wine_tests.py | |
| parent | 3561d32a3b3dc75aa993527821e6e13809ce91a5 (diff) | |
| parent | 62bce63d1cfd00007f17b5c8255c5350c58084d4 (diff) | |
Merge pull request #3899 from bbareth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/run_wine_tests.py')
| -rw-r--r-- | scripts/run_wine_tests.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/scripts/run_wine_tests.py b/scripts/run_wine_tests.py index 8392c8121..6499eb74a 100644 --- a/scripts/run_wine_tests.py +++ b/scripts/run_wine_tests.py | |||
| @@ -80,15 +80,26 @@ class DriveMap: | |||
| 80 | if not os.path.isdir(dosdevices): | 80 | if not os.path.isdir(dosdevices): |
| 81 | self.note = f"no Wine prefix at {self.prefix}: drive {drive}: not mapped" | 81 | self.note = f"no Wine prefix at {self.prefix}: drive {drive}: not mapped" |
| 82 | return self | 82 | return self |
| 83 | already_set = f"drive {drive}: is already set in {dosdevices}: left as it is" | ||
| 83 | if os.path.lexists(link): | 84 | if os.path.lexists(link): |
| 84 | self.note = f"drive {drive}: is already set in {dosdevices}: left as it is" | 85 | self.note = already_set |
| 85 | return self | 86 | return self |
| 86 | self.scratch = tempfile.mkdtemp(prefix="wine-drive-") | 87 | self.scratch = tempfile.mkdtemp(prefix="wine-drive-") |
| 87 | parent = os.path.join(self.scratch, *rest[:-1]) | 88 | try: |
| 88 | os.makedirs(parent, exist_ok=True) | 89 | parent = os.path.join(self.scratch, *rest[:-1]) |
| 89 | os.symlink(self.root, os.path.join(parent, rest[-1])) | 90 | os.makedirs(parent, exist_ok=True) |
| 90 | os.symlink(self.scratch, link) | 91 | os.symlink(self.root, os.path.join(parent, rest[-1])) |
| 91 | self.link = link | 92 | try: |
| 93 | os.symlink(self.scratch, link) | ||
| 94 | except FileExistsError: | ||
| 95 | self.note = already_set | ||
| 96 | return self | ||
| 97 | self.link = link | ||
| 98 | finally: | ||
| 99 | # __exit__ only runs after a successful __enter__. | ||
| 100 | if self.link is None: | ||
| 101 | shutil.rmtree(self.scratch, ignore_errors=True) | ||
| 102 | self.scratch = None | ||
| 92 | self.note = f"drive {drive}: maps {self.windows_root} to {self.root} for this run" | 103 | self.note = f"drive {drive}: maps {self.windows_root} to {self.root} for this run" |
| 93 | return self | 104 | return self |
| 94 | 105 | ||