MCPcopy Index your code
hub / github.com/archlinux/archinstall / parse_arg

Method parse_arg

archinstall/lib/models/device.py:115–236  ·  view source on GitHub ↗
(
		cls,
		disk_config: _DiskLayoutConfigurationSerialization,
		enc_password: Password | None = None,
	)

Source from the content-addressed store, hash-verified

113
114 @classmethod
115 def parse_arg(
116 cls,
117 disk_config: _DiskLayoutConfigurationSerialization,
118 enc_password: Password | None = None,
119 ) -> Self | None:
120 from archinstall.lib.disk.device_handler import device_handler
121
122 device_modifications: list[DeviceModification] = []
123 config_type = disk_config.get('config_type', None)
124
125 if not config_type:
126 raise ValueError('Missing disk layout configuration: config_type')
127
128 config = cls(
129 config_type=DiskLayoutType(config_type),
130 device_modifications=device_modifications,
131 )
132
133 if config_type == DiskLayoutType.Pre_mount.value:
134 if not (mountpoint := disk_config.get('mountpoint')):
135 raise ValueError('Must set a mountpoint when layout type is pre-mount')
136
137 path = Path(str(mountpoint))
138
139 mods = device_handler.detect_pre_mounted_mods(path)
140 device_modifications.extend(mods)
141
142 config.mountpoint = path
143
144 return config
145
146 for entry in disk_config.get('device_modifications', []):
147 device_path = Path(entry['device']) if entry.get('device', None) else None
148
149 if not device_path:
150 continue
151
152 device = device_handler.get_device(device_path)
153
154 if not device:
155 continue
156
157 device_modification = DeviceModification(
158 wipe=entry.get('wipe', False),
159 device=device,
160 )
161
162 device_partitions: list[PartitionModification] = []
163
164 for partition in entry.get('partitions', []):
165 flags = [flag for f in partition.get('flags', []) if (flag := PartitionFlag.from_string(f))]
166
167 if fs_type := partition.get('fs_type'):
168 fs_type = FilesystemType(fs_type)
169 else:
170 fs_type = None
171
172 device_partition = PartitionModification(

Callers

nothing calls this directly

Calls 15

DiskLayoutTypeClass · 0.85
DeviceModificationClass · 0.85
FilesystemTypeClass · 0.85
ModificationStatusClass · 0.85
PartitionTypeClass · 0.85
get_deviceMethod · 0.80
from_stringMethod · 0.80
is_deleteMethod · 0.80
is_valid_startMethod · 0.80
alignMethod · 0.80

Tested by

no test coverage detected