Skip to content

Commit 2ee3fda

Browse files
chore: Only include the current platform in the deps bundle (#218)
Signed-off-by: Evan Spearman <[email protected]>
1 parent 8049d15 commit 2ee3fda

File tree

5 files changed

+31
-100
lines changed

5 files changed

+31
-100
lines changed

depsBundle.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
# https://docs.python.org/3/library/subprocess.html#security-considerations
88
set -xeuo pipefail
99

10-
python3 depsBundle.py
10+
python3 scripts/depsBundle.py

install_builder/deadline-cloud-for-blender.xml

+1-37
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,6 @@
5656
</if>
5757
<setInstallerVariable name="blender_addondir" value="${blender_installdir}/addons" />
5858
<setInstallerVariable name="blender_moduledir" value="${blender_installdir}/modules" />
59-
<if>
60-
<conditionRuleList>
61-
<platformTest type="windows" />
62-
</conditionRuleList>
63-
<actionList>
64-
<setInstallerVariable name="blender_deps_platform" value="windows" />
65-
</actionList>
66-
</if>
67-
<if>
68-
<conditionRuleList>
69-
<platformTest type="linux" />
70-
</conditionRuleList>
71-
<actionList>
72-
<setInstallerVariable name="blender_deps_platform" value="linux" />
73-
</actionList>
74-
</if>
75-
<if>
76-
<conditionRuleEvaluationLogic>and</conditionRuleEvaluationLogic>
77-
<conditionRuleList>
78-
<platformTest type="osx" />
79-
<platformTest type="osx-intel" />
80-
</conditionRuleList>
81-
<actionList>
82-
<setInstallerVariable name="blender_deps_platform" value="macos-intel" />
83-
</actionList>
84-
</if>
85-
<if>
86-
<conditionRuleEvaluationLogic>and</conditionRuleEvaluationLogic>
87-
<conditionRuleList>
88-
<platformTest type="osx" />
89-
<platformTest negate="1" type="osx-intel" />
90-
</conditionRuleList>
91-
<actionList>
92-
<setInstallerVariable name="blender_deps_platform" value="macos-arm64" />
93-
</actionList>
94-
</if>
9559
</readyToInstallActionList>
9660
<postInstallationActionList>
9761
<if>
@@ -104,7 +68,7 @@
10468
</if>
10569
<unzip>
10670
<destinationDirectory>${blender_moduledir}</destinationDirectory>
107-
<zipFile>${installdir}/tmp/blender_deps/dependency_bundle/deadline_cloud_for_blender_submitter-deps-${blender_deps_platform}.zip</zipFile>
71+
<zipFile>${installdir}/tmp/blender_deps/dependency_bundle/deadline_cloud_for_blender_submitter-deps.zip</zipFile>
10872
</unzip>
10973
<deleteFile>
11074
<path>${installdir}/tmp/blender_deps</path>

scripts/build_installer.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"""Script to create platform-specific Deadline Client installers using InstallBuilder."""
33

44
import os
5-
import platform
65
import sys
76
import shutil
87
import tempfile
@@ -11,12 +10,8 @@
1110
from pathlib import Path
1211

1312
from common import EvaluationBuildError, run
14-
from find_installbuilder import InstallBuilderSelection
13+
from find_installbuilder import InstallBuilderSelection, get_builder_exe_name
1514

16-
# Add the top level to the path for now. We can move depsBundle.py
17-
# to the scripts directory when we have more confidence that
18-
# it isnt' needed in the root directory anymore.
19-
sys.path.append(str(Path(__file__).resolve().parent.parent))
2015
from depsBundle import build_deps_bundle
2116

2217
# This is derived from <installerFilename> in installer/DeadlineCloudClient.xml
@@ -55,17 +50,12 @@ def setup_install_builder(
5550

5651
install_builder_path = selection.resolve_install_builder_installation(workdir)
5752

58-
if platform.system() == "Windows":
59-
binary_name = "builder.exe"
60-
else:
61-
binary_name = "builder"
62-
6353
if (
6454
not install_builder_path.is_dir()
65-
or not (install_builder_path / "bin" / binary_name).is_file()
55+
or not (install_builder_path / "bin" / get_builder_exe_name()).is_file()
6656
):
6757
raise FileNotFoundError(
68-
f"InstallBuilder path '{install_builder_path}' must be a directory containing 'bin/{binary_name}'."
58+
f"InstallBuilder path '{install_builder_path}' must be a directory containing 'bin/{get_builder_exe_name()}'."
6959
)
7060

7161
if license_file_path is not None:
@@ -184,7 +174,7 @@ def main(
184174
f"Found:\n\t{os.linesep.join([str(i) for i in installer_dir.iterdir()])}"
185175
)
186176

187-
output_path = installer_filename
177+
output_path = Path(installer_filename)
188178
if output_dir:
189179
output_dir.mkdir(exist_ok=True)
190180
output_path = output_dir / output_path

depsBundle.py renamed to scripts/depsBundle.py

+18-47
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,7 @@
1212
from typing import Any
1313

1414
SUPPORTED_PYTHON_VERSIONS = ["3.10", "3.11"]
15-
SUPPORTED_PLATFORMS = [
16-
"win_amd64",
17-
"manylinux2014_x86_64",
18-
"macosx_10_9_x86_64",
19-
"macosx_11_0_arm64",
20-
]
2115
NATIVE_DEPENDENCIES = ["xxhash"]
22-
FINAL_BUNDLE_NAMES = [
23-
"deadline_cloud_for_blender_submitter-deps-windows.zip",
24-
"deadline_cloud_for_blender_submitter-deps-linux.zip",
25-
"deadline_cloud_for_blender_submitter-deps-macos-intel.zip",
26-
"deadline_cloud_for_blender_submitter-deps-macos-arm64.zip",
27-
]
2816

2917

3018
def _get_project_dict() -> dict[str, Any]:
@@ -33,7 +21,7 @@ def _get_project_dict() -> dict[str, Any]:
3321
toml_install_pip_args = ["pip", "install", "--target", toml_env, "toml"]
3422
subprocess.run(toml_install_pip_args, check=True)
3523
sys.path.insert(0, toml_env)
36-
import toml
24+
import toml # type: ignore
3725
mode = "r"
3826
else:
3927
import tomllib as toml
@@ -92,25 +80,20 @@ def _download_native_dependencies(working_directory: Path, base_env: Path) -> li
9280
]
9381
native_dependency_paths = []
9482
for version in SUPPORTED_PYTHON_VERSIONS:
95-
for platform in SUPPORTED_PLATFORMS:
96-
native_dependency_path = (
97-
working_directory / "native" / f"{version.replace('.', '_')}_{platform}"
98-
)
99-
native_dependency_paths.append(native_dependency_path)
100-
native_dependency_path.mkdir(parents=True)
101-
native_dependency_pip_args = [
102-
"pip",
103-
"install",
104-
"--target",
105-
str(native_dependency_path),
106-
"--platform",
107-
platform,
108-
"--python-version",
109-
version,
110-
"--only-binary=:all:",
111-
*versioned_native_dependencies,
112-
]
113-
subprocess.run(native_dependency_pip_args, check=True)
83+
native_dependency_path = working_directory / "native" / f"{version.replace('.', '_')}"
84+
native_dependency_paths.append(native_dependency_path)
85+
native_dependency_path.mkdir(parents=True)
86+
native_dependency_pip_args = [
87+
"pip",
88+
"install",
89+
"--target",
90+
str(native_dependency_path),
91+
"--python-version",
92+
version,
93+
"--only-binary=:all:",
94+
*versioned_native_dependencies,
95+
]
96+
subprocess.run(native_dependency_pip_args, check=True)
11497
return native_dependency_paths
11598

11699

@@ -151,19 +134,9 @@ def _copy_zip_to_destination(zip_path: Path) -> Path:
151134
return zip_destination
152135

153136

154-
def _remove_old_bundles(zip_destination: Path):
155-
for file in FINAL_BUNDLE_NAMES:
156-
Path(zip_destination.parent / file).unlink(missing_ok=True)
157-
158-
159-
def _rename_bundles_to_final_names(zip_destination: Path):
160-
for file in FINAL_BUNDLE_NAMES:
161-
shutil.copy(zip_destination, zip_destination.parent / file)
162-
163-
164137
def build_deps_bundle() -> None:
165-
with TemporaryDirectory() as working_directory:
166-
working_directory = Path(working_directory)
138+
with TemporaryDirectory() as wd:
139+
working_directory = Path(wd)
167140
project_dict = _get_project_dict()
168141
dependencies = _get_dependencies(project_dict)
169142
base_env = _build_base_environment(working_directory, dependencies)
@@ -172,9 +145,7 @@ def build_deps_bundle() -> None:
172145
zip_path = _get_zip_path(working_directory, project_dict)
173146
_zip_bundle(base_env, zip_path)
174147
print(list(working_directory.glob("*")))
175-
zip_destination = _copy_zip_to_destination(zip_path)
176-
_remove_old_bundles(zip_destination)
177-
_rename_bundles_to_final_names(zip_destination)
148+
_copy_zip_to_destination(zip_path)
178149

179150

180151
if __name__ == "__main__":

scripts/find_installbuilder.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ def _sort_key(install: "_InstallBuilderInstallation") -> tuple[int, int, int, in
151151
)
152152

153153

154+
def get_builder_exe_name() -> str:
155+
if platform.system() == "Windows":
156+
return "builder.exe"
157+
return "builder"
158+
159+
154160
def _get_default_installbuilder_location() -> Path:
155161
"""
156162
Returns the default location where InstallBuilder Professional will be installed depending on the platform.
@@ -162,7 +168,7 @@ def _get_default_installbuilder_location() -> Path:
162168
for install_dir in config.parent_path.iterdir():
163169
if install_dir.is_dir():
164170
match = config.get_install_directory_regex().match(install_dir.name)
165-
if match and (install_dir / "bin" / "builder").is_file():
171+
if match and (install_dir / "bin" / get_builder_exe_name()).is_file():
166172
if platform.system() == "Linux":
167173
version_offset = 0
168174
else:

0 commit comments

Comments
 (0)