mirror of
https://github.com/dockur/windows.git
synced 2026-07-28 21:53:34 +07:00
Update Dockerfile
This commit is contained in:
+17
-9
@@ -54,20 +54,26 @@ RUN python3 -m pip install --break-system-packages --no-cache-dir "pycdlib==${VE
|
||||
|
||||
RUN python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import pycdlib
|
||||
|
||||
path = Path(pycdlib.__file__).with_name("pycdlib.py")
|
||||
import pycdlib.pycdlib
|
||||
|
||||
path = Path(pycdlib.pycdlib.__file__)
|
||||
text = path.read_text()
|
||||
|
||||
old = """\
|
||||
# The remove_child() method returns True if the parent no longer needs
|
||||
# the extent that the directory record for this child was on.
|
||||
if child.parent.remove_child(child, index, self.logical_block_size):
|
||||
return self.logical_block_size
|
||||
"""
|
||||
|
||||
new = """\
|
||||
# The remove_child() method returns True if the parent no longer needs
|
||||
# the extent that the directory record for this child was on.
|
||||
if (
|
||||
index < 0
|
||||
or index >= len(child.parent.children)
|
||||
or child.parent.children[index] is not child
|
||||
index < 0
|
||||
or index >= len(child.parent.children)
|
||||
or child.parent.children[index] is not child
|
||||
):
|
||||
for actual_index, candidate in enumerate(child.parent.children):
|
||||
if candidate is child:
|
||||
@@ -79,18 +85,20 @@ new = """\
|
||||
)
|
||||
|
||||
if child.parent.remove_child(child, index, self.logical_block_size):
|
||||
return self.logical_block_size
|
||||
"""
|
||||
|
||||
matches = text.count(old)
|
||||
count = text.count(old)
|
||||
|
||||
if matches != 1:
|
||||
if count != 1:
|
||||
raise SystemExit(
|
||||
f"Expected exactly one PyCdlib source block, found {matches} in {path}"
|
||||
f"Expected exactly one PyCdlib source block, found {count} in {path}"
|
||||
)
|
||||
|
||||
path.write_text(text.replace(old, new, 1))
|
||||
|
||||
print(f"Patched {path}")
|
||||
compile(path.read_text(), str(path), "exec")
|
||||
print(f"Patched PyCdlib: {path}")
|
||||
PY
|
||||
|
||||
ARG VERSION_ARG="0.00"
|
||||
|
||||
Reference in New Issue
Block a user