ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / po / portablemc / use-builtin-java.patch
bloba88d97bae9b5e8719be41f070e7c0bbe966e1250
1 diff --git a/portablemc/standard.py b/portablemc/standard.py
2 index f59c55d..0f017e1 100644
3 --- a/portablemc/standard.py
4 +++ b/portablemc/standard.py
5 @@ -843,6 +843,8 @@ class Version:
6 if jvm_major_version is not None and not isinstance(jvm_major_version, int):
7 raise ValueError("metadata: /javaVersion/majorVersion must be an integer")
9 + return self._resolve_builtin_jvm(watcher, JvmNotFoundError.UNSUPPORTED_ARCH, jvm_major_version)
11 if platform.system() == "Linux" and platform.libc_ver()[0] != "glibc":
12 return self._resolve_builtin_jvm(watcher, JvmNotFoundError.UNSUPPORTED_LIBC, jvm_major_version)
14 @@ -926,31 +928,10 @@ class Version:
15 builtin_path = shutil.which(jvm_bin_filename)
16 if builtin_path is None:
17 raise JvmNotFoundError(reason)
19 - try:
21 - # Get version of the JVM.
22 - process = Popen([builtin_path, "-version"], bufsize=1, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
23 - stdout, _stderr = process.communicate(timeout=1)
25 - version_start = stdout.index(f"1.{major_version}" if major_version <= 8 else str(major_version))
26 - version = None
28 - # Parse version by getting all character that are numeric or '.'.
29 - for i, ch in enumerate(stdout[version_start:]):
30 - if not ch.isnumeric() and ch not in (".", "_"):
31 - version = stdout[version_start:i]
32 - break
34 - if version is None:
35 - raise ValueError()
37 - except (TimeoutExpired, ValueError):
38 - raise JvmNotFoundError(JvmNotFoundError.BUILTIN_INVALID_VERSION)
40 self._jvm_path = Path(builtin_path)
41 - self._jvm_version = version
42 - watcher.handle(JvmLoadedEvent(version, JvmLoadedEvent.BUILTIN))
43 + self._jvm_version = "nixpkgs"
44 + watcher.handle(JvmLoadedEvent("nixpkgs", JvmLoadedEvent.BUILTIN))
46 def _download(self, watcher: Watcher) -> None: