MCPcopy Create free account
hub / github.com/archlinux/archinstall / configure

Method configure

archinstall/lib/pacman/config.py:57–73  ·  view source on GitHub ↗

Apply PacmanConfiguration (Color, ParallelDownloads) to the target system's pacman.conf.

(self, pacman_config: PacmanConfiguration)

Source from the content-addressed store, hash-verified

55 PACMAN_CONF.copy(self._config_remote_path, preserve_metadata=True)
56
57 def configure(self, pacman_config: PacmanConfiguration) -> None:
58 """Apply PacmanConfiguration (Color, ParallelDownloads) to the target system's pacman.conf."""
59 if not self._config_remote_path or not self._config_remote_path.exists():
60 return
61
62 content = self._config_remote_path.read_text().splitlines()
63 result = []
64
65 for line in content:
66 if re.match(r'^#?\s*ParallelDownloads', line):
67 result.append(f'ParallelDownloads = {pacman_config.parallel_downloads}')
68 elif re.match(r'^#?\s*Color\s*$', line):
69 result.append('Color' if pacman_config.color else '#Color')
70 else:
71 result.append(line)
72
73 self._config_remote_path.write_text('\n'.join(result) + '\n')

Callers 1

minimal_installationMethod · 0.95

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected