Skip to content

Commit b0a20a0

Browse files
authored
#83 - Allow building only for extra platforms (#84)
Introduces the `--only-extra-platforms` or `-o` option for build and wheel
1 parent 9ed55a3 commit b0a20a0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

dynatrace_extension/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#
33
# SPDX-License-Identifier: MIT
44

5-
__version__ = "1.2.10"
5+
__version__ = "1.2.11"

dynatrace_extension/cli/main.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ def build(
9191
find_links: Optional[str] = typer.Option(
9292
None, "--find-links", "-f", help="Extra index url to use when downloading dependencies"
9393
),
94+
only_extra_platforms: Optional[bool] = typer.Option(
95+
False,
96+
"--only-extra-platforms",
97+
"-o",
98+
help="Only build for the extra platforms, useful when building from arm64 (mac)",
99+
),
94100
):
95101
"""
96102
Builds and signs an extension using the developer fused key-certificate
@@ -103,6 +109,7 @@ def build(
103109
:param extra_platforms: Attempt to also download wheels for an extra platform (e.g. manylinux1_x86_64 or win_amd64)
104110
:param extra_index_url: Extra index url to use when downloading dependencies
105111
:param find_links: Extra index url to use when downloading dependencies
112+
:param only_extra_platforms: If true, only build for the extra platforms, useful when building from arm64
106113
"""
107114
console.print(f"Building and signing extension from {extension_dir} to {target_directory}", style="cyan")
108115
if target_directory is None:
@@ -111,7 +118,7 @@ def build(
111118
target_directory.mkdir()
112119

113120
console.print("Stage 1 - Download and build dependencies", style="bold blue")
114-
wheel(extension_dir, extra_platforms, extra_index_url, find_links)
121+
wheel(extension_dir, extra_platforms, extra_index_url, find_links, only_extra_platforms)
115122

116123
console.print("Stage 2 - Create the extension zip file", style="bold blue")
117124
built_zip = assemble(extension_dir, target_directory)
@@ -179,6 +186,12 @@ def wheel(
179186
find_links: Optional[str] = typer.Option(
180187
None, "--find-links", "-f", help="Extra index url to use when downloading dependencies"
181188
),
189+
only_extra_platforms: Optional[bool] = typer.Option(
190+
False,
191+
"--only-extra-platforms",
192+
"-o",
193+
help="Only build for the extra platforms, useful when building from arm64 (mac)",
194+
),
182195
):
183196
"""
184197
Builds the extension and it's dependencies into wheel files
@@ -188,6 +201,7 @@ def wheel(
188201
:param extra_platforms: Attempt to also download wheels for an extra platform (e.g. manylinux1_x86_64 or win_amd64)
189202
:param extra_index_url: Extra index url to use when downloading dependencies
190203
:param find_links: Extra index url to use when downloading dependencies
204+
:param only_extra_platforms: If true, only build for the extra platforms, useful when building from arm64
191205
"""
192206
relative_lib_folder_dir = "extension/lib"
193207
lib_folder: Path = extension_dir / relative_lib_folder_dir
@@ -201,6 +215,8 @@ def wheel(
201215
command.extend(["--extra-index-url", extra_index_url])
202216
if find_links is not None:
203217
command.extend(["--find-links", find_links])
218+
if only_extra_platforms:
219+
command.append("--no-deps")
204220
command.append(".")
205221
run_process(command, cwd=extension_dir)
206222

0 commit comments

Comments
 (0)