mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 20:49:44 +00:00
build-all: ensure all patches are present
Also changed type to just `list[str]` to keep it simple.
(cherry picked from commit 816eba5145)
This commit is contained in:
+4
-3
@@ -650,9 +650,10 @@ def build_dependency(
|
|||||||
build_tool_args: "list[str]",
|
build_tool_args: "list[str]",
|
||||||
download_url: str,
|
download_url: str,
|
||||||
download_name: str,
|
download_name: str,
|
||||||
|
*,
|
||||||
download_tool: Literal["py", "git"] = download_tool_default,
|
download_tool: Literal["py", "git"] = download_tool_default,
|
||||||
revision: "Union[str, None]" = None,
|
revision: "Union[str, None]" = None,
|
||||||
patch: "Union[str, list[str], None]" = None,
|
patch: list[str] | None = None,
|
||||||
shell=None,
|
shell=None,
|
||||||
pre_compile_subs: "Sequence[tuple[str, str, str]]" = (),
|
pre_compile_subs: "Sequence[tuple[str, str, str]]" = (),
|
||||||
additional_files: "Union[dict[str, str], None]" = None,
|
additional_files: "Union[dict[str, str], None]" = None,
|
||||||
@@ -737,8 +738,6 @@ def build_dependency(
|
|||||||
urlretrieve(url, os.path.join(extract_dir, path))
|
urlretrieve(url, os.path.join(extract_dir, path))
|
||||||
|
|
||||||
if patch is not None:
|
if patch is not None:
|
||||||
if isinstance(patch, str):
|
|
||||||
patch = [patch]
|
|
||||||
for p in patch:
|
for p in patch:
|
||||||
patch_abs = (SCRIPT_PATH / p).absolute().__str__()
|
patch_abs = (SCRIPT_PATH / p).absolute().__str__()
|
||||||
if os.path.exists(patch_abs):
|
if os.path.exists(patch_abs):
|
||||||
@@ -747,6 +746,8 @@ def build_dependency(
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Assert that the patch has already been applied
|
# Assert that the patch has already been applied
|
||||||
run(["patch", "-p1", "--batch", "--reverse", "--dry-run", "-i", patch_abs], cwd=extract_dir)
|
run(["patch", "-p1", "--batch", "--reverse", "--dry-run", "-i", patch_abs], cwd=extract_dir)
|
||||||
|
else:
|
||||||
|
raise FileNotFoundError(patch_abs)
|
||||||
|
|
||||||
if shell is not None:
|
if shell is not None:
|
||||||
sp.run(shell, shell=True, check=True, cwd=extract_dir)
|
sp.run(shell, shell=True, check=True, cwd=extract_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user