Skip to content

Commit 4ad5c97

Browse files
authored
Add pants_from_sources support. (#77)
Closes #30
1 parent 32ff2e8 commit 4ad5c97

File tree

9 files changed

+334
-32
lines changed

9 files changed

+334
-32
lines changed

.github/workflows/ci.yml

+15-8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
strategy:
2929
matrix:
3030
os: [ubuntu-22.04, macos-11, macOS-11-ARM64, windows-2022]
31+
env:
32+
PY: python3.9
33+
SCIE_PANTS_DEV_CACHE: .scie_pants_dev_cache
3134
steps:
3235
- uses: actions/checkout@v3
3336
- name: Check Formatting
@@ -38,6 +41,18 @@ jobs:
3841
run: cargo clippy --all
3942
- name: Unit Tests
4043
run: cargo test --all
44+
- name: Setup Python 3.9
45+
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-11' }}
46+
uses: actions/setup-python@v4
47+
with:
48+
# N.B.: We need Python 3.9 for running Pants goals against our tools.pex Python tools
49+
# codebase as well as running Pants from sources in ITs.
50+
python-version: "3.9"
51+
- name: Cache Build and IT Artifacts
52+
uses: actions/cache@v3
53+
with:
54+
path: ${{ env.SCIE_PANTS_DEV_CACHE }}
55+
key: ${{ runner.os }}-${{ runner.arch }}-scie-pants-v0
4156
- name: Build, Package & Integration Tests
4257
if: ${{ matrix.os == 'macOS-11-ARM64' }}
4358
run: |
@@ -58,13 +73,6 @@ jobs:
5873
run: |
5974
PANTS_BOOTSTRAP_GITHUB_API_BEARER_TOKEN=${{ secrets.GITHUB_TOKEN }} \
6075
cargo run -p package -- test
61-
- name: Setup Python 3.9
62-
if: ${{ matrix.os == 'ubuntu-22.04' }}
63-
uses: actions/setup-python@v4
64-
with:
65-
# N.B.: We need Python 3.9 for running Pants goals against our tools.pex Python tools
66-
# codebase.
67-
python-version: "3.9"
6876
- name: Build, Package & Integration Tests
6977
if: ${{ matrix.os == 'ubuntu-22.04' }}
7078
run: |
@@ -85,4 +93,3 @@ jobs:
8593
cargo run -p package -- test \
8694
--tools-pex dist/tools.pex --scie-pants dist/scie-pants-linux-x86_64 \
8795
--tools-pex-mismatch-warn
88-

BUILD_ROOT

Whitespace-only changes.

CHANGES.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Release Notes
22

3+
## 0.3.0
4+
5+
This release adds support for running Pants from a local Pants clone. This is useful for testing out
6+
unreleased Pants changes.
7+
8+
This feature used to be provided by a bespoke `pants_from_sources` script copied around to various
9+
repositories; an example of which is [here](
10+
https://github.com/pantsbuild/example-python/blob/1b38d08821865e3756024950bc000bdbd0161b95/pants_from_sources).
11+
12+
There are two ways to activate this mode:
13+
1. Execute `pants` with the `PANTS_SOURCE` environment variable set as the path to the Pants repo
14+
whose Pants code you'd like to run against your repo.
15+
2. Copy, hardlink or symlink your `pants` binary to `pants_from_sources` and execute that.
16+
17+
The first activation method is new. The second mode follows the bespoke `./pants_from_sources`
18+
conventions and assumes `PANTS_SOURCE=../pants`. You can override that by setting the`PANTS_SOURCE`
19+
env var as in the first activation method.
20+
321
## 0.2.2
422

523
This release fixes the scie-pants scie to not expose the interpreter used to run a Pants

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ members = [
66
[package]
77
name = "scie-pants"
88
description = "Protects your Pants from the elements."
9-
version = "0.2.2"
9+
version = "0.3.0"
1010
edition = "2021"
1111
authors = [
1212
"John Sirois <[email protected]>",

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ provides the following:
6363
If you run `scie-pants` in a directory where Pants is not already set up, it will prompt you, and
6464
you can let it set up the latest Pants stable version for your project.
6565

66+
+ Built-in [`pants_from_sources`](
67+
https://github.com/pantsbuild/example-python/blob/1b38d08821865e3756024950bc000bdbd0161b95/pants_from_sources)
68+
support. You can either execute `scie-pants` with `PANTS_SOURCE` set to the path of a local clone
69+
of the [Pants](https://github.com/pantsbuild/pants) repo or else copy, link or symlink your
70+
`scie-pants` executable to `pants_from_sources` and execute that. In this case `PANTS_SOURCE` will
71+
default to `../pants` just as was the case in the bespoke `./pants_from_sources` scripts.
72+
6673
+ Partial support for firewalls:
6774

6875
Currently, you can only re-direct the URLs scie-pants uses to fetch [Python Build Standalone](

0 commit comments

Comments
 (0)