xbuild 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xbuild-0.0.1/.github/dependabot.yml +18 -0
- xbuild-0.0.1/.github/workflows/ci.yml +82 -0
- xbuild-0.0.1/.github/workflows/pre-commit-update.yml +15 -0
- xbuild-0.0.1/.github/workflows/publish.yml +22 -0
- xbuild-0.0.1/.github/workflows/release.yml +48 -0
- xbuild-0.0.1/.gitignore +26 -0
- xbuild-0.0.1/.pre-commit-config.yaml +27 -0
- xbuild-0.0.1/CHANGELOG.md +7 -0
- xbuild-0.0.1/CONTRIBUTING.md +7 -0
- xbuild-0.0.1/LICENSE +27 -0
- xbuild-0.0.1/PKG-INFO +99 -0
- xbuild-0.0.1/README.md +71 -0
- xbuild-0.0.1/pyproject.toml +108 -0
- xbuild-0.0.1/setup.cfg +4 -0
- xbuild-0.0.1/src/xbuild/__init__.py +20 -0
- xbuild-0.0.1/src/xbuild/__main__.py +224 -0
- xbuild-0.0.1/src/xbuild.egg-info/PKG-INFO +99 -0
- xbuild-0.0.1/src/xbuild.egg-info/SOURCES.txt +30 -0
- xbuild-0.0.1/src/xbuild.egg-info/dependency_links.txt +1 -0
- xbuild-0.0.1/src/xbuild.egg-info/entry_points.txt +3 -0
- xbuild-0.0.1/src/xbuild.egg-info/requires.txt +1 -0
- xbuild-0.0.1/src/xbuild.egg-info/top_level.txt +2 -0
- xbuild-0.0.1/src/xvenv/__init__.py +6 -0
- xbuild-0.0.1/src/xvenv/__main__.py +90 -0
- xbuild-0.0.1/src/xvenv/_cross_target.py.tmpl +95 -0
- xbuild-0.0.1/src/xvenv/convert.py +174 -0
- xbuild-0.0.1/src/xvenv/platforms/__init__.py +0 -0
- xbuild-0.0.1/src/xvenv/platforms/android.py +79 -0
- xbuild-0.0.1/src/xvenv/platforms/emscripten.py +16 -0
- xbuild-0.0.1/src/xvenv/platforms/ios.py +33 -0
- xbuild-0.0.1/tests/test_xvenv.py +3 -0
- xbuild-0.0.1/tox.ini +15 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
version: 2
|
|
3
|
+
updates:
|
|
4
|
+
- package-ecosystem: "github-actions"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
# Check for updates on Sunday, 8PM UTC
|
|
8
|
+
interval: "weekly"
|
|
9
|
+
day: "sunday"
|
|
10
|
+
time: "20:00"
|
|
11
|
+
|
|
12
|
+
- package-ecosystem: "pip"
|
|
13
|
+
directory: "/"
|
|
14
|
+
schedule:
|
|
15
|
+
# Check for updates on Sunday, 8PM UTC
|
|
16
|
+
interval: "weekly"
|
|
17
|
+
day: "sunday"
|
|
18
|
+
time: "20:00"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_call:
|
|
8
|
+
|
|
9
|
+
# Cancel active CI runs for a PR before starting another run
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
defaults:
|
|
15
|
+
run:
|
|
16
|
+
shell: bash # https://github.com/beeware/briefcase/pull/912
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
FORCE_COLOR: "1"
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
pre-commit:
|
|
23
|
+
name: Pre-commit checks
|
|
24
|
+
uses: beeware/.github/.github/workflows/pre-commit-run.yml@main
|
|
25
|
+
with:
|
|
26
|
+
pre-commit-source: "--group pre-commit"
|
|
27
|
+
|
|
28
|
+
package:
|
|
29
|
+
name: Build Package
|
|
30
|
+
needs: [ pre-commit ]
|
|
31
|
+
runs-on: "ubuntu-24.04"
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write
|
|
34
|
+
attestations: write
|
|
35
|
+
steps:
|
|
36
|
+
- name: Checkout
|
|
37
|
+
uses: actions/checkout@v5.0.0
|
|
38
|
+
with:
|
|
39
|
+
fetch-depth: 0
|
|
40
|
+
|
|
41
|
+
- name: Build and inspect package
|
|
42
|
+
uses: hynek/build-and-inspect-python-package@v2.13.0
|
|
43
|
+
with:
|
|
44
|
+
attest-build-provenance-github: 'true'
|
|
45
|
+
|
|
46
|
+
unit-tests:
|
|
47
|
+
name: Unit tests
|
|
48
|
+
needs: [ package ]
|
|
49
|
+
runs-on: "ubuntu-24.04"
|
|
50
|
+
strategy:
|
|
51
|
+
fail-fast: false
|
|
52
|
+
matrix:
|
|
53
|
+
python-version: [ "3.13", "3.14" ]
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- name: Checkout
|
|
57
|
+
uses: actions/checkout@v5.0.0
|
|
58
|
+
with:
|
|
59
|
+
fetch-depth: 0
|
|
60
|
+
|
|
61
|
+
- name: Set up Python
|
|
62
|
+
uses: actions/setup-python@v5.6.0
|
|
63
|
+
with:
|
|
64
|
+
python-version: "${{ matrix.python-version }}"
|
|
65
|
+
allow-prereleases: true
|
|
66
|
+
|
|
67
|
+
- name: Install test requirements
|
|
68
|
+
run: |
|
|
69
|
+
python -m pip install -U pip
|
|
70
|
+
python -m pip install --group ci
|
|
71
|
+
|
|
72
|
+
- name: Test
|
|
73
|
+
run: |
|
|
74
|
+
python -m tox -e py
|
|
75
|
+
|
|
76
|
+
# # This step is only needed if you're trying to diagnose test failures that
|
|
77
|
+
# # only occur in CI, and can't be reproduced locally. When it runs, it will
|
|
78
|
+
# # open an SSH server (URL reported in the logs) so you can ssh into the CI
|
|
79
|
+
# # machine.
|
|
80
|
+
# - name: Setup tmate session
|
|
81
|
+
# uses: mxschmitt/action-tmate@v3
|
|
82
|
+
# if: failure()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Update pre-commit
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 20 * * SUN" # Sunday @ 2000 UTC
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pre-commit-update:
|
|
10
|
+
name: Update pre-commit
|
|
11
|
+
uses: beeware/.github/.github/workflows/pre-commit-update.yml@main
|
|
12
|
+
secrets: inherit
|
|
13
|
+
with:
|
|
14
|
+
pre-commit-source: --group pre-commit
|
|
15
|
+
create-changenote: false
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Upload Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: published
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
# This permission is required for trusted publishing.
|
|
12
|
+
id-token: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: dsaltares/fetch-gh-release-asset@1.1.2
|
|
15
|
+
with:
|
|
16
|
+
version: tags/${{ github.event.release.tag_name }}
|
|
17
|
+
file: ${{ github.event.repository.name }}.*
|
|
18
|
+
regex: true
|
|
19
|
+
target: dist/
|
|
20
|
+
|
|
21
|
+
- name: Publish release to production PyPI
|
|
22
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Create Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
ci:
|
|
10
|
+
name: CI
|
|
11
|
+
uses: ./.github/workflows/ci.yml
|
|
12
|
+
|
|
13
|
+
release:
|
|
14
|
+
name: Create Release
|
|
15
|
+
needs: ci
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
# This permission is required for trusted publishing.
|
|
20
|
+
id-token: write
|
|
21
|
+
steps:
|
|
22
|
+
- name: Set build variables
|
|
23
|
+
run: |
|
|
24
|
+
echo "VERSION=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_ENV
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@v5.6.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.x"
|
|
30
|
+
|
|
31
|
+
- name: Get packages
|
|
32
|
+
uses: actions/download-artifact@v5.0.0
|
|
33
|
+
with:
|
|
34
|
+
pattern: Packages
|
|
35
|
+
path: dist
|
|
36
|
+
|
|
37
|
+
- name: Create release
|
|
38
|
+
uses: ncipollo/release-action@v1.18.0
|
|
39
|
+
with:
|
|
40
|
+
name: ${{ env.VERSION }}
|
|
41
|
+
draft: true
|
|
42
|
+
artifacts: dist/*
|
|
43
|
+
artifactErrorsFailBuild: true
|
|
44
|
+
|
|
45
|
+
- name: Publish release to Test PyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
47
|
+
with:
|
|
48
|
+
repository-url: https://test.pypi.org/legacy/
|
xbuild-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
|
|
5
|
+
# Distribution / packaging
|
|
6
|
+
build/lib/
|
|
7
|
+
dist/
|
|
8
|
+
*.egg-info/
|
|
9
|
+
.eggs
|
|
10
|
+
|
|
11
|
+
# Testing and coverage
|
|
12
|
+
.cache
|
|
13
|
+
.tox/
|
|
14
|
+
.mypy_cache/
|
|
15
|
+
.pytest_cache
|
|
16
|
+
htmlcov/
|
|
17
|
+
.coverage
|
|
18
|
+
coverage.xml
|
|
19
|
+
tests/integration/
|
|
20
|
+
.integration-sources
|
|
21
|
+
.tox
|
|
22
|
+
Dockerfile
|
|
23
|
+
|
|
24
|
+
# In-repo spaces for local testing
|
|
25
|
+
local/
|
|
26
|
+
temp/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v6.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-toml
|
|
6
|
+
- id: check-yaml
|
|
7
|
+
- id: check-case-conflict
|
|
8
|
+
- id: check-docstring-first
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
- id: trailing-whitespace
|
|
11
|
+
- repo: https://github.com/PyCQA/docformatter
|
|
12
|
+
rev: v1.7.7
|
|
13
|
+
hooks:
|
|
14
|
+
- id: docformatter
|
|
15
|
+
args: [--in-place, --black]
|
|
16
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
17
|
+
rev: v0.12.11
|
|
18
|
+
hooks:
|
|
19
|
+
- id: ruff-format
|
|
20
|
+
- id: ruff-check
|
|
21
|
+
args: [ --fix ]
|
|
22
|
+
- repo: https://github.com/codespell-project/codespell
|
|
23
|
+
rev: v2.4.1
|
|
24
|
+
hooks:
|
|
25
|
+
- id: codespell
|
|
26
|
+
# remove toml extra once Python 3.10 is no longer supported
|
|
27
|
+
additional_dependencies: ['.[toml]']
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.0.1 (5 Sep 2025)
|
|
4
|
+
|
|
5
|
+
Initial release.
|
|
6
|
+
|
|
7
|
+
Includes `xvenv`, a tool for creating cross platform environments. This has undergone initial testing to verify it works for iOS, Android and Emscripten environments. The created environment is sufficient to trick `pip` into installing binaries for the target platform into the environment; and for tools like `wheel` to trigger builds with compiler invocations derived from `sysconfgdata`. This won't generally result in a *successful* build, as there will usually be other environmental requirements; but the a cross-platform build will be attempted.
|
xbuild-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2025 Russell Keith-Magee.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of xbuild nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from this
|
|
16
|
+
software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
xbuild-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xbuild
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A PEP517 build frontend for cross-compiling wheels.
|
|
5
|
+
Author-email: Russell Keith-Magee <russell@keith-magee.com>
|
|
6
|
+
Maintainer-email: Russell Keith-Magee <russell@keith-magee.com>
|
|
7
|
+
License-Expression: BSD-3-Clause
|
|
8
|
+
Project-URL: Project, https://github.com/beeware/xbuild
|
|
9
|
+
Project-URL: Funding, https://beeware.org/contributing/membership/
|
|
10
|
+
Project-URL: Tracker, https://github.com/beeware/xbuild/issues
|
|
11
|
+
Project-URL: Source, https://github.com/beeware/xbuild
|
|
12
|
+
Keywords: pep517,build
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Classifier: Topic :: System :: Software Distribution
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.13
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: build==1.3.0
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# xbuild
|
|
30
|
+
|
|
31
|
+
[](https://pypi.python.org/pypi/xbuild)
|
|
32
|
+
[](https://pypi.python.org/pypi/xbuild)
|
|
33
|
+
[](https://pypi.python.org/pypi/xbuild)
|
|
34
|
+
[](https://github.com/beeware/xbuild/blob/master/LICENSE)
|
|
35
|
+
[](https://beeware.org/bee/chat/)
|
|
36
|
+
|
|
37
|
+
`xbuild` is PEP517 build frontend that has additions and extensions to support cross-compiling wheels for platforms where compilation cannot be performed natively - most notably:
|
|
38
|
+
|
|
39
|
+
* Android
|
|
40
|
+
* Emscripten (WASM)
|
|
41
|
+
* iOS
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Creating a cross virtual environment
|
|
46
|
+
|
|
47
|
+
To create a cross virtual environment, you will need a distribution of Python that has been compiled for Android, Emscripten or iOS. Create a virtual environment for your build platform (i.e., the platform where you will be compiling), then use the `xvenv` script to convert that virtual environment in to a cross environment.
|
|
48
|
+
|
|
49
|
+
$ python3 -m venv venv
|
|
50
|
+
$ source venv/bin/activate
|
|
51
|
+
(venv) $ pip install xbuild
|
|
52
|
+
(venv) $ python -m venv x-venv
|
|
53
|
+
(venv) $ xvenv --sysconfig path/to/_sysconfig_vars__...json x-venv
|
|
54
|
+
|
|
55
|
+
You can then activate the cross virtual environment. For example, if `x-venv` was constructed using an iOS simulator sysconfig vars file (`_sysconfig_vars__ios_arm64-iphonesimulator.json`), you would see output like:
|
|
56
|
+
|
|
57
|
+
$ source x-venv/bin/activate
|
|
58
|
+
(x-venv) $ python -c "import sys; print(sys.platform)"
|
|
59
|
+
ios
|
|
60
|
+
(x-venv) $ python -c "import sys; print(sys.implementation._multiarch)"
|
|
61
|
+
arm64-iphonesimulator
|
|
62
|
+
|
|
63
|
+
This should now print the platform identifier for the target platform, not your build platform.
|
|
64
|
+
|
|
65
|
+
You can also configure xvenv with a `_sysconfigdata` Python file (e.g., `_sysconfigdata__ios_arm64-iphonesimulator.py`), instead of the `_sysconfig_var` JSON file. You'll have to use `_sysconfigdata` if you're on Python 3.13 (as the JSON format was only introduced in Python 3.14)
|
|
66
|
+
|
|
67
|
+
If you are in the cross environment, and you need to temporarily convert it back to the build platform, you can do so with the `XBUILD_ENV` environment variable. For example, if `x-venv` is an iOS cross environment:
|
|
68
|
+
|
|
69
|
+
$ source x-venv/bin/activate
|
|
70
|
+
(x-venv) $ python -c "import sys; print(sys.platform)"
|
|
71
|
+
ios
|
|
72
|
+
(x-venv) $ XBUILD_ENV=off python -c "import sys; print(sys.platform)"
|
|
73
|
+
darwin
|
|
74
|
+
|
|
75
|
+
## How this works
|
|
76
|
+
|
|
77
|
+
The cross build environment does not run the target platform binaries on the build platform - it uses binaries for the build platform, but monkey-patches the Python interpreter at startup so that any question asking details about the platform returns details about the target platform. For example, if you create an iOS cross-platform environment on a macOS machine, you'll be using the macOS `python.exe`; but if you ask for `sys.platform`, the answer will be `ios`, not `darwin`.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
To set up a development environment:
|
|
82
|
+
|
|
83
|
+
$ python3 -m venv venv
|
|
84
|
+
$ source venv/bin/activate
|
|
85
|
+
(venv) $ python -m pip install -U pip
|
|
86
|
+
(venv) $ python -m pip install -e . --group dev
|
|
87
|
+
|
|
88
|
+
## Community
|
|
89
|
+
|
|
90
|
+
`xbuild` is part of the [BeeWare suite](http://beeware.org). You can talk to the community through:
|
|
91
|
+
|
|
92
|
+
- [@pybeeware on Twitter](https://twitter.com/pybeeware)
|
|
93
|
+
- [Discord](https://beeware.org/bee/chat/)
|
|
94
|
+
|
|
95
|
+
We foster a welcoming and respectful community as described in our [BeeWare Community Code of Conduct](http://beeware.org/community/behavior/).
|
|
96
|
+
|
|
97
|
+
## Contributing
|
|
98
|
+
|
|
99
|
+
If you experience problems with `xbuild`, [log them on GitHub](https://github.com/beeware/xbuild/issues). If you want to contribute code, please [fork the code](https://github.com/beeware/xbuild) and [submit a pull request](https://github.com/beeware/xbuild/pulls).
|
xbuild-0.0.1/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# xbuild
|
|
2
|
+
|
|
3
|
+
[](https://pypi.python.org/pypi/xbuild)
|
|
4
|
+
[](https://pypi.python.org/pypi/xbuild)
|
|
5
|
+
[](https://pypi.python.org/pypi/xbuild)
|
|
6
|
+
[](https://github.com/beeware/xbuild/blob/master/LICENSE)
|
|
7
|
+
[](https://beeware.org/bee/chat/)
|
|
8
|
+
|
|
9
|
+
`xbuild` is PEP517 build frontend that has additions and extensions to support cross-compiling wheels for platforms where compilation cannot be performed natively - most notably:
|
|
10
|
+
|
|
11
|
+
* Android
|
|
12
|
+
* Emscripten (WASM)
|
|
13
|
+
* iOS
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Creating a cross virtual environment
|
|
18
|
+
|
|
19
|
+
To create a cross virtual environment, you will need a distribution of Python that has been compiled for Android, Emscripten or iOS. Create a virtual environment for your build platform (i.e., the platform where you will be compiling), then use the `xvenv` script to convert that virtual environment in to a cross environment.
|
|
20
|
+
|
|
21
|
+
$ python3 -m venv venv
|
|
22
|
+
$ source venv/bin/activate
|
|
23
|
+
(venv) $ pip install xbuild
|
|
24
|
+
(venv) $ python -m venv x-venv
|
|
25
|
+
(venv) $ xvenv --sysconfig path/to/_sysconfig_vars__...json x-venv
|
|
26
|
+
|
|
27
|
+
You can then activate the cross virtual environment. For example, if `x-venv` was constructed using an iOS simulator sysconfig vars file (`_sysconfig_vars__ios_arm64-iphonesimulator.json`), you would see output like:
|
|
28
|
+
|
|
29
|
+
$ source x-venv/bin/activate
|
|
30
|
+
(x-venv) $ python -c "import sys; print(sys.platform)"
|
|
31
|
+
ios
|
|
32
|
+
(x-venv) $ python -c "import sys; print(sys.implementation._multiarch)"
|
|
33
|
+
arm64-iphonesimulator
|
|
34
|
+
|
|
35
|
+
This should now print the platform identifier for the target platform, not your build platform.
|
|
36
|
+
|
|
37
|
+
You can also configure xvenv with a `_sysconfigdata` Python file (e.g., `_sysconfigdata__ios_arm64-iphonesimulator.py`), instead of the `_sysconfig_var` JSON file. You'll have to use `_sysconfigdata` if you're on Python 3.13 (as the JSON format was only introduced in Python 3.14)
|
|
38
|
+
|
|
39
|
+
If you are in the cross environment, and you need to temporarily convert it back to the build platform, you can do so with the `XBUILD_ENV` environment variable. For example, if `x-venv` is an iOS cross environment:
|
|
40
|
+
|
|
41
|
+
$ source x-venv/bin/activate
|
|
42
|
+
(x-venv) $ python -c "import sys; print(sys.platform)"
|
|
43
|
+
ios
|
|
44
|
+
(x-venv) $ XBUILD_ENV=off python -c "import sys; print(sys.platform)"
|
|
45
|
+
darwin
|
|
46
|
+
|
|
47
|
+
## How this works
|
|
48
|
+
|
|
49
|
+
The cross build environment does not run the target platform binaries on the build platform - it uses binaries for the build platform, but monkey-patches the Python interpreter at startup so that any question asking details about the platform returns details about the target platform. For example, if you create an iOS cross-platform environment on a macOS machine, you'll be using the macOS `python.exe`; but if you ask for `sys.platform`, the answer will be `ios`, not `darwin`.
|
|
50
|
+
|
|
51
|
+
## Contributing
|
|
52
|
+
|
|
53
|
+
To set up a development environment:
|
|
54
|
+
|
|
55
|
+
$ python3 -m venv venv
|
|
56
|
+
$ source venv/bin/activate
|
|
57
|
+
(venv) $ python -m pip install -U pip
|
|
58
|
+
(venv) $ python -m pip install -e . --group dev
|
|
59
|
+
|
|
60
|
+
## Community
|
|
61
|
+
|
|
62
|
+
`xbuild` is part of the [BeeWare suite](http://beeware.org). You can talk to the community through:
|
|
63
|
+
|
|
64
|
+
- [@pybeeware on Twitter](https://twitter.com/pybeeware)
|
|
65
|
+
- [Discord](https://beeware.org/bee/chat/)
|
|
66
|
+
|
|
67
|
+
We foster a welcoming and respectful community as described in our [BeeWare Community Code of Conduct](http://beeware.org/community/behavior/).
|
|
68
|
+
|
|
69
|
+
## Contributing
|
|
70
|
+
|
|
71
|
+
If you experience problems with `xbuild`, [log them on GitHub](https://github.com/beeware/xbuild/issues). If you want to contribute code, please [fork the code](https://github.com/beeware/xbuild) and [submit a pull request](https://github.com/beeware/xbuild/pulls).
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools==80.9.0",
|
|
4
|
+
"setuptools_scm==9.2.0",
|
|
5
|
+
]
|
|
6
|
+
build-backend = "setuptools.build_meta"
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
dynamic = ["version"]
|
|
10
|
+
name = "xbuild"
|
|
11
|
+
description = "A PEP517 build frontend for cross-compiling wheels."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">= 3.13"
|
|
14
|
+
license = "BSD-3-Clause"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
16
|
+
authors = [
|
|
17
|
+
{name="Russell Keith-Magee", email="russell@keith-magee.com"},
|
|
18
|
+
]
|
|
19
|
+
maintainers = [
|
|
20
|
+
{name="Russell Keith-Magee", email="russell@keith-magee.com"},
|
|
21
|
+
]
|
|
22
|
+
keywords = [
|
|
23
|
+
"pep517",
|
|
24
|
+
"build",
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 5 - Production/Stable",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Programming Language :: Python :: 3.14",
|
|
32
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
33
|
+
"Topic :: Software Development :: Libraries",
|
|
34
|
+
"Topic :: System :: Software Distribution",
|
|
35
|
+
"Topic :: Software Development",
|
|
36
|
+
"Topic :: Utilities",
|
|
37
|
+
]
|
|
38
|
+
dependencies = [
|
|
39
|
+
"build == 1.3.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
xbuild = "xbuild.__main__:entrypoint"
|
|
44
|
+
xvenv = "xvenv.__main__:entrypoint"
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Project = "https://github.com/beeware/xbuild"
|
|
48
|
+
Funding = "https://beeware.org/contributing/membership/"
|
|
49
|
+
Tracker = "https://github.com/beeware/xbuild/issues"
|
|
50
|
+
Source = "https://github.com/beeware/xbuild"
|
|
51
|
+
|
|
52
|
+
[dependency-groups]
|
|
53
|
+
# Extras used by developers *of* briefcase are pinned to specific versions to
|
|
54
|
+
# ensure environment consistency.
|
|
55
|
+
pre-commit = [
|
|
56
|
+
"pre-commit == 4.3.0",
|
|
57
|
+
]
|
|
58
|
+
test = [
|
|
59
|
+
"pytest == 8.4.1",
|
|
60
|
+
]
|
|
61
|
+
ci = [
|
|
62
|
+
"setuptools_scm == 9.2.0",
|
|
63
|
+
"tox-uv == 1.28.0",
|
|
64
|
+
]
|
|
65
|
+
dev = [
|
|
66
|
+
{include-group = "pre-commit"},
|
|
67
|
+
{include-group = "test"},
|
|
68
|
+
{include-group = "ci"},
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.setuptools.packages.find]
|
|
72
|
+
where = ["src"]
|
|
73
|
+
|
|
74
|
+
[tool.setuptools_scm]
|
|
75
|
+
# An empty table is needed to enable setuptools_scm
|
|
76
|
+
|
|
77
|
+
[tool.ruff.lint]
|
|
78
|
+
# In addition to the default rules, these additional rules will be used:
|
|
79
|
+
extend-select = [
|
|
80
|
+
"E", # pycodestyle
|
|
81
|
+
"W", # pycodestyle
|
|
82
|
+
"F", # pyflakes
|
|
83
|
+
"UP", # pyupgrade
|
|
84
|
+
"B", # flake8-bugbear
|
|
85
|
+
"YTT", # flake8-2020
|
|
86
|
+
"ASYNC", # flake8-async
|
|
87
|
+
"C4", # flake8-comprehensions
|
|
88
|
+
"I", # isort
|
|
89
|
+
# The SIM rules are *very* opinionated, and don't necessarily make for better code.
|
|
90
|
+
# They may be worth occasionally turning on just to see if something could actually
|
|
91
|
+
# use improvement.
|
|
92
|
+
# "SIM", # flake8-simplify
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[tool.ruff.lint.isort]
|
|
96
|
+
known-first-party = [
|
|
97
|
+
"xbuild",
|
|
98
|
+
"xvenv",
|
|
99
|
+
]
|
|
100
|
+
known-third-party = [
|
|
101
|
+
"build",
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
[tool.check-wheel-contents]
|
|
105
|
+
toplevel = [
|
|
106
|
+
"xbuild",
|
|
107
|
+
"xvenv",
|
|
108
|
+
]
|
xbuild-0.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
__all__ = [
|
|
2
|
+
"__version__",
|
|
3
|
+
]
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
# Read version from SCM metadata
|
|
7
|
+
# This will only exist in a development environment
|
|
8
|
+
from setuptools_scm import get_version
|
|
9
|
+
|
|
10
|
+
# Excluded from coverage because a pure test environment (such as the one
|
|
11
|
+
# used by tox in CI) won't have setuptools_scm
|
|
12
|
+
__version__ = get_version("../..", relative_to=__file__) # pragma: no cover
|
|
13
|
+
except (ModuleNotFoundError, LookupError): # pragma: no-cover-if-missing-setuptools_scm
|
|
14
|
+
# If setuptools_scm isn't in the environment, the call to import will fail.
|
|
15
|
+
# If it *is* in the environment, but the code isn't a git checkout (e.g.,
|
|
16
|
+
# it's been pip installed non-editable) the call to get_version() will fail.
|
|
17
|
+
# If either of these occurs, read version from the installer metadata.
|
|
18
|
+
from importlib.metadata import version
|
|
19
|
+
|
|
20
|
+
__version__ = version("xbuild")
|