Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ jobs:
# THE LAUNCHER'S AND THE INSTALLER'S SUITES ON WINDOWS, UNDER GIT BASH
# (#585). README says Git Bash runs the `openRepoShape` command and the
# one-line install, "tested in CI but for a typed `yes`", and this job is
# what makes that true: `tests/test_openreposhape_command.py` and
# `tests/test_install_sh.py`, run here as Git Bash runs them.
# what makes that true: `tests/test_openreposhape_command.py`,
# `tests/test_install_sh.py` and `tests/test_install_sh_filter_repo.py`,
# run here as Git Bash runs them.
#
# TWO SUITES, NOT THE WHOLE SUITE. #597 dropped the Windows job for the
# whole estate, and this job is the one exception made to it (see the
Expand Down Expand Up @@ -223,8 +224,13 @@ jobs:
# guarantees allows: `runner.temp` is `D:\a\_temp` or `C:\a\_temp`,
# and the default profile path is ~50 of MAX_PATH's 260 characters
# before the suites' own nesting starts.
#
# The installer's suite is TWO FILES (#649): `tests/test_install_sh_
# filter_repo.py` holds the git-filter-repo step and the two
# readinesses step 3's one line ends with (#595), on
# `tests/test_install_sh.py`'s fakes and set-up.
- name: the launcher's and the installer's suites, under Git Bash
run: python -m pytest -q -rA tests/test_openreposhape_command.py tests/test_install_sh.py --basetemp=${{ runner.temp }}\t
run: python -m pytest -q -rA tests/test_openreposhape_command.py tests/test_install_sh.py tests/test_install_sh_filter_repo.py --basetemp=${{ runner.temp }}\t

# THE openreposhape PACKAGE, BUILT AND INSTALLED AS A PERSON INSTALLS IT
# (#563). A JOB OF ITS OWN, AND NO PYTEST IN IT: the build backend
Expand Down
49 changes: 45 additions & 4 deletions openRepoShape
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,15 @@ fetch_or_die() {
# handed the clone URL of the very repository these bytes came from: name a
# fork or mirror once and it is used for the fetch AND the clone. A URL or a
# path on disk (what the tests point it at) goes through untouched.
#
# A WINDOWS PATH IS A PATH TOO (#649): `C:/src/openRepoShape` and
# `C:\src\openRepoShape`, which Git Bash and git itself both take, were read
# as an owner/name and became `https://github.com/C:/src/openRepoShape.git`.
# No owner/name holds a colon, and the package's `clone_url` reads a drive
# letter the same way.
shape_clone_url() {
case "$REPO" in
*://* | *@*:* | /* | .*) printf '%s' "$REPO" ;;
*://* | *@*:* | /* | .* | [A-Za-z]:/* | [A-Za-z]:\\*) printf '%s' "$REPO" ;;
*) printf 'https://github.com/%s.git' "$REPO" ;;
esac
}
Expand Down Expand Up @@ -306,11 +312,21 @@ collect_commands() {
# `python3`, and `git-filter-repo` -- which only `adopt-project.py` needs and
# `--preflight` therefore does not ask about.
#
# IT OFFERS NOTHING AND RUNS NO INSTALLER. Four `command -v` probes, which
# IT OFFERS NOTHING AND RUNS NO INSTALLER. `command -v` probes, which
# execute nothing at all, and one `gh auth status`, which is the only way to
# learn a login state. An offer belongs behind a typed yes, in `--preflight`,
# and this line points there rather than growing a second consent.
#
# A PYTHON BY EITHER NAME, `python3` THEN `python`, in `find_python`'s order
# (#649). Where Python came from python.org, Git Bash has `python` and no
# `python3`, and this row said `python3 MISSING` while `--preflight` passed.
# The row keeps its name and says `present, as python` there. Still a probe
# and never a run, so what answers is never asked its version: the Microsoft
# Store's `python3` stub and macOS's Command Line Tools stubs read as present
# here, and so does a `python` that is Python 2, or older than 3.9, where
# there is no `python3`. `--preflight` runs the version check, and this
# report runs none.
#
# IT NEVER CHANGES THE EXIT CODE. A machine missing a prerequisite did not
# make the copy that was just placed any less placed, and an install that
# reported failure because `gh` was not logged in would be an install nobody
Expand All @@ -319,7 +335,10 @@ machine_report() {
local name state short=0
say " machine:"
for name in git gh python3 git-filter-repo; do
if command -v "$name" >/dev/null 2>&1; then
if [ "$name" = python3 ] && ! command -v python3 >/dev/null 2>&1 &&
command -v python >/dev/null 2>&1; then
state="present, as python"
elif command -v "$name" >/dev/null 2>&1; then
state="present"
if [ "$name" = gh ]; then
if gh auth status >/dev/null 2>&1; then
Expand Down Expand Up @@ -386,7 +405,29 @@ record_ref() {

install_commands() {
local dir="${OPENREPOSHAPE_BIN_DIR:-$HOME/.local/bin}"
local name target source verb placed=0 recording=0 record
local name target source verb placed=0 recording=0 record spelled=""
# A WINDOWS SPELLING IS SPELLED AGAIN THE WAY BASH SPELLS IT (#649), with
# `cygpath -u`, which Git Bash has, before anything is checked or placed:
# `D:\tools\bin` becomes `/d/tools/bin`. Kept as typed, every line below
# named it, and the PATH note printed `export PATH="D:\tools\bin:$PATH"`,
# which the drive's colon splits in two, and never found it on a `$PATH`
# that holds `/d/tools/bin`. Where no cygpath answers, nothing here can
# spell it as bash's `$PATH` needs it (and off Windows the drive letter is
# no drive at all), so the value is refused: no line it could print about
# `$PATH` would work.
case "$dir" in
[A-Za-z]:/* | [A-Za-z]:\\*)
if command -v cygpath >/dev/null 2>&1; then
spelled="$(cygpath -u -- "$dir" 2>/dev/null)" || spelled=""
fi
case "$spelled" in
"" | [A-Za-z]:*)
die "--install would place this command in '$dir', which is spelled for Windows, and no cygpath here spells it the way bash does, so the directory could not go on \$PATH: the drive's colon splits it. Nothing was placed. Set \$OPENREPOSHAPE_BIN_DIR to the directory as this shell spells it, then run this again."
;;
esac
dir="$spelled"
;;
esac
if [ "$REF_FROM_RECORD" -eq 1 ] ||
{ [ "$REF_NAMED" -eq 1 ] && [ "${OPENREPOSHAPE_RECORD_REF:-}" = 1 ]; }; then
recording=1
Expand Down
Loading
Loading