mirror of
https://github.com/pyenv/pyenv.git
synced 2026-10-03 07:51:06 +09:00
pyenv-binary-package: add --verbose
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
This commit is contained in:
parent
2c1f405180
commit
4a73bd17e2
@ -16,7 +16,7 @@ and dependency metadata exist to catch that.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
### `pyenv binary package <version>[:<entry>] --archive-base-url <url>`
|
### `pyenv binary package [-v|--verbose] <version>[:<entry>] --archive-base-url <url>`
|
||||||
|
|
||||||
Installs `<version>` from source under a separate name, packages that install
|
Installs `<version>` from source under a separate name, packages that install
|
||||||
with `save`, then emits a python-build definition for it with
|
with `save`, then emits a python-build definition for it with
|
||||||
@ -24,6 +24,8 @@ with `save`, then emits a python-build definition for it with
|
|||||||
current platform, platform version and architecture. An explicit entry keeps
|
current platform, platform version and architecture. An explicit entry keeps
|
||||||
the existing custom-build workflow.
|
the existing custom-build workflow.
|
||||||
|
|
||||||
|
Pass `-v` to show build progress from `pyenv install`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pyenv binary package 3.12.7 \
|
pyenv binary package 3.12.7 \
|
||||||
--archive-base-url https://example.com/binaries
|
--archive-base-url https://example.com/binaries
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Summary: Create an installable binary package from a Python version
|
# Summary: Create an installable binary package from a Python version
|
||||||
#
|
#
|
||||||
# Usage: pyenv binary package <version>[:<entry>] --archive-base-url <url>
|
# Usage: pyenv binary package [-v|--verbose] <version>[:<entry>] --archive-base-url <url>
|
||||||
#
|
#
|
||||||
# Installs <version> from source under a separate entry name, saves it as a
|
# Installs <version> from source under a separate entry name, saves it as a
|
||||||
# binary package, then emits a python-build definition for that package.
|
# binary package, then emits a python-build definition for that package.
|
||||||
@ -13,6 +13,7 @@
|
|||||||
# <entry> The optional name to build under and install the
|
# <entry> The optional name to build under and install the
|
||||||
# binary as. If omitted, a name is generated from the
|
# binary as. If omitted, a name is generated from the
|
||||||
# current platform, platform version and architecture.
|
# current platform, platform version and architecture.
|
||||||
|
# -v,--verbose Show build progress from `pyenv install'.
|
||||||
# --archive-base-url <url>
|
# --archive-base-url <url>
|
||||||
# Where the archive will be hosted; the definition
|
# Where the archive will be hosted; the definition
|
||||||
# downloads it from <url>/<entry>.tar.gz.
|
# downloads it from <url>/<entry>.tar.gz.
|
||||||
@ -23,23 +24,29 @@ set -e
|
|||||||
# Provide pyenv completions
|
# Provide pyenv completions
|
||||||
if [ "$1" = "--complete" ]; then
|
if [ "$1" = "--complete" ]; then
|
||||||
echo --archive-base-url
|
echo --archive-base-url
|
||||||
|
echo --verbose
|
||||||
exec pyenv-install --list --bare
|
exec pyenv-install --list --bare
|
||||||
fi
|
fi
|
||||||
|
|
||||||
spec=""
|
spec=""
|
||||||
archive_base_url=""
|
archive_base_url=""
|
||||||
|
verbose=""
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--archive-base-url )
|
--archive-base-url )
|
||||||
[ $# -ge 2 ] || { echo "pyenv-binary: --archive-base-url needs a value" >&2; exit 1; }
|
[ $# -lt 2 ] && { echo "pyenv-binary: --archive-base-url needs a value" >&2; exit 1; }
|
||||||
archive_base_url="$2"; shift 2 ;;
|
archive_base_url="$2"; shift ;;
|
||||||
|
-v|--verbose)
|
||||||
|
verbose=1 ;;
|
||||||
-* )
|
-* )
|
||||||
echo "pyenv-binary: unknown option \`$1'" >&2; exit 1 ;;
|
echo "pyenv-binary: unknown option \`$1'" >&2; exit 1 ;;
|
||||||
* )
|
* )
|
||||||
[ -z "$spec" ] || { echo "pyenv-binary: unexpected argument \`$1'" >&2; exit 1; }
|
[ -z "$spec" ] || { echo "pyenv-binary: unexpected argument \`$1'" >&2; exit 1; }
|
||||||
spec="$1"; shift ;;
|
spec="$1"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$spec" ] || [ -z "$archive_base_url" ]; then
|
if [ -z "$spec" ] || [ -z "$archive_base_url" ]; then
|
||||||
@ -78,7 +85,7 @@ if [ "$os" = "Darwin" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# `pyenv install' puts a `<version>:<alias>' build under versions/<alias>.
|
# `pyenv install' puts a `<version>:<alias>' build under versions/<alias>.
|
||||||
pyenv-install "$spec"
|
pyenv-install ${verbose:+--verbose} "$spec"
|
||||||
pyenv-binary-save "$entry" "$PWD" --name "$entry"
|
pyenv-binary-save "$entry" "$PWD" --name "$entry"
|
||||||
|
|
||||||
pyenv-binary-generate-installer "${entry}.meta" \
|
pyenv-binary-generate-installer "${entry}.meta" \
|
||||||
|
|||||||
@ -6,12 +6,24 @@ load test_helper
|
|||||||
# the platform tools report a fixed Linux target so the real `save' and
|
# the platform tools report a fixed Linux target so the real `save' and
|
||||||
# `generate-installer' behave the same on any test host.
|
# `generate-installer' behave the same on any test host.
|
||||||
stub_build_environment() {
|
stub_build_environment() {
|
||||||
create_stub pyenv-install 'mkdir -p "${PYENV_ROOT}/versions/${1##*:}/bin"'
|
create_stub pyenv-install 'echo "${0##*/} $*"; mkdir -p "${PYENV_ROOT}/versions/${1##*:}/bin"'
|
||||||
create_stub pyenv-latest '[ "$1" = "-f" ] && [ "$2" = "-k" ] && shift 2 && echo "$*"'
|
create_stub pyenv-latest 'while (($#)); do case "$1" in -f|-k);; *)break;; esac; shift; done; echo "$*"'
|
||||||
create_stub uname 'case "$1" in -s) echo Linux;; -m) echo x86_64;; esac'
|
create_stub uname 'case "$1" in -s) echo Linux;; -m) echo x86_64;; esac'
|
||||||
create_stub getconf 'echo "glibc 2.17"'
|
create_stub getconf 'echo "glibc 2.17"'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "-v|--verbose runs pyenv install verbosely" {
|
||||||
|
stub_build_environment
|
||||||
|
create_stub pyenv-binary-save true
|
||||||
|
create_stub pyenv-binary-generate-installer true
|
||||||
|
|
||||||
|
for opt in "" -v --verbose; do
|
||||||
|
run pyenv-binary-package $opt 3.12.7:3.12.7-test \
|
||||||
|
--archive-base-url http://example.com/binaries
|
||||||
|
assert_success "pyenv-install ${opt:+--verbose }3.12.7:3.12.7-test"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
@test "completion lists the option and definitions provided by another plugin" {
|
@test "completion lists the option and definitions provided by another plugin" {
|
||||||
mkdir -p "${PYENV_ROOT}/plugins/example/share/python-build"
|
mkdir -p "${PYENV_ROOT}/plugins/example/share/python-build"
|
||||||
touch "${PYENV_ROOT}/plugins/example/share/python-build/3.12.7-example"
|
touch "${PYENV_ROOT}/plugins/example/share/python-build/3.12.7-example"
|
||||||
@ -20,6 +32,7 @@ stub_build_environment() {
|
|||||||
run pyenv-binary-package --complete
|
run pyenv-binary-package --complete
|
||||||
assert_success
|
assert_success
|
||||||
assert_line "--archive-base-url"
|
assert_line "--archive-base-url"
|
||||||
|
assert_line "--verbose"
|
||||||
assert_line "3.12.7-example"
|
assert_line "3.12.7-example"
|
||||||
refute_line "Available versions:"
|
refute_line "Available versions:"
|
||||||
}
|
}
|
||||||
@ -92,7 +105,6 @@ stub_build_environment() {
|
|||||||
|
|
||||||
@test "strips a trailing slash from the archive base url" {
|
@test "strips a trailing slash from the archive base url" {
|
||||||
stub_build_environment
|
stub_build_environment
|
||||||
cd "${BATS_TEST_TMPDIR}"
|
|
||||||
|
|
||||||
run pyenv-binary-package 3.12.7:3.12.7-test \
|
run pyenv-binary-package 3.12.7:3.12.7-test \
|
||||||
--archive-base-url http://example.com/binaries/
|
--archive-base-url http://example.com/binaries/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user