Skip to content

Commit dffb2e7

Browse files
authored
Upgrade to scie-jump 0.7.2 to fix several bugs. (#40)
This fixes argv0 handling such that relative paths do not confuse `scie-pants` leading to errors during self update or when running `scie-pants` as `pants` from the PATH in a repo with a `./pants` script. Fixes #28 Fixes #38
1 parent af62f81 commit dffb2e7

File tree

5 files changed

+43
-8
lines changed

5 files changed

+43
-8
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release Notes
22

3+
## 0.1.11
4+
5+
This release fixes `SCIE_BOOT=update ./scie-pants`; i.e.: updating `scie-pants` when invoking
6+
`scie-pants` vis a relative path. It also fixes `scie-pants` to work when on the `PATH` as `pants`
7+
in any repo that already contains the `./pants` bash script.
8+
39
## 0.1.10
410

511
This release folds [one step setup](

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
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.1.10"
9+
version = "0.1.11"
1010
edition = "2021"
1111
authors = [
1212
"John Sirois <[email protected]>",

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ The `scie-pants` binary will re-install versions of Pants you have already insta
9999
directory that is different from the `~/.cache/pants/setup` directory used by the `./pants` script.
100100
This is a one-time event per Pants version.
101101

102-
Naming the `scie-pants` binary `pants` will lead to an obscure error currently in a repo with an
103-
existing `./pants`. That is tracked [here](https://github.com/pantsbuild/scie-pants/issues/28).
104-
105102
The `scie-pants` does not work in the Pants repo itself. That repo has a special `./pants` script
106103
and declares no `pants_version`. As such, if you run `scie-pants` in the Pants repo, you'll be
107104
prompted to set up the latest stable version of Pants. You can just answer no and remember not to

package/src/main.rs

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use url::Url;
2222
const BINARY: &str = "scie-pants";
2323

2424
const PTEX_TAG: &str = "v0.6.0";
25-
const SCIE_JUMP_TAG: &str = "v0.7.1";
25+
const SCIE_JUMP_TAG: &str = "v0.7.2";
2626

2727
const CARGO: &str = env!("CARGO");
2828
const CARGO_MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR");
@@ -789,6 +789,35 @@ fn test(
789789
.current_dir(existing_project_dir.path()),
790790
"Y".as_bytes(),
791791
)?;
792+
793+
integration_test!(
794+
"Verify scie-pants can be used as `pants` in a repo with the `pants` script"
795+
);
796+
// This verifies a fix for https://github.com/pantsbuild/scie-pants/issues/28.
797+
let clone_root = create_tempdir()?;
798+
execute(
799+
Command::new("git")
800+
.args(["clone", "https://github.com/pantsbuild/example-django"])
801+
.current_dir(clone_root.path()),
802+
)?;
803+
let bin_dir = clone_root.path().join("bin");
804+
ensure_directory(&bin_dir, false)?;
805+
copy(scie_pants_scie, bin_dir.join("pants").as_path())?;
806+
let new_path = if let Ok(existing_path) = env::var("PATH") {
807+
format!(
808+
"{bin_dir}{path_sep}{existing_path}",
809+
bin_dir = bin_dir.display(),
810+
path_sep = PATHSEP
811+
)
812+
} else {
813+
format!("{bin_dir}", bin_dir = bin_dir.display())
814+
};
815+
execute(
816+
Command::new("pants")
817+
.arg("-V")
818+
.env("PATH", new_path)
819+
.current_dir(clone_root.path().join("example-django")),
820+
)?;
792821
}
793822

794823
// Max Python supported is 3.8 and only Linux and macOS x86_64 wheels were released.
@@ -819,10 +848,13 @@ fn test(
819848
execute(Command::new(scie_pants_scie).env("SCIE_BOOT", "update"))?;
820849

821850
integration_test!("Verifying downgrade works");
851+
// Additionally, we exercise using a relative path to the scie-jump binary which triggered
852+
// https://github.com/pantsbuild/scie-pants/issues/38 in the past.
822853
execute(
823-
Command::new(scie_pants_scie)
854+
Command::new(PathBuf::from(".").join(scie_pants_scie.file_name().unwrap()))
824855
.env("SCIE_BOOT", "update")
825-
.arg("0.1.8"),
856+
.arg("0.1.8")
857+
.current_dir(scie_pants_scie.parent().unwrap()),
826858
)?;
827859

828860
Ok(())

0 commit comments

Comments
 (0)