Skip to content

Commit 2f77f97

Browse files
committed
Improve wheel build
Allow to launch builds and then fetch built wheels later Improve support for newer Pythons and OS versions. Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 6962f8b commit 2f77f97

5 files changed

+204
-43
lines changed

etc/scripts/build_wheels.py

+12
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@
6969
is_flag=True,
7070
help="Also include all dependent wheels.",
7171
)
72+
@click.option(
73+
"--remote-build-log-file",
74+
type=click.Path(writable=True),
75+
default=None,
76+
metavar="LOG-FILE",
77+
help="Path to an optional log file where to list remote builds download URLs. "
78+
"If provided, do not wait for remote builds to complete (and therefore, "
79+
"do not download them either). Instead create a JSON lines log file with "
80+
"one entry for each build suitable to fetch the artifacts at a later time.",
81+
)
7282
@click.option(
7383
"--verbose",
7484
is_flag=True,
@@ -83,6 +93,7 @@ def build_wheels(
8393
operating_system,
8494
with_deps,
8595
build_remotely,
96+
remote_build_log_file,
8697
verbose,
8798
):
8899
"""
@@ -102,6 +113,7 @@ def build_wheels(
102113
build_remotely=build_remotely,
103114
with_deps=with_deps,
104115
verbose=verbose,
116+
remote_build_log_file=remote_build_log_file,
105117
)
106118

107119

etc/scripts/fetch_built_wheels.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (c) nexB Inc. and others. All rights reserved.
5+
# ScanCode is a trademark of nexB Inc.
6+
# SPDX-License-Identifier: Apache-2.0
7+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
8+
# See https://github.com/nexB/skeleton for support or download.
9+
# See https://aboutcode.org for more information about nexB OSS projects.
10+
#
11+
import click
12+
13+
import utils_thirdparty
14+
15+
16+
@click.command()
17+
@click.option(
18+
"-d",
19+
"--thirdparty-dir",
20+
type=click.Path(exists=True, readable=True, path_type=str, file_okay=False),
21+
required=True,
22+
help="Path to the thirdparty directory to check.",
23+
)
24+
@click.help_option("-h", "--help")
25+
def check_thirdparty_dir(thirdparty_dir):
26+
"""
27+
Check a thirdparty directory for problems.
28+
"""
29+
utils_thirdparty.find_problems(dest_dir=thirdparty_dir)
30+
31+
32+
if __name__ == "__main__":
33+
check_thirdparty_dir()

etc/scripts/fix_thirdparty.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,22 @@
3131
is_flag=True,
3232
help="Build missing wheels remotely.",
3333
)
34+
@click.option(
35+
"--remote-build-log-file",
36+
type=click.Path(writable=True),
37+
default=None,
38+
metavar="LOG-FILE",
39+
help="Path to an optional log file where to list remote builds download URLs. "
40+
"If provided, do not wait for remote builds to complete (and therefore, "
41+
"do not download them either). Instead create a JSON lines log file with "
42+
"one entry for each build suitable to fetch the artifacts at a later time.",
43+
)
3444
@click.help_option("-h", "--help")
3545
def fix_thirdparty_dir(
3646
thirdparty_dir,
3747
build_wheels,
3848
build_remotely,
49+
remote_build_log_file,
3950
):
4051
"""
4152
Fix a thirdparty directory of dependent package wheels and sdist.
@@ -58,11 +69,13 @@ def fix_thirdparty_dir(
5869
package_envts_not_built = []
5970
if build_wheels:
6071
print("***BUILD*** MISSING WHEELS")
61-
package_envts_not_built, _wheel_filenames_built = utils_thirdparty.build_missing_wheels(
72+
results = utils_thirdparty.build_missing_wheels(
6273
packages_and_envts=package_envts_not_fetched,
6374
build_remotely=build_remotely,
75+
remote_build_log_file=remote_build_log_file,
6476
dest_dir=thirdparty_dir,
6577
)
78+
package_envts_not_built, _wheel_filenames_built = results
6679

6780
print("***ADD*** ABOUT AND LICENSES")
6881
utils_thirdparty.add_fetch_or_update_about_and_license_files(dest_dir=thirdparty_dir)

etc/scripts/test_utils_pip_compatibility_tags.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
],
4848
)
4949
def test_version_info_to_nodot(version_info, expected):
50-
actual = pip_compatibility_tags.version_info_to_nodot(version_info)
50+
actual = utils_pip_compatibility_tags.version_info_to_nodot(version_info)
5151
assert actual == expected
5252

5353

@@ -95,7 +95,7 @@ def test_manylinux2010_implies_manylinux1(self, manylinux2010, manylinux1):
9595
Specifying manylinux2010 implies manylinux1.
9696
"""
9797
groups = {}
98-
supported = pip_compatibility_tags.get_supported(platforms=[manylinux2010])
98+
supported = utils_pip_compatibility_tags.get_supported(platforms=[manylinux2010])
9999
for tag in supported:
100100
groups.setdefault((tag.interpreter, tag.abi), []).append(tag.platform)
101101

@@ -118,7 +118,7 @@ def test_manylinuxA_implies_manylinuxB(self, manylinuxA, manylinuxB):
118118
Specifying manylinux2014 implies manylinux2010/manylinux1.
119119
"""
120120
groups = {}
121-
supported = pip_compatibility_tags.get_supported(platforms=[manylinuxA])
121+
supported = utils_pip_compatibility_tags.get_supported(platforms=[manylinuxA])
122122
for tag in supported:
123123
groups.setdefault((tag.interpreter, tag.abi), []).append(tag.platform)
124124

0 commit comments

Comments
 (0)