|
2 | 2 | # CI commands |
3 | 3 | # |
4 | 4 |
|
| 5 | +import pathlib |
5 | 6 | import sys |
| 7 | +import typing as T |
6 | 8 |
|
7 | 9 | import click |
8 | 10 | from packaging.requirements import Requirement |
9 | | -import setuptools_scm |
10 | 11 |
|
11 | 12 | from .ctx import Context |
12 | 13 | from .update_pyproject import ProjectUpdater |
@@ -39,24 +40,68 @@ def check_pyproject(ctx: Context): |
39 | 40 | @ci.command() |
40 | 41 | @click.option("--no-test", default=False, is_flag=True) |
41 | 42 | @click.pass_obj |
42 | | -def run(ctx: Context, no_test: bool): |
| 43 | +def build_other_wheels(ctx: Context, no_test: bool): |
43 | 44 | """ |
44 | | - Builds wheels, runs tests |
| 45 | + Builds wheels that don't use meson, runs tests |
45 | 46 | """ |
46 | 47 |
|
47 | | - # Get the current build version |
48 | | - version = setuptools_scm.get_version() |
| 48 | + for project in ctx.subprojects.values(): |
| 49 | + if project.is_meson_project(): |
| 50 | + continue |
| 51 | + |
| 52 | + with ctx.handle_exception(project.name): |
| 53 | + ctx.install_build_deps(subproject=project) |
| 54 | + |
| 55 | + project.build_wheel( |
| 56 | + wheel_path=ctx.wheel_path, |
| 57 | + other_wheel_path=ctx.other_wheel_path, |
| 58 | + install=True, |
| 59 | + config_settings=[], |
| 60 | + ) |
| 61 | + if not no_test: |
| 62 | + project.test(install_requirements=True) |
| 63 | + |
| 64 | + |
| 65 | +@ci.command() |
| 66 | +@click.option("--no-test", default=False, is_flag=True) |
| 67 | +@click.option( |
| 68 | + "--cross", |
| 69 | + help="meson cross.txt file (installed at ~/.local/share/meson/cross/FILENAME)", |
| 70 | +) |
| 71 | +@click.pass_obj |
| 72 | +def build_meson_wheels(ctx: Context, no_test: bool, cross: T.Optional[str]): |
| 73 | + """ |
| 74 | + Builds wheels that use meson, runs tests. |
| 75 | +
|
| 76 | + Needs wheels that are in the non-meson builds |
| 77 | + """ |
49 | 78 |
|
50 | 79 | # Fix build dependencies to be == what we are building |
51 | 80 | # - install_requires already has this via ==THIS_VERSION in robotpy-build |
52 | | - for project in ctx.subprojects.values(): |
53 | | - for i in range(len(project.requires)): |
54 | | - req = project.requires[i] |
55 | | - if req.name in ctx.subprojects: |
56 | | - project.requires[i] = Requirement(f"{req.name}=={version}") |
| 81 | + # for project in ctx.subprojects.values(): |
| 82 | + # for i in range(len(project.build_requires)): |
| 83 | + # req = project.build_requires[i] |
| 84 | + # if req.name in ctx.subprojects: |
| 85 | + # project.build_requires[i] = Requirement(f"{req.name}=={version}") |
| 86 | + |
| 87 | + # Check that the build dependencies match the versions of the projects |
| 88 | + # that we're building |
| 89 | + |
| 90 | + config_settings = [] |
| 91 | + if cross: |
| 92 | + config_settings.append(f"setup-args=--cross-file={cross}") |
57 | 93 |
|
58 | 94 | for project in ctx.subprojects.values(): |
59 | | - project.install_build_deps(wheel_path=ctx.wheel_path) |
60 | | - project.bdist_wheel(wheel_path=ctx.wheel_path, install=True) |
61 | | - if not no_test: |
62 | | - project.test(install_requirements=True) |
| 95 | + if not project.is_meson_project(): |
| 96 | + continue |
| 97 | + |
| 98 | + with ctx.handle_exception(project.name): |
| 99 | + ctx.install_build_deps(subproject=project) |
| 100 | + project.build_wheel( |
| 101 | + wheel_path=ctx.wheel_path, |
| 102 | + other_wheel_path=ctx.other_wheel_path, |
| 103 | + install=True, |
| 104 | + config_settings=config_settings, |
| 105 | + ) |
| 106 | + if not no_test: |
| 107 | + project.test(install_requirements=True) |
0 commit comments