1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-08 11:33:49 -05:00

Compare commits

...

47 Commits

Author SHA1 Message Date
Anton Petrov
6bb75b3ba7 Update CHANGELOG.md 2023-03-10 09:04:21 +03:00
Anton Petrov
f507d08064 Update pyenv---version 2023-03-10 09:03:23 +03:00
Saaket Prakash
ad15c75e0e Add CPython 3.12.0a6 (#2638) 2023-03-08 08:32:18 +03:00
Ivan Pozdeev
6052caa038 README: extended support for 3.5.10 2023-03-02 11:27:23 +03:00
Ivan Pozdeev
e8a4b54231 CI: ubuntu-build: Fix 404s on apt install 2023-03-02 11:24:05 +03:00
Alex Hedges
bcbdadf10d Add miniconda 23.1.0-1 (#2635) 2023-03-02 06:49:44 +03:00
Anton Petrov
904dd5f828 Update pyenv---version 2023-03-01 08:25:31 +03:00
Anton Petrov
3226a1870b Update CHANGELOG.md 2023-03-01 08:25:12 +03:00
Anton Petrov
0d19efecf5 Merge pull request #2634 from mrienstra/patch-1
README: clarify behavior of `pyenv latest`
2023-02-28 09:30:48 +03:00
Michael Rienstra
ecab7b0d17 README: clarify behavior of pyenv latest 2023-02-27 16:26:18 -08:00
Chaim Halbert
3bfc97ad29 bpo-36231 for v3.5.10: fix Unsupported MacOS X CPU type in ffi.h (#2633) 2023-02-26 18:36:51 +03:00
native-api
276ce32643 Merge pull request #2630 from chaimleib/fix-bpo-27987-on-eol-pythons
bpo-27987 for v3.5.10 and v3.6.15: align by 16bytes on 64bit platforms
2023-02-26 16:05:39 +03:00
Chaim Halbert
b30508f9b8 bpo-41100 for v3.5.10: fix implicit declaration of function sendfile 2023-02-26 05:51:20 -07:00
Chaim Halbert
0e80d0725b v3.5.10 on macOS13: fix unexpected output of arch on OSX 2023-02-26 05:21:03 -07:00
Chaim Halbert
6bec7a50fe bpo-45405 for v3.5.10: Prevent internal configure error when running configure with recent versions of clang. (GH-28845) (GH-31890) 2023-02-24 13:16:52 -07:00
Chaim Halbert
28be65992d bpo-27987 for v3.5.10 and v3.6.15: align by 16bytes on 64bit platforms 2023-02-24 12:19:13 -07:00
Florian Schüller
68918e69b7 Support for BusyBox version of `head' (#2629) 2023-02-22 20:11:48 +03:00
Rafał
86a4423bbb Fix indentation (#2620) 2023-02-16 00:10:36 +03:00
Anton Petrov
0ab9683e58 2.3.13 2023-02-15 08:15:35 +03:00
Anton Petrov
7fe647968d 2.3.13 2023-02-15 08:15:14 +03:00
Anton Petrov
c8daaa3954 Merge pull request #2614 from Afront/3.12.0a5
Add CPython 3.12.0a5
2023-02-08 14:08:18 +03:00
Anton Petrov
88be70722f Merge pull request #2616 from edgarrmondragon/cpython-3.10.10
Add CPython 3.10.10
2023-02-08 14:07:46 +03:00
Anton Petrov
47d88d2c5f Merge pull request #2615 from edgarrmondragon/cpython-3.11.2
Add CPython 3.11.2
2023-02-08 14:07:34 +03:00
Edgar Ramírez Mondragón
6b758c8cf9 Add CPython 3.10.10 2023-02-08 03:43:04 -06:00
Edgar Ramírez Mondragón
017b6d877e Add CPython 3.11.2 2023-02-08 03:38:33 -06:00
Afront
063aa457e4 Add CPython 3.12.0a5 2023-02-08 15:34:14 +09:00
native-api
fcd7806529 Merge pull request #2612 from laggardkernel/bugfix/realpath-in-versions
Fix link resolving in pyenv-versions
2023-02-06 20:09:22 +03:00
Ivan Pozdeev
a3f0bddc2a CI: Migrate to checkout@v3
Actions runner warns about v2 deprecation
2023-02-06 19:22:38 +03:00
Ivan Pozdeev
f72c1712dc CI: Test with native extension
Only run tests for subcommands that use the native extension
2023-02-06 19:22:38 +03:00
laggardkernel
a7b181c3ca Fix link resolving in pyenv-versions
Co-Authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
2023-02-06 19:22:38 +03:00
native-api
c8c324afb4 Merge pull request #2610 from native-api/version_skip_envs
Ignore virtualenvs in `pyenv latest' in a clean way
2023-02-02 20:01:28 +03:00
Ivan Pozdeev
72c5b034ca Avoid the need to filter out envs in `pyenv-latest' 2023-02-02 18:24:17 +03:00
Ivan Pozdeev
446411dc64 Streamline `pyenv-versions --bare'
Achieves a ~20% speedup.
As it's used in pyenv-latest, this affects all version lookups
2023-02-02 18:15:47 +03:00
Ivan Pozdeev
9fe80f28e5 Add pyenv versions' option to skip envs for pyenv-latest' 2023-02-02 18:15:13 +03:00
native-api
9248255f70 Show symlink contents in non-bare `pyenv versions' (#2609)
* Change other tests to use the newly-created convenience function
2023-02-02 17:24:19 +03:00
native-api
368e04f3fa Fix pyenv-latest to ignore virtualenvs (#2608)
* Add test, exclude alphas as well
2023-02-02 15:15:16 +03:00
Anton Petrov
76e93b073e 2.3.12 2023-01-30 08:19:43 +03:00
Anton Petrov
e3fe82a9b1 2.3.12 2023-01-30 08:19:25 +03:00
native-api
dd60d5fae2 Fix overriding arguments for --enable-framework and --enable-universalsdk after #2592 (#2605) 2023-01-29 00:59:47 +03:00
Anton Petrov
96828af31e Merge pull request #2602 from colesbury/nogil-3.9.10-1
Add more recent build of nogil Python.
2023-01-23 16:17:32 +03:00
Sam Gross
c998eae677 Add more recent build of nogil Python. 2023-01-22 13:12:28 -08:00
native-api
c20fc7bd6a Fix pyenv which to support auto-resolved prefixes (#2601)
* Resolve version name that hooks see
* Avoid a 2nd iteration over configured versions
2023-01-22 18:22:26 +03:00
native-api
f1a1f59c87 Fix :latest after #2568 (#2599)
* Cleanup mocks logic
* Add test for `:latest`
2023-01-22 05:49:40 +03:00
Ivan Pozdeev
b64b0ab5e2 Merge branch 'master' of https://github.com/native-api/pyenv 2023-01-22 00:20:28 +03:00
Ivan Pozdeev
1a0b555baf Improve visibility of the auto-resolution feature
Recent feedback showed that it's not visible enough
2023-01-22 00:07:53 +03:00
native-api
819e2b8f45 Fix wrong libpython being linked to in MacOS (#2596)
Without rpath, python would link up to the system's libpython
2023-01-19 00:21:10 +03:00
Christian Clauss
bd618ea9ef add_miniconda.py: fix typo oversight (#2595) 2023-01-15 13:37:11 +03:00
44 changed files with 1166 additions and 240 deletions

View File

@@ -17,7 +17,7 @@ jobs:
- "3.11" - "3.11"
runs-on: macos-11 runs-on: macos-11
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
# Normally, we would use the superbly maintained... # Normally, we would use the superbly maintained...
# - uses: actions/setup-python@v2 # - uses: actions/setup-python@v2
# with: # with:

View File

@@ -6,7 +6,7 @@ jobs:
outputs: outputs:
versions: ${{steps.modified-versions.outputs.versions}} versions: ${{steps.modified-versions.outputs.versions}}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- run: git fetch origin "$GITHUB_BASE_REF" - run: git fetch origin "$GITHUB_BASE_REF"
- shell: bash - shell: bash
run: > run: >
@@ -30,7 +30,7 @@ jobs:
os: ["macos-11", "macos-12"] os: ["macos-11", "macos-12"]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- run: | - run: |
#envvars #envvars
export PYENV_ROOT="$GITHUB_WORKSPACE" export PYENV_ROOT="$GITHUB_WORKSPACE"
@@ -90,7 +90,7 @@ jobs:
os: ["ubuntu-20.04", "ubuntu-22.04"] os: ["ubuntu-20.04", "ubuntu-22.04"]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- run: | - run: |
#envvars #envvars
export PYENV_ROOT="$GITHUB_WORKSPACE" export PYENV_ROOT="$GITHUB_WORKSPACE"

View File

@@ -16,7 +16,7 @@ jobs:
- macos-11 - macos-11
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
# Normally, we would use the superbly maintained... # Normally, we would use the superbly maintained...
# - uses: actions/setup-python@v2 # - uses: actions/setup-python@v2
# with: # with:
@@ -42,3 +42,8 @@ jobs:
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: | - run: |
make test make test
- env:
PYENV_NATIVE_EXT: 1
run: |
(cd src; ./configure; make)
bats/bin/bats test/{pyenv,hooks,versions}.bats

View File

@@ -17,14 +17,14 @@ jobs:
- "3.11" - "3.11"
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
# Normally, we would use the superbly maintained... # Normally, we would use the superbly maintained...
# - uses: actions/setup-python@v2 # - uses: actions/setup-python@v2
# with: # with:
# python-version: ${{ matrix.python-version }} # python-version: ${{ matrix.python-version }}
# ... but in the repo, we want to test pyenv builds on Ubuntu # ... but in the repo, we want to test pyenv builds on Ubuntu
- run: | - run: |
sudo apt-get install -yq make build-essential libssl-dev zlib1g-dev \ sudo apt-get update -q; sudo apt install -yq make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \ libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# https://github.com/pyenv/pyenv#installation # https://github.com/pyenv/pyenv#installation

View File

@@ -1,5 +1,36 @@
# Version History # Version History
## Release 2.3.15
* Add miniconda 23.1.0-1 by @aphedges in https://github.com/pyenv/pyenv/pull/2635
* Add CPython 3.12.0a6 by @saaketp in https://github.com/pyenv/pyenv/pull/2638
## Release 2.3.14
* Fix indentation by @rafrafek in https://github.com/pyenv/pyenv/pull/2620
* Support for "BusyBox version" of "head" by @schuellerf in https://github.com/pyenv/pyenv/pull/2629
* bpo-27987 for v3.5.10 and v3.6.15: align by 16bytes on 64bit platforms by @chaimleib in https://github.com/pyenv/pyenv/pull/2630
* bpo-36231 for v3.5.10: fix Unsupported MacOS X CPU type in ffi.h by @chaimleib in https://github.com/pyenv/pyenv/pull/2633
* README: clarify behavior of `pyenv latest` by @mrienstra in https://github.com/pyenv/pyenv/pull/2634
## Release 2.3.13
* Fix pyenv-latest to ignore virtualenvs by @native-api in https://github.com/pyenv/pyenv/pull/2608
* Show symlink contents in non-bare `pyenv versions' by @native-api in https://github.com/pyenv/pyenv/pull/2609
* Ignore virtualenvs in `pyenv latest' in a clean way by @native-api in https://github.com/pyenv/pyenv/pull/2610
* Fix link resolving in pyenv-versions by @laggardkernel in https://github.com/pyenv/pyenv/pull/2612
* Add CPython 3.11.2 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/2615
* Add CPython 3.10.10 by @edgarrmondragon in https://github.com/pyenv/pyenv/pull/2616
* Add CPython 3.12.0a5 by @Afront in https://github.com/pyenv/pyenv/pull/2614
## Release 2.3.12
* Undefined name: do not forget self when accessing flavor by @cclauss in https://github.com/pyenv/pyenv/pull/2595
* Fix wrong libpython being linked to in MacOS by @native-api in https://github.com/pyenv/pyenv/pull/2596
* Fix `:latest` by @native-api in https://github.com/pyenv/pyenv/pull/2599
* Fix `pyenv which` to support auto-resolved prefixes by @native-api in https://github.com/pyenv/pyenv/pull/2601
* Add more recent build of nogil Python. by @colesbury in https://github.com/pyenv/pyenv/pull/2602
## Release 2.3.11 ## Release 2.3.11
* Add CPython 3.12.0a4 by @Afront in https://github.com/pyenv/pyenv/pull/2590 * Add CPython 3.12.0a4 by @Afront in https://github.com/pyenv/pyenv/pull/2590

View File

@@ -53,7 +53,7 @@ This project was forked from [rbenv](https://github.com/rbenv/rbenv) and
* [Install Python build dependencies](#install-python-build-dependencies) * [Install Python build dependencies](#install-python-build-dependencies)
* **[Usage](#usage)** * **[Usage](#usage)**
* [Install additional Python versions](#install-additional-python-versions) * [Install additional Python versions](#install-additional-python-versions)
* [Prefix auto-resolution](#prefix-auto-resolution) * [Prefix auto-resolution to the latest version](#prefix-auto-resolution-to-the-latest-version)
* [Python versions with extended support](#python-versions-with-extended-support) * [Python versions with extended support](#python-versions-with-extended-support)
* [Switch between Python versions](#switch-between-python-versions) * [Switch between Python versions](#switch-between-python-versions)
* [Uninstall Python versions](#uninstall-python-versions) * [Uninstall Python versions](#uninstall-python-versions)
@@ -412,11 +412,11 @@ please visit the wiki page about
[Common Build Problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems). [Common Build Problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems).
#### Prefix auto-resolution #### Prefix auto-resolution to the latest version
All Pyenv subcommands except `uninstall` automatically resolve full prefixes to the latest version in the corresponding version line. All Pyenv subcommands except `uninstall` automatically resolve full prefixes to the latest version in the corresponding version line.
`pyenv install` picks the latest known version while other subcommands -- the latest installed version. `pyenv install` picks the latest known version, while other subcommands pick the latest installed version.
E.g. to install and then switch to the latest 3.10 release: E.g. to install and then switch to the latest 3.10 release:
@@ -425,8 +425,7 @@ pyenv install 3.10
pyenv global 3.10 pyenv global 3.10
``` ```
You can run [`pyenv latest <prefix>`](COMMANDS.md#pyenv-latest) to see You can run [`pyenv latest -k <prefix>`](COMMANDS.md#pyenv-latest) to see how `pyenv install` would resolve a specific prefix, or [`pyenv latest <prefix>`](COMMANDS.md#pyenv-latest) to see how other subcommands would resolve it.
what a specific prefix would be resolved to.
See the [`pyenv latest` documentation](COMMANDS.md#pyenv-latest) for details. See the [`pyenv latest` documentation](COMMANDS.md#pyenv-latest) for details.
@@ -439,7 +438,7 @@ it's safe to assume that they will continue working until there are further inco
in a later version of those environments. in a later version of those environments.
* *3.7.8-3.7.15, 3.8.4-3.8.12, 3.9.0-3.9.7* : XCode 13.3 * *3.7.8-3.7.15, 3.8.4-3.8.12, 3.9.0-3.9.7* : XCode 13.3
* *3.6.15* : MacOS 11+ and XCode 13.3 * *3.5.10, 3.6.15* : MacOS 11+ and XCode 13.3
* *2.7.18* : MacOS 10.15+ and Apple Silicon * *2.7.18* : MacOS 10.15+ and Apple Silicon

View File

@@ -29,7 +29,7 @@ if enable -f "${BASH_SOURCE%/*}"/../libexec/pyenv-realpath.dylib realpath 2>/dev
else else
[ -z "$PYENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin" [ -z "$PYENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin"
READLINK=$(type -P greadlink readlink | head -1) READLINK=$(type -P greadlink readlink | head -n1)
[ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?" [ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?"
resolve_link() { resolve_link() {

View File

@@ -12,7 +12,7 @@
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
version="2.3.11" version="2.3.15"
git_revision="" git_revision=""
if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then if cd "${BASH_SOURCE%/*}" 2>/dev/null && git remote -v 2>/dev/null | grep -q pyenv; then

View File

@@ -46,7 +46,7 @@ extract_initial_comment_block() {
collect_documentation() { collect_documentation() {
# `tail` prevents "broken pipe" errors due to `head` closing the pipe without reading everything # `tail` prevents "broken pipe" errors due to `head` closing the pipe without reading everything
# https://superuser.com/questions/554855/how-can-i-fix-a-broken-pipe-error/642932#642932 # https://superuser.com/questions/554855/how-can-i-fix-a-broken-pipe-error/642932#642932
$(type -P gawk awk | tail -n +1 | head -1) ' $(type -P gawk awk | tail -n +1 | head -n1) '
/^Summary:/ { /^Summary:/ {
summary = substr($0, 10) summary = substr($0, 10)
next next

View File

@@ -26,7 +26,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; th
echo "pyenv: failed to load \`realpath' builtin" >&2 echo "pyenv: failed to load \`realpath' builtin" >&2
exit 1 exit 1
fi fi
READLINK=$(type -P greadlink readlink | head -1) READLINK=$(type -P greadlink readlink | head -n1)
if [ -z "$READLINK" ]; then if [ -z "$READLINK" ]; then
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1 exit 1

View File

@@ -31,7 +31,7 @@ exitcode=0
IFS=$'\n' IFS=$'\n'
if [[ -z $FROM_KNOWN ]]; then if [[ -z $FROM_KNOWN ]]; then
DEFINITION_CANDIDATES=( $(pyenv-versions --bare) ) DEFINITION_CANDIDATES=( $(pyenv-versions --bare --skip-envs) )
else else
DEFINITION_CANDIDATES=( $(python-build --definitions ) ) DEFINITION_CANDIDATES=( $(python-build --definitions ) )
fi fi
@@ -50,7 +50,7 @@ IFS=$'\n'
DEFINITION_CANDIDATES=(\ DEFINITION_CANDIDATES=(\
$(printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | \ $(printf '%s\n' "${DEFINITION_CANDIDATES[@]}" | \
sed -E -e '/-dev$/d' -e '/-src$/d' -e '/-latest$/d' -e '/(b|rc)[0-9]+$/d')); sed -E -e '/-dev$/d' -e '/-src$/d' -e '/-latest$/d' -e '/(a|b|rc)[0-9]+$/d'));
# Compose a sorting key, followed by | and original value # Compose a sorting key, followed by | and original value
DEFINITION_CANDIDATES=(\ DEFINITION_CANDIDATES=(\

View File

@@ -1,23 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: List all Python versions available to pyenv # Summary: List all Python versions available to pyenv
# Usage: pyenv versions [--bare] [--skip-aliases] # Usage: pyenv versions [--bare] [--skip-aliases] [--skip-envs]
# #
# Lists all Python versions found in `$PYENV_ROOT/versions/*'. # Lists all Python versions found in `$PYENV_ROOT/versions/*'.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
unset bare unset bare skip_aliases skip_envs
unset skip_aliases
# Provide pyenv completions # Provide pyenv completions
for arg; do for arg; do
case "$arg" in case "$arg" in
--complete ) --complete )
echo --bare echo --bare
echo --skip-aliases echo --skip-aliases
echo --skip-envs
exit ;; exit ;;
--bare ) bare=1 ;; --bare ) bare=1 ;;
--skip-aliases ) skip_aliases=1 ;; --skip-aliases ) skip_aliases=1 ;;
--skip-envs ) skip_envs=1 ;;
* ) * )
pyenv-help --usage versions >&2 pyenv-help --usage versions >&2
exit 1 exit 1
@@ -33,7 +34,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; th
exit 1 exit 1
fi fi
READLINK=$(type -P greadlink readlink | head -1) READLINK=$(type -P greadlink readlink | head -n1)
if [ -z "$READLINK" ]; then if [ -z "$READLINK" ]; then
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1 exit 1
@@ -70,8 +71,6 @@ else
current_versions=() current_versions=()
fi fi
if [ -n "$bare" ]; then if [ -n "$bare" ]; then
hit_prefix=""
miss_prefix=""
include_system="" include_system=""
else else
hit_prefix="* " hit_prefix="* "
@@ -104,10 +103,23 @@ exists() {
} }
print_version() { print_version() {
local version="${1:?}"
if [[ -n $bare ]]; then
echo "$version"
return
fi
local path="${2:?}"
if [[ -L "$path" ]]; then
# Only resolve the link itself for printing, do not resolve further.
# Doing otherwise would misinform the user of what the link contains.
version_repr="$version --> $(readlink "$path")"
else
version_repr="$version"
fi
if [[ ${BASH_VERSINFO[0]} -ge 4 && ${current_versions["$1"]} ]]; then if [[ ${BASH_VERSINFO[0]} -ge 4 && ${current_versions["$1"]} ]]; then
echo "${hit_prefix}$1 (set by $(pyenv-version-origin))" echo "${hit_prefix}${version_repr} (set by $(pyenv-version-origin))"
elif (( ${BASH_VERSINFO[0]} <= 3 )) && exists "$1" "${current_versions[@]}"; then elif (( ${BASH_VERSINFO[0]} <= 3 )) && exists "$1" "${current_versions[@]}"; then
echo "${hit_prefix}$1 (set by $(pyenv-version-origin))" echo "${hit_prefix}${version_repr} (set by $(pyenv-version-origin))"
else else
echo "${miss_prefix}$1" echo "${miss_prefix}$1"
fi fi
@@ -119,7 +131,7 @@ if [ -n "$include_system" ] && \
(PYENV_VERSION=system pyenv-which python >/dev/null 2>&1 || \ (PYENV_VERSION=system pyenv-which python >/dev/null 2>&1 || \
PYENV_VERSION=system pyenv-which python3 >/dev/null 2>&1 || \ PYENV_VERSION=system pyenv-which python3 >/dev/null 2>&1 || \
PYENV_VERSION=system pyenv-which python2 >/dev/null 2>&1) ; then PYENV_VERSION=system pyenv-which python2 >/dev/null 2>&1) ; then
print_version system print_version system "/"
fi fi
shopt -s dotglob nullglob shopt -s dotglob nullglob
@@ -139,16 +151,18 @@ for path in "${versions_dir_entries[@]}"; do
if [ -d "$path" ]; then if [ -d "$path" ]; then
if [ -n "$skip_aliases" ] && [ -L "$path" ]; then if [ -n "$skip_aliases" ] && [ -L "$path" ]; then
target="$(realpath "$path")" target="$(realpath "$path")"
[ "${target%/*}" != "$versions_dir" ] || continue [ "${target%/*}" == "$versions_dir" ] && continue
[ "${target%/*/envs/*}" != "$versions_dir" ] || continue [ "${target%/*/envs/*}" == "$versions_dir" ] && continue
fi
print_version "${path##*/}" "$path"
# virtual environments created by anaconda/miniconda/pyenv-virtualenv
if [[ -z $skip_envs ]]; then
for env_path in "${path}/envs/"*; do
if [ -d "${env_path}" ]; then
print_version "${env_path#${PYENV_ROOT}/versions/}" "${env_path}"
fi
done
fi fi
print_version "${path##*/}"
# virtual environments created by anaconda/miniconda
for env_path in "${path}/envs/"*; do
if [ -d "${env_path}" ]; then
print_version "${env_path#${PYENV_ROOT}/versions/}"
fi
done
fi fi
done done
shopt -u dotglob nullglob shopt -u dotglob nullglob

View File

@@ -47,12 +47,20 @@ OLDIFS="$IFS"
IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name)}) IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name)})
IFS="$OLDIFS" IFS="$OLDIFS"
declare -a nonexistent_versions
for version in "${versions[@]}" "$system"; do for version in "${versions[@]}" "$system"; do
if [ "$version" = "system" ]; then if [ "$version" = "system" ]; then
PATH="$(remove_from_path "${PYENV_ROOT}/shims")" PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND" || true)" PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND" || true)"
else else
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${version}/bin/${PYENV_COMMAND}" # $version may be a prefix to be resolved by pyenv-latest
version_path="$(pyenv-prefix "${version}" 2>/dev/null)" || \
{ nonexistent_versions+=("$version"); continue; }
# resolve $version for hooks
version="$(basename "$version_path")"
PYENV_COMMAND_PATH="$version_path/bin/${PYENV_COMMAND}"
unset version_path
fi fi
if [ -x "$PYENV_COMMAND_PATH" ]; then if [ -x "$PYENV_COMMAND_PATH" ]; then
break break
@@ -69,17 +77,10 @@ done
if [ -x "$PYENV_COMMAND_PATH" ]; then if [ -x "$PYENV_COMMAND_PATH" ]; then
echo "$PYENV_COMMAND_PATH" echo "$PYENV_COMMAND_PATH"
else else
any_not_installed=0 if (( ${#nonexistent_versions[@]} )); then
for version in "${versions[@]}"; do for version in "${nonexistent_versions[@]}"; do
if [ "$version" = "system" ]; then
continue
fi
if ! [ -d "${PYENV_ROOT}/versions/${version}" ]; then
echo "pyenv: version \`$version' is not installed (set by $(pyenv-version-origin))" >&2 echo "pyenv: version \`$version' is not installed (set by $(pyenv-version-origin))" >&2
any_not_installed=1 done
fi
done
if [ "$any_not_installed" = 1 ]; then
exit 1 exit 1
fi fi

View File

@@ -59,7 +59,7 @@ usage() {
definitions() { definitions() {
local query="$1" local query="$1"
python-build --definitions | $(type -P ggrep grep | head -1) -F "$query" || true python-build --definitions | $(type -P ggrep grep | head -n1) -F "$query" || true
} }
indent() { indent() {
@@ -120,8 +120,8 @@ unset VERSION_NAME
# version is specified by pyenv. Show usage instructions if a local # version is specified by pyenv. Show usage instructions if a local
# version is not specified. # version is not specified.
DEFINITIONS=("${ARGUMENTS[@]}") DEFINITIONS=("${ARGUMENTS[@]}")
[ -n "${DEFINITIONS[*]}" ] || DEFINITIONS=($(pyenv-local 2>/dev/null || true)) [[ "${#DEFINITIONS[*]}" -eq 0 ]] && DEFINITIONS=($(pyenv-local 2>/dev/null || true))
[ -n "${DEFINITIONS[*]}" ] || usage 1 >&2 [[ "${#DEFINITIONS[*]}" -eq 0 ]] && usage 1 >&2
# Define `before_install` and `after_install` functions that allow # Define `before_install` and `after_install` functions that allow
# plugin hooks to register a string of code for execution before or # plugin hooks to register a string of code for execution before or
@@ -151,7 +151,10 @@ IFS=$'\n' scripts=(`pyenv-hooks install`)
IFS="$OLDIFS" IFS="$OLDIFS"
for script in "${scripts[@]}"; do source "$script"; done for script in "${scripts[@]}"; do source "$script"; done
for DEFINITION in "${DEFINITIONS[@]}";do COMBINED_STATUS=0
for DEFINITION in "${DEFINITIONS[@]}"; do
STATUS=0
# Try to resolve a prefix if user indeed gave a prefix. # Try to resolve a prefix if user indeed gave a prefix.
# We install the version under the resolved name # We install the version under the resolved name
# and hooks also see the resolved name # and hooks also see the resolved name
@@ -173,7 +176,7 @@ for DEFINITION in "${DEFINITIONS[@]}";do
case "$REPLY" in case "$REPLY" in
y | Y | yes | YES ) ;; y | Y | yes | YES ) ;;
* ) exit 1 ;; * ) { STATUS=1; [[ $STATUS -gt $COMBINED_STATUS ]] && COMBINED_STATUS=$STATUS; }; continue ;;
esac esac
elif [ -n "$SKIP_EXISTING" ]; then elif [ -n "$SKIP_EXISTING" ]; then
# Since we know the python version is already installed, and are opting to # Since we know the python version is already installed, and are opting to
@@ -247,8 +250,8 @@ for DEFINITION in "${DEFINITIONS[@]}";do
for hook in "${before_hooks[@]}"; do eval "$hook"; done for hook in "${before_hooks[@]}"; do eval "$hook"; done
# Invoke `python-build` and record the exit status in $STATUS. # Invoke `python-build` and record the exit status in $STATUS.
STATUS=0 python-build $KEEP $VERBOSE $HAS_PATCH $DEBUG "$DEFINITION" "$PREFIX" || \
python-build $KEEP $VERBOSE $HAS_PATCH $DEBUG "$DEFINITION" "$PREFIX" || STATUS="$?" { STATUS=$?; [[ $STATUS -gt $COMBINED_STATUS ]] && COMBINED_STATUS=$STATUS; }
# Display a more helpful message if the definition wasn't found. # Display a more helpful message if the definition wasn't found.
if [ "$STATUS" == "2" ]; then if [ "$STATUS" == "2" ]; then
@@ -279,13 +282,14 @@ for DEFINITION in "${DEFINITIONS[@]}";do
for hook in "${after_hooks[@]}"; do eval "$hook"; done for hook in "${after_hooks[@]}"; do eval "$hook"; done
# Run `pyenv-rehash` after a successful installation. # Run `pyenv-rehash` after a successful installation.
if [ "$STATUS" == "0" ]; then if [[ $STATUS -eq 0 ]]; then
pyenv-rehash pyenv-rehash
else else
break
cleanup cleanup
break
fi fi
done done
exit "${STATUS:-0}"
exit "${COMBINED_STATUS}"

View File

@@ -58,7 +58,7 @@ lib "$1"
resolve_link() { resolve_link() {
$(type -P greadlink readlink | head -1) "$1" $(type -P greadlink readlink | head -n1) "$1"
} }
abs_dirname() { abs_dirname() {
@@ -102,7 +102,7 @@ os_information() {
source /etc/os-release source /etc/os-release
echo "$NAME" $VERSION_ID echo "$NAME" $VERSION_ID
else else
local os="$(cat /etc/{centos,redhat,fedora,system}-release /etc/debian_version 2>/dev/null | head -1)" local os="$(cat /etc/{centos,redhat,fedora,system}-release /etc/debian_version 2>/dev/null | head -n1)"
echo "${os:-$(uname -sr)}" echo "${os:-$(uname -sr)}"
fi fi
} }
@@ -256,7 +256,7 @@ compute_sha2() {
output="$(shasum -a 256 -b)" || return 1 output="$(shasum -a 256 -b)" || return 1
echo "${output% *}" echo "${output% *}"
elif type openssl &>/dev/null; then elif type openssl &>/dev/null; then
local openssl="$(command -v "$(brew --prefix openssl 2>/dev/null || true)"/bin/openssl openssl | head -1)" local openssl="$(command -v "$(brew --prefix openssl 2>/dev/null || true)"/bin/openssl openssl | head -n1)"
output="$("$openssl" dgst -sha256 2>/dev/null)" || return 1 output="$("$openssl" dgst -sha256 2>/dev/null)" || return 1
echo "${output##* }" echo "${output##* }"
elif type sha256sum &>/dev/null; then elif type sha256sum &>/dev/null; then
@@ -867,7 +867,7 @@ build_package_jython() {
fix_jython_shebangs() { fix_jython_shebangs() {
# Workaround for Jython 2.7+ (#458) # Workaround for Jython 2.7+ (#458)
for file in "${PREFIX_PATH}/bin"/*; do for file in "${PREFIX_PATH}/bin"/*; do
case "$(head -1 "${file}")" in case "$(head -n1 "${file}")" in
"#!"*"/bin/jython" ) "#!"*"/bin/jython" )
sed -i.bak "1 s:.*:#\!${PREFIX_PATH}\/bin\/jython:" "${file}" sed -i.bak "1 s:.*:#\!${PREFIX_PATH}\/bin\/jython:" "${file}"
;; ;;
@@ -1144,7 +1144,7 @@ fix_directory_permissions() {
} }
require_java7() { require_java7() {
local version="$(java -version 2>&1 | grep '\(java\|openjdk\) version' | head -1)" local version="$(java -version 2>&1 | grep '\(java\|openjdk\) version' | head -n1)"
if [[ $version != *[789]* ]]; then if [[ $version != *[789]* ]]; then
colorize 1 "ERROR" >&3 colorize 1 "ERROR" >&3
echo ": Java 7 required. Please install a 1.7-compatible JRE." >&3 echo ": Java 7 required. Please install a 1.7-compatible JRE." >&3
@@ -1199,7 +1199,7 @@ require_gcc() {
export CC="$gcc" export CC="$gcc"
if is_mac -ge 1010; then if is_mac -ge 1010; then
export MACOSX_DEPLOYMENT_TARGET=10.9 export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-10.9}
fi fi
} }
@@ -1587,7 +1587,7 @@ build_package_verify_openssl() {
RbConfig::CONFIG.fetch("configure_args").shellsplit.each { |arg| $stderr.puts " #{arg}" } RbConfig::CONFIG.fetch("configure_args").shellsplit.each { |arg| $stderr.puts " #{arg}" }
exit 1 exit 1
end end
' "$(basename "$(type -P yum apt-get | head -1)")" >&4 2>&1 ' "$(basename "$(type -P yum apt-get | head -n1)")" >&4 2>&1
} }
use_homebrew_zlib() { use_homebrew_zlib() {
@@ -1742,9 +1742,9 @@ apply_patch() {
build_package_symlink_version_suffix() { build_package_symlink_version_suffix() {
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then if [[ "${PYTHON_CONFIGURE_OPTS_ARRAY[*]} $CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
if [ -e "${PREFIX_PATH}/bin" ]; then if [ -e "${PREFIX_PATH}/bin" ]; then
# Always create `bin` as symlink to framework path if the version was built with `--enable-frameowrk` (#590) # Always create `bin` as symlink to framework path if the version was built with `--enable-framework` (#590)
rm -rf "${PREFIX_PATH}/bin.orig" rm -rf "${PREFIX_PATH}/bin.orig"
mv -f "${PREFIX_PATH}/bin" "${PREFIX_PATH}/bin.orig" mv -f "${PREFIX_PATH}/bin" "${PREFIX_PATH}/bin.orig"
fi fi
@@ -2208,8 +2208,8 @@ package_option python configure --libdir="${PREFIX_PATH}/lib"
# python-build: Set `RPATH` if `--enable-shared` was given (#65, #66, #82) # python-build: Set `RPATH` if `--enable-shared` was given (#65, #66, #82)
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS ${PYTHON_CONFIGURE_OPTS_ARRAY[@]}" == *"--enable-shared"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS ${PYTHON_CONFIGURE_OPTS_ARRAY[@]}" == *"--enable-shared"* ]]; then
# The ld on Darwin embeds the full paths to each dylib by default # The ld on Darwin embeds the full paths to each dylib by default
if [[ "$LDFLAGS" != *"-rpath="* ]] && ! is_mac; then if [[ "$LDFLAGS" != *"-rpath="* ]] ; then
export LDFLAGS="-Wl,-rpath=${PREFIX_PATH}/lib${LDFLAGS:+ $LDFLAGS}" export LDFLAGS="-Wl,-rpath,${PREFIX_PATH}/lib${LDFLAGS:+ $LDFLAGS}"
fi fi
fi fi
@@ -2219,6 +2219,7 @@ if [[ "$PYPY_OPTS" == *"--shared"* ]]; then
fi fi
# Add support for framework installation (`--enable-framework`) of CPython (#55, #99) # Add support for framework installation (`--enable-framework`) of CPython (#55, #99)
shopt -s extglob
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
if ! is_mac; then if ! is_mac; then
echo "python-build: framework installation is not supported outside of MacOS." >&2 echo "python-build: framework installation is not supported outside of MacOS." >&2
@@ -2237,15 +2238,29 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; the
create_framework_dirs "${DEFINITION_PATH##*/}" create_framework_dirs "${DEFINITION_PATH##*/}"
# the `/Library/Frameworks` suffix makes CPython build install apps under prefix rather than into /Applications (#1003) # the `/Library/Frameworks` suffix makes CPython build install apps under prefix rather than into /Applications (#1003)
package_option python configure --enable-framework="${PREFIX_PATH}/Library/Frameworks" package_option python configure --enable-framework="${PREFIX_PATH}/Library/Frameworks"
#FIXME: doesn't properly handle paths with spaces. Fix by parsing *OPTS into arrays.
CONFIGURE_OPTS="${CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}";
CONFIGURE_OPTS="${CONFIGURE_OPTS% }"
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-framework?(=*([^ ]))?( )/}";
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }"
fi fi
shopt -u extglob
# Build against universal SDK # Build against universal SDK
shopt -s extglob
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then
if ! is_mac; then if ! is_mac; then
echo "python-build: universal installation is not supported outside of MacOS." >&2 echo "python-build: universal installation is not supported outside of MacOS." >&2
exit 1 exit 1
fi fi
package_option python configure --enable-universalsdk=/ package_option python configure --enable-universalsdk=/
#FIXME: doesn't properly handle paths with spaces. Fix by parsing *OPTS into arrays.
CONFIGURE_OPTS="${CONFIGURE_OPTS//--enable-universalsdk?(=*([^ ]))?( )/}"
CONFIGURE_OPTS="${CONFIGURE_OPTS% }"
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS//--enable-universalsdk?(=*([^ ]))?( )/}"
PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS% }"
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" != *"--with-universal-archs"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" != *"--with-universal-archs"* ]]; then
# in CPython's configure.ac, --with-universal-archs defaults to 'intel' which means i386 + x86_64 # in CPython's configure.ac, --with-universal-archs defaults to 'intel' which means i386 + x86_64
# since 2.7.5 and 3.3.0 -- i.e. in all non-EOL versions # since 2.7.5 and 3.3.0 -- i.e. in all non-EOL versions
@@ -2255,6 +2270,7 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]];
fi fi
fi fi
fi fi
shopt -u extglob
# Compile with `--enable-unicode=ucs4` by default (#257) # Compile with `--enable-unicode=ucs4` by default (#257)
if [[ "$PYTHON_CONFIGURE_OPTS" != *"--enable-unicode="* ]]; then if [[ "$PYTHON_CONFIGURE_OPTS" != *"--enable-unicode="* ]]; then

View File

@@ -200,7 +200,7 @@ class CondaVersion(NamedTuple):
return PyVersion.PY37 return PyVersion.PY37
return PyVersion.PY36 return PyVersion.PY36
raise ValueError(flavor) raise ValueError(self.flavor)
class CondaSpec(NamedTuple): class CondaSpec(NamedTuple):

View File

@@ -0,0 +1,9 @@
prefer_openssl11
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1o" "https://www.openssl.org/source/openssl-1.1.1o.tar.gz#9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.10.10" "https://www.python.org/ftp/python/3.10.10/Python-3.10.10.tar.xz#0419e9085bf51b7a672009b3f50dbf1859acdf18ba725d0ec19aa5c8503f0ea3" standard verify_py310 copy_python_gdb ensurepip
else
install_package "Python-3.10.10" "https://www.python.org/ftp/python/3.10.10/Python-3.10.10.tgz#fba64559dde21ebdc953e4565e731573bb61159de8e4d4cedee70fb1196f610d" standard verify_py310 copy_python_gdb ensurepip
fi

View File

@@ -0,0 +1,10 @@
prefer_openssl11
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
export PYTHON_BUILD_TCLTK_USE_PKGCONFIG=1
install_package "openssl-1.1.1s" "https://www.openssl.org/source/openssl-1.1.1s.tar.gz#c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.2" "https://ftpmirror.gnu.org/readline/readline-8.2.tar.gz#3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.11.2" "https://www.python.org/ftp/python/3.11.2/Python-3.11.2.tar.xz#29e4b8f5f1658542a8c13e2dd277358c9c48f2b2f7318652ef1675e402b9d2af" standard verify_py311 copy_python_gdb ensurepip
else
install_package "Python-3.11.2" "https://www.python.org/ftp/python/3.11.2/Python-3.11.2.tgz#2411c74bda5bbcfcddaf4531f66d1adc73f247f529aee981b029513aefdbf849" standard verify_py311 copy_python_gdb ensurepip
fi

View File

@@ -3,7 +3,7 @@ export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1s" "https://www.openssl.org/source/openssl-1.1.1s.tar.gz#c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa" mac_openssl --if has_broken_mac_openssl install_package "openssl-1.1.1s" "https://www.openssl.org/source/openssl-1.1.1s.tar.gz#c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.2" "https://ftpmirror.gnu.org/readline/readline-8.2.tar.gz#3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35" mac_readline --if has_broken_mac_readline install_package "readline-8.2" "https://ftpmirror.gnu.org/readline/readline-8.2.tar.gz#3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then if has_tar_xz_support; then
install_package "Python-3.12.0a4" "https://www.python.org/ftp/python/3.12.0/Python-3.12.0a4.tar.xz#b9176c46b1cd21dbdcb31bbbab6169faa92da9acc5f35bd4a009879ac74cf6af" standard verify_py312 copy_python_gdb ensurepip install_package "Python-3.12.0a6" "https://www.python.org/ftp/python/3.12.0/Python-3.12.0a6.tar.xz#298440252c4b6b4e120e014c15d729eaf8ab779300dcca61d422c537e4e85eca" standard verify_py312 copy_python_gdb ensurepip
else else
install_package "Python-3.12.0a4" "https://www.python.org/ftp/python/3.12.0/Python-3.12.0a4.tgz#d9d9cbebc745ecaf5cae6b4004a84692154183b729954d3a421fba3d2a541d59" standard verify_py312 copy_python_gdb ensurepip install_package "Python-3.12.0a6" "https://www.python.org/ftp/python/3.12.0/Python-3.12.0a6.tgz#9301a243da5a1982133ddf804b76ee1fe11aa98e2d3dfb09f095485eaa50edfd" standard verify_py312 copy_python_gdb ensurepip
fi fi

View File

@@ -0,0 +1,28 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py310_23.1.0-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-aarch64.sh#80d6c306b015e1e3b01ea59dc66c676a81fa30279bc2da1f180a7ef7b2191d6e" "miniconda" verify_py310
;;
"Linux-ppc64le" )
install_script "Miniconda3-py310_23.1.0-1-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-ppc64le.sh#9ca8077a0af8845fc574a120ef8d68690d7a9862d354a2a4468de5d2196f406c" "miniconda" verify_py310
;;
"Linux-s390x" )
install_script "Miniconda3-py310_23.1.0-1-Linux-s390x" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-s390x.sh#0d00a9d34c5fd17d116bf4e7c893b7441a67c7a25416ede90289d87216104a97" "miniconda" verify_py310
;;
"Linux-x86_64" )
install_script "Miniconda3-py310_23.1.0-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh#32d73e1bc33fda089d7cd9ef4c1be542616bd8e437d1f77afeeaf7afdb019787" "miniconda" verify_py310
;;
"MacOSX-arm64" )
install_script "Miniconda3-py310_23.1.0-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-MacOSX-arm64.sh#cc5bcf95d5db0f7f454b2d800d52da8b70563f8454d529e7ac2da9725650eb27" "miniconda" verify_py310
;;
"MacOSX-x86_64" )
install_script "Miniconda3-py310_23.1.0-1-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-MacOSX-x86_64.sh#bfb81814e16eb450b1dbde7b4ecb9ebc5186834cb4ede5926c699762ca69953b" "miniconda" verify_py310
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,25 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py37_23.1.0-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py37_23.1.0-1-Linux-aarch64.sh#31c1d635fae931b7c0687018cc87e918e8098ed5dd5e76a658e10c57e00ef864" "miniconda" verify_py37
;;
"Linux-ppc64le" )
install_script "Miniconda3-py37_23.1.0-1-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda3-py37_23.1.0-1-Linux-ppc64le.sh#d2de534bfa46aa34ef0b115a309de7e8a681683af65faf86bcee6a00460f07be" "miniconda" verify_py37
;;
"Linux-s390x" )
install_script "Miniconda3-py37_23.1.0-1-Linux-s390x" "https://repo.anaconda.com/miniconda/Miniconda3-py37_23.1.0-1-Linux-s390x.sh#72a8fa9aca5abaf99771110746b1345a33d390c9b29a7b4daffe6a2ff00f2366" "miniconda" verify_py37
;;
"Linux-x86_64" )
install_script "Miniconda3-py37_23.1.0-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py37_23.1.0-1-Linux-x86_64.sh#fc96109ea96493e31f70abbc5cae58e80634480c0686ab46924549ac41176812" "miniconda" verify_py37
;;
"MacOSX-x86_64" )
install_script "Miniconda3-py37_23.1.0-1-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py37_23.1.0-1-MacOSX-x86_64.sh#bdfb2f01c0a3917bf258daffc65b69bfe07e29753be624aaf9cbda5ba02f43f4" "miniconda" verify_py37
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,28 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py38_23.1.0-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py38_23.1.0-1-Linux-aarch64.sh#10ea91cc579a64a3a88727119ac3f55839562f55118458b82824b544bc74f90d" "miniconda" verify_py38
;;
"Linux-ppc64le" )
install_script "Miniconda3-py38_23.1.0-1-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda3-py38_23.1.0-1-Linux-ppc64le.sh#d89faee2d839c7e8a2c96f3ca60295c08e837c2f134f6bb9e9e21b707babedc2" "miniconda" verify_py38
;;
"Linux-s390x" )
install_script "Miniconda3-py38_23.1.0-1-Linux-s390x" "https://repo.anaconda.com/miniconda/Miniconda3-py38_23.1.0-1-Linux-s390x.sh#3d1e06eddaef0976530c54ed7dda80df62705c16513634e58f7d1c4567227b9e" "miniconda" verify_py38
;;
"Linux-x86_64" )
install_script "Miniconda3-py38_23.1.0-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py38_23.1.0-1-Linux-x86_64.sh#640b7dceee6fad10cb7e7b54667b2945c4d6f57625d062b2b0952b7f3a908ab7" "miniconda" verify_py38
;;
"MacOSX-arm64" )
install_script "Miniconda3-py38_23.1.0-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py38_23.1.0-1-MacOSX-arm64.sh#8dfab7797151a31b16c174da9a5bc09529d5859f21e77f0655ea9b18209cc926" "miniconda" verify_py38
;;
"MacOSX-x86_64" )
install_script "Miniconda3-py38_23.1.0-1-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py38_23.1.0-1-MacOSX-x86_64.sh#5d789cda38b23245ffed6b88c60b7479d984bbf20e3b70d66cd150f04a9c25c5" "miniconda" verify_py38
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,28 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-aarch64" )
install_script "Miniconda3-py39_23.1.0-1-Linux-aarch64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_23.1.0-1-Linux-aarch64.sh#5e67416a574c49e19dc21d5b9ed586400863a685bc4e34b4d933ea8c7c1ed2da" "miniconda" verify_py39
;;
"Linux-ppc64le" )
install_script "Miniconda3-py39_23.1.0-1-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda3-py39_23.1.0-1-Linux-ppc64le.sh#cf5d7cad2b0eb260903b3661ee3fa822eecb25cf3c9b14bc9de10d72963d3d5a" "miniconda" verify_py39
;;
"Linux-s390x" )
install_script "Miniconda3-py39_23.1.0-1-Linux-s390x" "https://repo.anaconda.com/miniconda/Miniconda3-py39_23.1.0-1-Linux-s390x.sh#5159322f15d9e2b22b3cf90fe88b336d84f62189178c872a9288a339d86f5d20" "miniconda" verify_py39
;;
"Linux-x86_64" )
install_script "Miniconda3-py39_23.1.0-1-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_23.1.0-1-Linux-x86_64.sh#5dc619babc1d19d6688617966251a38d245cb93d69066ccde9a013e1ebb5bf18" "miniconda" verify_py39
;;
"MacOSX-arm64" )
install_script "Miniconda3-py39_23.1.0-1-MacOSX-arm64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_23.1.0-1-MacOSX-arm64.sh#a7133a703e41ea0b1738196fb03f72b22250327adea94521c9dd6100c304dc63" "miniconda" verify_py39
;;
"MacOSX-x86_64" )
install_script "Miniconda3-py39_23.1.0-1-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_23.1.0-1-MacOSX-x86_64.sh#d78eaac94f85bacbc704f629bdfbc2cd42a72dc3a4fd383a3bfc80997495320e" "miniconda" verify_py39
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Miniconda is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,5 @@
prefer_openssl11
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1l" "https://www.openssl.org/source/openssl-1.1.1l.tar.gz#0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.1" "https://ftpmirror.gnu.org/readline/readline-8.1.tar.gz#f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02" mac_readline --if has_broken_mac_readline
install_package "nogil-3.9.10-1" "https://github.com/colesbury/nogil/archive/refs/tags/v3.9.10-nogil-2023-01-22.tar.gz#cbda308c7586745573d665cd53d71b50707fd6f85c1c5d7a9f5b092e869cc757" standard verify_py39 copy_python_gdb ensurepip

View File

@@ -0,0 +1,43 @@
From 112cceb514e79b4c9805f9e5ea037a205be428da Mon Sep 17 00:00:00 2001
From: Inada Naoki <songofacandy@gmail.com>
Date: Tue, 14 May 2019 18:51:15 +0900
Subject: [PATCH 1/2] bpo-27987: pymalloc: align by 16bytes on 64bit platform
(GH-12850)
---
.../2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst | 3 +++
Objects/obmalloc.c | 6 ++++++
2 files changed, 9 insertions(+)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst
new file mode 100644
index 0000000000..b0f32a5c6c
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst
@@ -0,0 +1,3 @@
+pymalloc returns memory blocks aligned by 16 bytes, instead of 8 bytes, on
+64-bit platforms to conform x86-64 ABI. Recent compilers assume this alignment
+more often. Patch by Inada Naoki.
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 9dd8421a33..da9029c4a6 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -540,8 +540,14 @@ static int running_on_valgrind = -1;
*
* You shouldn't change this unless you know what you are doing.
*/
+
+#if SIZEOF_VOID_P > 4
+#define ALIGNMENT 16 /* must be 2^N */
+#define ALIGNMENT_SHIFT 4
+#else
#define ALIGNMENT 8 /* must be 2^N */
#define ALIGNMENT_SHIFT 3
+#endif
/* Return the number of bytes in size class I, as a uint. */
#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)
--
2.38.4

View File

@@ -0,0 +1,40 @@
From 618ef35426ecc57da1bee50f8dc5896f5fb178a9 Mon Sep 17 00:00:00 2001
From: Inada Naoki <songofacandy@gmail.com>
Date: Sat, 25 May 2019 21:13:33 +0900
Subject: [PATCH 2/2] bpo-27987: align PyGC_Head to alignof(long double)
(GH-13335)
---
Include/objimpl.h | 6 +++++-
.../2019-05-15-18-28-43.bpo-27987.FaxuLy.rst | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 65b6d91c36..eaf57975c8 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -250,7 +250,11 @@ typedef union _gc_head {
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- double dummy; /* force worst-case alignment */
+ long double dummy; /* force worst-case alignment */
+ // malloc returns memory block aligned for any built-in types and
+ // long double is the largest standard C type.
+ // On amd64 linux, long double requires 16 byte alignment.
+ // See bpo-27987 for more discussion.
} PyGC_Head;
extern PyGC_Head *_PyGC_generation0;
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
new file mode 100644
index 0000000000..97ca37b262
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
@@ -0,0 +1,2 @@
+``PyGC_Head`` structure is aligned to ``long double``. This is needed to
+GC-ed objects are aligned properly. Patch by Inada Naoki.
--
2.38.4

View File

@@ -0,0 +1,86 @@
From 655f26bb742d6bd32c388e9fea14b64eb25fd4de Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Tue, 15 Mar 2022 03:18:39 -0400
Subject: [PATCH] bpo-45405: Prevent internal configure error when running
configure with recent versions of clang. (GH-28845) (GH-31890)
Change the configure logic to function properly on macOS when the compiler
outputs a platform triplet for option --print-multiarch.
The Apple Clang included with Xcode 13.3 now supports --print-multiarch
causing configure to fail without this change.
Co-authored-by: Ned Deily <nad@python.org>
(cherry picked from commit 9c4766772cda67648184f8ddba546a5fc0167f91)
Co-authored-by: David Bohman <debohman@gmail.com>
(cherry picked from commit 720bb456dc711b0776bae837d1f9a0b10c28ddf2)
---
.../next/Build/2021-10-11-16-27-38.bpo-45405.iSfdW5.rst | 2 ++
configure | 8 +++++---
configure.ac | 8 +++++---
3 files changed, 12 insertions(+), 6 deletions(-)
create mode 100644 Misc/NEWS.d/next/Build/2021-10-11-16-27-38.bpo-45405.iSfdW5.rst
diff --git a/Misc/NEWS.d/next/Build/2021-10-11-16-27-38.bpo-45405.iSfdW5.rst b/Misc/NEWS.d/next/Build/2021-10-11-16-27-38.bpo-45405.iSfdW5.rst
new file mode 100644
index 0000000000..13c93d1b8a
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2021-10-11-16-27-38.bpo-45405.iSfdW5.rst
@@ -0,0 +1,2 @@
+Prevent ``internal configure error`` when running ``configure``
+with recent versions of clang. Patch by David Bohman.
diff --git a/configure b/configure
index fb0a499145..67e6e69b5f 100755
--- a/configure
+++ b/configure
@@ -5203,9 +5203,6 @@ $as_echo "$as_me:
fi
-MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5
$as_echo_n "checking for the platform triplet based on compiler characteristics... " >&6; }
cat >> conftest.c <<EOF
@@ -5334,6 +5331,11 @@ $as_echo "none" >&6; }
fi
rm -f conftest.c conftest.out
+if test x$PLATFORM_TRIPLET != xdarwin; then
+ MULTIARCH=$($CC --print-multiarch 2>/dev/null)
+fi
+
+
if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
as_fn_error $? "internal configure error for the platform triplet, please file a bug report" "$LINENO" 5
diff --git a/configure.ac b/configure.ac
index d86dad9a7c..468ad6070f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -747,9 +747,6 @@ then
fi
-MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-AC_SUBST(MULTIARCH)
-
AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
cat >> conftest.c <<EOF
#undef bfin
@@ -875,6 +872,11 @@ else
fi
rm -f conftest.c conftest.out
+if test x$PLATFORM_TRIPLET != xdarwin; then
+ MULTIARCH=$($CC --print-multiarch 2>/dev/null)
+fi
+AC_SUBST(MULTIARCH)
+
if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
--
2.32.0 (Apple Git-132)

View File

@@ -0,0 +1,41 @@
From 002501946bad91a308f37a09204393c172f03c3e Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 16:50:14 +0900
Subject: [PATCH 2/6] Detect arm64 in configure
---
configure | 3 +++
configure.ac | 3 +++
2 files changed, 6 insertions(+)
diff --git a/configure b/configure
index e39c16eee2..8dc1fc7595 100755
--- a/configure
+++ b/configure
@@ -9230,6 +9230,9 @@ fi
ppc)
MACOSX_DEFAULT_ARCH="ppc64"
;;
+ arm64)
+ MACOSX_DEFAULT_ARCH="arm64"
+ ;;
*)
as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
;;
diff --git a/configure.ac b/configure.ac
index cf280506bd..34846a7df3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2435,6 +2435,9 @@ case $ac_sys_system/$ac_sys_release in
ppc)
MACOSX_DEFAULT_ARCH="ppc64"
;;
+ arm64)
+ MACOSX_DEFAULT_ARCH="arm64"
+ ;;
*)
AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
;;
--
2.30.1 (Apple Git-130)

View File

@@ -0,0 +1,48 @@
From 8ea6353f60625c96ce96588c70ff24a77f8c71f9 Mon Sep 17 00:00:00 2001
From: Ronald Oussoren <ronaldoussoren@mac.com>
Date: Thu, 25 Jun 2020 16:55:48 +0200
Subject: [PATCH] BPO-41100: Support macOS 11 when building (GH-21113)
---
Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst | 1 +
configure | 2 +-
configure.ac | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
diff --git a/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst b/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
new file mode 100644
index 0000000000..ded66b567a
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
@@ -0,0 +1 @@
+Support macOS 11 when building.
diff --git a/configure b/configure
index c51f396824..5024860ca4 100755
--- a/configure
+++ b/configure
@@ -3375,7 +3375,7 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h
# has no effect, don't bother defining them
Darwin/[6789].*)
define_xopen_source=no;;
- Darwin/1[0-9].*)
+ Darwin/[12][0-9].*)
define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
diff --git a/configure.ac b/configure.ac
index 70deefb6b9..5a3e340aa3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -495,7 +495,7 @@ case $ac_sys_system/$ac_sys_release in
# has no effect, don't bother defining them
Darwin/@<:@6789@:>@.*)
define_xopen_source=no;;
- Darwin/1@<:@0-9@:>@.*)
+ Darwin/@<:@[12]@:>@@<:@0-9@:>@.*)
define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
--
2.30.1 (Apple Git-130)

View File

@@ -0,0 +1,37 @@
From 604d95e235d86465b8c17f02095edcaf18464d4c Mon Sep 17 00:00:00 2001
From: Lawrence D'Anna <64555057+lawrence-danna-apple@users.noreply.github.com>
Date: Tue, 30 Jun 2020 02:15:46 -0700
Subject: [PATCH] bpo-41100: fix _decimal for arm64 Mac OS (GH-21228)
Patch by Lawrence Danna.
---
.../Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst | 1 +
Modules/_decimal/libmpdec/mpdecimal.h | 3 +++
2 files changed, 4 insertions(+)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst
new file mode 100644
index 0000000000..d6176d69f0
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst
@@ -0,0 +1 @@
+add arm64 to the allowable Mac OS arches in mpdecimal.h
\ No newline at end of file
diff --git a/Modules/_decimal/libmpdec/mpdecimal.h b/Modules/_decimal/libmpdec/mpdecimal.h
index 108b76efa8..35ce429f60 100644
--- a/Modules/_decimal/libmpdec/mpdecimal.h
+++ b/Modules/_decimal/libmpdec/mpdecimal.h
@@ -135,6 +135,9 @@ const char *mpd_version(void);
#elif defined(__x86_64__)
#define CONFIG_64
#define ASM
+ #elif defined(__arm64__)
+ #define CONFIG_64
+ #define ANSI
#else
#error "unknown architecture for universal build."
#endif
--
2.30.1 (Apple Git-130)

View File

@@ -0,0 +1,132 @@
From 409b4ecef88643996ce00482b650c0246a977a4b Mon Sep 17 00:00:00 2001
From: Chaim Halbert <chaim.leib.halbert@gmail.com>
Date: Sun, 26 Feb 2023 06:21:54 -0700
Subject: [PATCH] Port ctypes and system libffi patch for arm64/macOS 10.15+ to
Python 3.5.10
This backports the following ctypes and libffi pyenv patch for Python
3.6.15 to Python 3.5.10:
* `0004-Port-ctypes-and-system-libffi-patches-for-arm64-macO.patch`
This patch enables use of system libffi (fixing a broken `ctypes` module
on arm64 targets) and enables calling variadic functions on arm64.
---
setup.py | 65 +++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 50 insertions(+), 15 deletions(-)
diff --git a/setup.py b/setup.py
index 2944c9dd6f..ab8065866f 100644
--- a/setup.py
+++ b/setup.py
@@ -73,6 +73,13 @@ def macosx_sdk_root():
sysroot = m.group(1)
return sysroot
+def is_macosx_at_least(vers):
+ if host_platform == 'darwin':
+ dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+ if dep_target:
+ return tuple(map(int, str(dep_target).split('.'))) >= vers
+ return False
+
def is_macosx_sdk_path(path):
"""
Returns True if 'path' can be located in an OSX SDK
@@ -81,6 +88,13 @@ def is_macosx_sdk_path(path):
or path.startswith('/System/')
or path.startswith('/Library/') )
+def grep_headers_for(function, headers):
+ for header in headers:
+ with open(header, 'r') as f:
+ if function in f.read():
+ return True
+ return False
+
def find_file(filename, std_dirs, paths):
"""Searches for the directory where a given file is located,
and returns a possibly-empty list of additional directories, or None
@@ -1939,7 +1953,11 @@ class PyBuildExt(build_ext):
return True
def detect_ctypes(self, inc_dirs, lib_dirs):
- self.use_system_libffi = False
+ if not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and is_macosx_at_least((10,15)):
+ self.use_system_libffi = True
+ else:
+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")
+
include_dirs = []
extra_compile_args = []
extra_link_args = []
@@ -1986,19 +2004,29 @@ class PyBuildExt(build_ext):
libraries=math_libs)
self.extensions.extend([ext, ext_test])
- if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
- return
+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
+ ffi_lib = None
if host_platform == 'darwin':
- # OS X 10.5 comes with libffi.dylib; the include files are
- # in /usr/include/ffi
- inc_dirs.append('/usr/include/ffi')
-
- ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
- if not ffi_inc or ffi_inc[0] == '':
- ffi_inc = find_file('ffi.h', [], inc_dirs)
- if ffi_inc is not None:
- ffi_h = ffi_inc[0] + '/ffi.h'
+ if not self.use_system_libffi:
+ return
+ ffi_in_sdk = os.path.join(macosx_sdk_root(), "usr/include/ffi")
+ if os.path.exists(ffi_in_sdk):
+ ffi_inc = ffi_in_sdk
+ ffi_lib = 'ffi'
+ else:
+ # OS X 10.5 comes with libffi.dylib; the include files are
+ # in /usr/include/ffi
+ inc_dirs.append('/usr/include/ffi')
+ elif '--without-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
+ return
+
+ if not ffi_inc:
+ found = find_file('ffi.h', [], inc_dirs)
+ if found:
+ ffi_inc = found[0]
+ if ffi_inc:
+ ffi_h = ffi_inc + '/ffi.h'
with open(ffi_h) as f:
for line in f:
line = line.strip()
@@ -2009,15 +2037,22 @@ class PyBuildExt(build_ext):
ffi_inc = None
print('Header file {} does not define LIBFFI_H or '
'ffi_wrapper_h'.format(ffi_h))
- ffi_lib = None
- if ffi_inc is not None:
+ if ffi_lib is None and ffi_inc is not None:
for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'):
if (self.compiler.find_library_file(lib_dirs, lib_name)):
ffi_lib = lib_name
break
if ffi_inc and ffi_lib:
- ext.include_dirs.extend(ffi_inc)
+ ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
+ if grep_headers_for('ffi_closure_alloc', ffi_headers):
+ try:
+ sources.remove('_ctypes/malloc_closure.c')
+ except ValueError:
+ pass
+ if grep_headers_for('ffi_prep_cif_var', ffi_headers):
+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
+ ext.include_dirs.append(ffi_inc)
ext.libraries.append(ffi_lib)
self.use_system_libffi = True
--
2.39.2

View File

@@ -0,0 +1,93 @@
From c7302116573d853d3181133477d9d0e4d4d3abfd Mon Sep 17 00:00:00 2001
From: Ned Deily <nad@python.org>
Date: Tue, 18 Jun 2019 16:28:13 -0400
Subject: [PATCH] bpo-36231: Support building on macOS without /usr/include
(GH-13773) (GH-14208)
---
.../2019-06-03-05-49-49.bpo-36231.RfmW_p.rst | 3 ++
setup.py | 53 ++++++++++++++++---
2 files changed, 49 insertions(+), 7 deletions(-)
create mode 100644 Misc/NEWS.d/next/macOS/2019-06-03-05-49-49.bpo-36231.RfmW_p.rst
diff --git a/Misc/NEWS.d/next/macOS/2019-06-03-05-49-49.bpo-36231.RfmW_p.rst b/Misc/NEWS.d/next/macOS/2019-06-03-05-49-49.bpo-36231.RfmW_p.rst
new file mode 100644
index 0000000000..c82e54c12c
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2019-06-03-05-49-49.bpo-36231.RfmW_p.rst
@@ -0,0 +1,3 @@
+Support building Python on macOS without /usr/include installed. As of macOS
+10.14, system header files are only available within an SDK provided by
+either the Command Line Tools or the Xcode app.
diff --git a/setup.py b/setup.py
index bcc4bfa89d..5e0cd02430 100644
--- a/setup.py
+++ b/setup.py
@@ -90,18 +90,57 @@ def sysroot_paths(make_vars, subdirs):
break
return dirs
+MACOS_SDK_ROOT = None
+
def macosx_sdk_root():
+ """Return the directory of the current macOS SDK.
+
+ If no SDK was explicitly configured, call the compiler to find which
+ include files paths are being searched by default. Use '/' if the
+ compiler is searching /usr/include (meaning system header files are
+ installed) or use the root of an SDK if that is being searched.
+ (The SDK may be supplied via Xcode or via the Command Line Tools).
+ The SDK paths used by Apple-supplied tool chains depend on the
+ setting of various variables; see the xcrun man page for more info.
"""
- Return the directory of the current OSX SDK,
- or '/' if no SDK was specified.
- """
+ global MACOS_SDK_ROOT
+
+ # If already called, return cached result.
+ if MACOS_SDK_ROOT:
+ return MACOS_SDK_ROOT
+
cflags = sysconfig.get_config_var('CFLAGS')
m = re.search(r'-isysroot\s+(\S+)', cflags)
- if m is None:
- sysroot = '/'
+ if m is not None:
+ MACOS_SDK_ROOT = m.group(1)
else:
- sysroot = m.group(1)
- return sysroot
+ MACOS_SDK_ROOT = '/'
+ cc = sysconfig.get_config_var('CC')
+ tmpfile = '/tmp/setup_sdk_root.%d' % os.getpid()
+ try:
+ os.unlink(tmpfile)
+ except:
+ pass
+ ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile))
+ in_incdirs = False
+ try:
+ if ret >> 8 == 0:
+ with open(tmpfile) as fp:
+ for line in fp.readlines():
+ if line.startswith("#include <...>"):
+ in_incdirs = True
+ elif line.startswith("End of search list"):
+ in_incdirs = False
+ elif in_incdirs:
+ line = line.strip()
+ if line == '/usr/include':
+ MACOS_SDK_ROOT = '/'
+ elif line.endswith(".sdk/usr/include"):
+ MACOS_SDK_ROOT = line[:-12]
+ finally:
+ os.unlink(tmpfile)
+
+ return MACOS_SDK_ROOT
def is_macosx_sdk_path(path):
"""
--
2.30.1 (Apple Git-130)

View File

@@ -0,0 +1,43 @@
From 54dc627769bf112b0181972a52c4b45e4a02da57 Mon Sep 17 00:00:00 2001
From: Inada Naoki <songofacandy@gmail.com>
Date: Tue, 14 May 2019 18:51:15 +0900
Subject: [PATCH 09/10] bpo-27987: pymalloc: align by 16bytes on 64bit platform
(GH-12850)
---
.../2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst | 3 +++
Objects/obmalloc.c | 6 ++++++
2 files changed, 9 insertions(+)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst
new file mode 100644
index 0000000000..b0f32a5c6c
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-11-52-21.bpo-27987.n2_DcQ.rst
@@ -0,0 +1,3 @@
+pymalloc returns memory blocks aligned by 16 bytes, instead of 8 bytes, on
+64-bit platforms to conform x86-64 ABI. Recent compilers assume this alignment
+more often. Patch by Inada Naoki.
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index d46d149311..47283354f4 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -650,8 +650,14 @@ static int running_on_valgrind = -1;
*
* You shouldn't change this unless you know what you are doing.
*/
+
+#if SIZEOF_VOID_P > 4
+#define ALIGNMENT 16 /* must be 2^N */
+#define ALIGNMENT_SHIFT 4
+#else
#define ALIGNMENT 8 /* must be 2^N */
#define ALIGNMENT_SHIFT 3
+#endif
/* Return the number of bytes in size class I, as a uint. */
#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)
--
2.38.4

View File

@@ -0,0 +1,40 @@
From e68ff170dc6764b22886e703f583fb53e90367ef Mon Sep 17 00:00:00 2001
From: Inada Naoki <songofacandy@gmail.com>
Date: Sat, 25 May 2019 21:13:33 +0900
Subject: [PATCH 10/10] bpo-27987: align PyGC_Head to alignof(long double)
(GH-13335)
---
Include/objimpl.h | 6 +++++-
.../2019-05-15-18-28-43.bpo-27987.FaxuLy.rst | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
diff --git a/Include/objimpl.h b/Include/objimpl.h
index e7a3696d7a..90d71b87ea 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -255,7 +255,11 @@ typedef union _gc_head {
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- double dummy; /* force worst-case alignment */
+ long double dummy; /* force worst-case alignment */
+ // malloc returns memory block aligned for any built-in types and
+ // long double is the largest standard C type.
+ // On amd64 linux, long double requires 16 byte alignment.
+ // See bpo-27987 for more discussion.
} PyGC_Head;
extern PyGC_Head *_PyGC_generation0;
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
new file mode 100644
index 0000000000..97ca37b262
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-05-15-18-28-43.bpo-27987.FaxuLy.rst
@@ -0,0 +1,2 @@
+``PyGC_Head`` structure is aligned to ``long double``. This is needed to
+GC-ed objects are aligned properly. Patch by Inada Naoki.
--
2.38.4

View File

@@ -62,7 +62,7 @@ assert_build_log() {
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done for i in {1..9}; do stub uname '-s : echo Linux'; done
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@@ -74,11 +74,11 @@ assert_build_log() {
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
yaml-0.1.6: --prefix=$INSTALL_ROOT yaml-0.1.6: --prefix=$INSTALL_ROOT
make -j 2 make -j 2
make install make install
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -89,7 +89,7 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done for i in {1..9}; do stub uname '-s : echo Linux'; done
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@@ -103,12 +103,12 @@ OUT
unstub patch unstub patch
assert_build_log <<OUT assert_build_log <<OUT
yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
yaml-0.1.6: --prefix=$INSTALL_ROOT yaml-0.1.6: --prefix=$INSTALL_ROOT
make -j 2 make -j 2
make install make install
patch -p0 --force -i $TMP/python-patch.XXX patch -p0 --force -i $TMP/python-patch.XXX
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -119,7 +119,7 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done for i in {1..9}; do stub uname '-s : echo Linux'; done
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@@ -133,12 +133,12 @@ OUT
unstub patch unstub patch
assert_build_log <<OUT assert_build_log <<OUT
yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
yaml-0.1.6: --prefix=$INSTALL_ROOT yaml-0.1.6: --prefix=$INSTALL_ROOT
make -j 2 make -j 2
make install make install
patch -p1 --force -i $TMP/python-patch.XXX patch -p1 --force -i $TMP/python-patch.XXX
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -151,7 +151,7 @@ OUT
BREW_PREFIX="$TMP/homebrew-prefix" BREW_PREFIX="$TMP/homebrew-prefix"
mkdir -p "$BREW_PREFIX" mkdir -p "$BREW_PREFIX"
for i in {1..9}; do stub uname '-s : echo Darwin'; done for i in {1..8}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
stub brew "--prefix : echo '$BREW_PREFIX'" false stub brew "--prefix : echo '$BREW_PREFIX'" false
stub_make_install stub_make_install
@@ -166,7 +166,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include -I$BREW_PREFIX/include" LDFLAGS="-L${TMP}/install/lib -L$BREW_PREFIX/lib -Wl,-rpath,$BREW_PREFIX/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include -I$BREW_PREFIX/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L$BREW_PREFIX/lib -Wl,-rpath,$BREW_PREFIX/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -179,7 +179,7 @@ OUT
brew_libdir="$TMP/homebrew-yaml" brew_libdir="$TMP/homebrew-yaml"
mkdir -p "$brew_libdir" mkdir -p "$brew_libdir"
for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
stub brew "--prefix libyaml : echo '$brew_libdir'" stub brew "--prefix libyaml : echo '$brew_libdir'"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@@ -194,7 +194,7 @@ OUT
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I$brew_libdir/include -I${TMP}/install/include" LDFLAGS="-L$brew_libdir/lib -L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I$brew_libdir/include -I${TMP}/install/include" LDFLAGS="-L$brew_libdir/lib -L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -205,7 +205,7 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done for i in {1..9}; do stub uname '-s : echo Linux'; done
stub brew true; brew stub brew true; brew
stub_make_install stub_make_install
stub_make_install stub_make_install
@@ -218,11 +218,11 @@ OUT
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" yaml-0.1.6: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
yaml-0.1.6: --prefix=${TMP}/install yaml-0.1.6: --prefix=${TMP}/install
make -j 2 make -j 2
make install make install
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -234,7 +234,7 @@ OUT
readline_libdir="$TMP/homebrew-readline" readline_libdir="$TMP/homebrew-readline"
mkdir -p "$readline_libdir" mkdir -p "$readline_libdir"
for i in {1..8}; do stub uname '-s : echo Darwin'; done for i in {1..7}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
for i in {1..2}; do stub brew false; done for i in {1..2}; do stub brew false; done
stub brew "--prefix readline : echo '$readline_libdir'" stub brew "--prefix readline : echo '$readline_libdir'"
@@ -252,7 +252,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I$readline_libdir/include -I${TMP}/install/include" LDFLAGS="-L$readline_libdir/lib -L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I$readline_libdir/include -I${TMP}/install/include" LDFLAGS="-L$readline_libdir/lib -L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -264,7 +264,7 @@ OUT
for lib in readline sqlite3; do for lib in readline sqlite3; do
for i in {1..8}; do stub uname '-s : echo FreeBSD'; done for i in {1..7}; do stub uname '-s : echo FreeBSD'; done
stub uname '-r : echo 11.0-RELEASE' stub uname '-r : echo 11.0-RELEASE'
for i in {1..2}; do stub uname '-s : echo FreeBSD'; done for i in {1..2}; do stub uname '-s : echo FreeBSD'; done
stub sysctl '-n hw.ncpu : echo 1' stub sysctl '-n hw.ncpu : echo 1'
@@ -286,7 +286,7 @@ DEF
unstub sysctl unstub sysctl
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include -I/usr/local/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include -I/usr/local/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 1 make -j 1
make install make install
@@ -298,7 +298,7 @@ OUT
@test "no library searches performed during normal operation touch homebrew in non-MacOS" { @test "no library searches performed during normal operation touch homebrew in non-MacOS" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..9}; do stub uname '-s : echo Linux'; done for i in {1..8}; do stub uname '-s : echo Linux'; done
stub brew true; brew stub brew true; brew
stub_make_install stub_make_install
@@ -312,7 +312,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -322,7 +322,7 @@ OUT
@test "no library searches performed during normal operation touch homebrew if envvar is set" { @test "no library searches performed during normal operation touch homebrew if envvar is set" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..5}; do stub uname '-s : echo Darwin'; done for i in {1..4}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
stub brew true; brew stub brew true; brew
stub_make_install stub_make_install
@@ -338,7 +338,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -353,7 +353,7 @@ OUT
mkdir -p "$readline_libdir/include/readline" mkdir -p "$readline_libdir/include/readline"
touch "$readline_libdir/include/readline/rlconf.h" touch "$readline_libdir/include/readline/rlconf.h"
for i in {1..8}; do stub uname '-s : echo Darwin'; done for i in {1..7}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
for i in {1..3}; do stub brew false; done for i in {1..3}; do stub brew false; done
@@ -371,7 +371,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib
make -j 2 make -j 2
make install make install
@@ -385,7 +385,7 @@ OUT
mkdir -p "$tcl_tk_libdir/lib" mkdir -p "$tcl_tk_libdir/lib"
echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh" echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh"
for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
stub brew false stub brew false
@@ -405,7 +405,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="${TMP}/homebrew-tcl-tk/lib/pkgconfig" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH="${TMP}/homebrew-tcl-tk/lib/pkgconfig"
Python-3.6.2: --prefix=${TMP}/install --enable-shared --libdir=${TMP}/install/lib --with-tcltk-libs=-L${TMP}/homebrew-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version --with-tcltk-includes=-I${TMP}/homebrew-tcl-tk/include Python-3.6.2: --prefix=${TMP}/install --enable-shared --libdir=${TMP}/install/lib --with-tcltk-libs=-L${TMP}/homebrew-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version --with-tcltk-includes=-I${TMP}/homebrew-tcl-tk/include
make -j 2 make -j 2
make install make install
@@ -419,7 +419,7 @@ OUT
tcl_tk_version_long="8.6.10" tcl_tk_version_long="8.6.10"
tcl_tk_version="${tcl_tk_version_long%.*}" tcl_tk_version="${tcl_tk_version_long%.*}"
for i in {1..9}; do stub uname '-s : echo Darwin'; done for i in {1..8}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
@@ -437,7 +437,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib --with-tcltk-libs=-L${TMP}/custom-tcl-tk/lib -ltcl8.6 -ltk8.6 Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib --with-tcltk-libs=-L${TMP}/custom-tcl-tk/lib -ltcl8.6 -ltk8.6
make -j 2 make -j 2
make install make install
@@ -447,7 +447,7 @@ OUT
@test "tcl-tk is linked from Homebrew via pkgconfig only when envvar is set" { @test "tcl-tk is linked from Homebrew via pkgconfig only when envvar is set" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
tcl_tk_libdir="$TMP/homebrew-tcl-tk" tcl_tk_libdir="$TMP/homebrew-tcl-tk"
@@ -471,7 +471,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="${TMP}/homebrew-tcl-tk/lib/pkgconfig" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH="${TMP}/homebrew-tcl-tk/lib/pkgconfig"
Python-3.6.2: --prefix=${TMP}/install --enable-shared --libdir=${TMP}/install/lib Python-3.6.2: --prefix=${TMP}/install --enable-shared --libdir=${TMP}/install/lib
make -j 2 make -j 2
make install make install
@@ -480,7 +480,7 @@ OUT
@test "number of CPU cores defaults to 2" { @test "number of CPU cores defaults to 2" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done
stub sysctl false stub sysctl false
@@ -497,7 +497,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -507,7 +507,7 @@ OUT
@test "number of CPU cores is detected on Mac" { @test "number of CPU cores is detected on Mac" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done
stub sysctl '-n hw.ncpu : echo 4' stub sysctl '-n hw.ncpu : echo 4'
@@ -525,7 +525,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 4 make -j 4
make install make install
@@ -535,7 +535,7 @@ OUT
@test "number of CPU cores is detected on FreeBSD" { @test "number of CPU cores is detected on FreeBSD" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..8}; do stub uname '-s : echo FreeBSD'; done for i in {1..7}; do stub uname '-s : echo FreeBSD'; done
stub uname '-r : echo 11.0-RELEASE' stub uname '-r : echo 11.0-RELEASE'
for i in {1..2}; do stub uname '-s : echo FreeBSD'; done for i in {1..2}; do stub uname '-s : echo FreeBSD'; done
for i in {1..2}; do stub pkg false; done for i in {1..2}; do stub pkg false; done
@@ -554,7 +554,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 1 make -j 1
make install make install
@@ -564,7 +564,7 @@ OUT
@test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" { @test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..9}; do stub uname '-s : echo Linux'; done for i in {1..8}; do stub uname '-s : echo Linux'; done
stub_make_install stub_make_install
@@ -578,7 +578,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install DOGE="such wow" make install DOGE="such wow"
@@ -588,7 +588,7 @@ OUT
@test "(PYTHON_)CONFIGURE_OPTS and (PYTHON_)MAKE_OPTS take priority over automatically added options" { @test "(PYTHON_)CONFIGURE_OPTS and (PYTHON_)MAKE_OPTS take priority over automatically added options" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..9}; do stub uname '-s : echo Linux'; done for i in {1..8}; do stub uname '-s : echo Linux'; done
stub_make_install stub_make_install
@@ -606,7 +606,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib --custom-configure --custom-python-configure Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib --custom-configure --custom-python-configure
make -j 2 --custom-make --custom-python-make make -j 2 --custom-make --custom-python-make
make install --custom-make-install make install --custom-make-install
@@ -640,7 +640,7 @@ OUT
@test "configuring with dSYM in MacOS" { @test "configuring with dSYM in MacOS" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
stub_make_install stub_make_install
@@ -657,7 +657,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=${TMP}/install/lib --with-dsymutil Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=${TMP}/install/lib --with-dsymutil
make -j 2 make -j 2
make install make install
@@ -667,7 +667,7 @@ OUT
@test "configuring with dSYM has no effect in non-MacOS" { @test "configuring with dSYM has no effect in non-MacOS" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done for i in {1..9}; do stub uname '-s : echo Linux'; done
stub_make_install stub_make_install
run_inline_definition <<DEF run_inline_definition <<DEF
@@ -680,7 +680,7 @@ DEF
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=${TMP}/install/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=${TMP}/install/lib
make -j 2 make -j 2
make install make install
@@ -700,7 +700,7 @@ OUT
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 9.1" stub uname "-s : echo FreeBSD" "-r : echo 9.1"
for i in {1..7}; do stub uname "-s : echo FreeBSD"; done for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
stub uname "-r : echo 9.1" stub uname "-r : echo 9.1"
for i in {1..2}; do stub uname "-s : echo FreeBSD"; done for i in {1..2}; do stub uname "-s : echo FreeBSD"; done
@@ -717,7 +717,7 @@ OUT
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE" stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE"
for i in {1..7}; do stub uname "-s : echo FreeBSD"; done for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
stub uname "-r : echo 10.0-RELEASE" stub uname "-r : echo 10.0-RELEASE"
for i in {1..2}; do stub uname "-s : echo FreeBSD"; done for i in {1..2}; do stub uname "-s : echo FreeBSD"; done
@@ -733,7 +733,7 @@ OUT
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 11.0-RELEASE" stub uname "-s : echo FreeBSD" "-r : echo 11.0-RELEASE"
for i in {1..7}; do stub uname "-s : echo FreeBSD"; done for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
stub uname "-r : echo 11.0-RELEASE" stub uname "-r : echo 11.0-RELEASE"
for i in {1..2}; do stub uname "-s : echo FreeBSD"; done for i in {1..2}; do stub uname "-s : echo FreeBSD"; done
@@ -754,7 +754,7 @@ apply -p1 -i /my/patch.diff
exec ./configure "\$@" exec ./configure "\$@"
CONF CONF
for i in {1..9}; do stub uname '-s : echo Linux'; done for i in {1..8}; do stub uname '-s : echo Linux'; done
stub apply 'echo apply "$@" >> build.log' stub apply 'echo apply "$@" >> build.log'
stub_make_install stub_make_install
@@ -770,7 +770,7 @@ DEF
assert_build_log <<OUT assert_build_log <<OUT
apply -p1 -i /my/patch.diff apply -p1 -i /my/patch.diff
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" PKG_CONFIG_PATH="" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install

View File

@@ -8,13 +8,11 @@ export -n CC
export -n PYTHON_CONFIGURE_OPTS export -n PYTHON_CONFIGURE_OPTS
@test "require_gcc on OS X 10.9" { @test "require_gcc on OS X 10.9" {
# pyenv/pyenv#1026
stub uname false '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5'
stub uname '-s : echo Darwin' for i in {1..3}; do stub uname '-s : echo Darwin'; done
stub sw_vers '-productVersion : echo 10.9.5' for i in {1..2}; do stub sw_vers '-productVersion : echo 10.9.5'; done
stub gcc '--version : echo 4.2.1' '--version : echo 4.2.1'
stub gcc '--version : echo 4.2.1'
run_inline_definition <<DEF run_inline_definition <<DEF
require_gcc require_gcc
@@ -26,22 +24,28 @@ DEF
CC=${TMP}/bin/gcc CC=${TMP}/bin/gcc
MACOSX_DEPLOYMENT_TARGET=10.9 MACOSX_DEPLOYMENT_TARGET=10.9
OUT OUT
unstub uname
unstub sw_vers
unstub gcc
} }
@test "require_gcc on OS X 10.10" { @test "require_gcc on OS X 10.10" {
# pyenv/pyenv#1026 for i in {1..3}; do stub uname '-s : echo Darwin'; done
stub uname false '-s : echo Darwin' for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done
stub sw_vers '-productVersion : echo 10.10'
stub uname '-s : echo Darwin' stub gcc '--version : echo 4.2.1'
stub sw_vers '-productVersion : echo 10.10'
stub gcc '--version : echo 4.2.1' '--version : echo 4.2.1'
run_inline_definition <<DEF run_inline_definition <<DEF
require_gcc require_gcc
echo CC=\$CC echo CC=\$CC
echo MACOSX_DEPLOYMENT_TARGET=\${MACOSX_DEPLOYMENT_TARGET-no} echo MACOSX_DEPLOYMENT_TARGET=\${MACOSX_DEPLOYMENT_TARGET-no}
DEF DEF
unstub uname
unstub sw_vers
unstub gcc
assert_success assert_success
assert_output <<OUT assert_output <<OUT
CC=${TMP}/bin/gcc CC=${TMP}/bin/gcc
@@ -50,20 +54,22 @@ OUT
} }
@test "require_gcc silences warnings" { @test "require_gcc silences warnings" {
stub gcc '--version : echo warning >&2; echo 4.2.1' '--version : echo warning >&2; echo 4.2.1' stub gcc '--version : echo warning >&2; echo 4.2.1'
run_inline_definition <<DEF run_inline_definition <<DEF
require_gcc require_gcc
echo \$CC echo \$CC
DEF DEF
assert_success "${TMP}/bin/gcc" assert_success "${TMP}/bin/gcc"
unstub gcc
} }
@test "CC=clang by default on OS X 10.10" { @test "CC=clang by default on OS X 10.10" {
mkdir -p "$INSTALL_ROOT" mkdir -p "$INSTALL_ROOT"
cd "$INSTALL_ROOT" cd "$INSTALL_ROOT"
for i in {1..10}; do stub uname '-s : echo Darwin'; done for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..3}; do stub sw_vers '-productVersion : echo 10.10'; done for i in {1..3}; do stub sw_vers '-productVersion : echo 10.10'; done
stub cc 'false' stub cc 'false'
@@ -85,10 +91,6 @@ exec 4<&1
build_package_standard python build_package_standard python
DEF DEF
assert_success assert_success
unstub uname
unstub sw_vers
assert_output <<OUT assert_output <<OUT
./configure --prefix=$INSTALL_ROOT --enable-shared --libdir=${TMP}/install/lib ./configure --prefix=$INSTALL_ROOT --enable-shared --libdir=${TMP}/install/lib
CC=clang CC=clang
@@ -96,13 +98,16 @@ CFLAGS=no
make -j 2 make -j 2
make install make install
OUT OUT
unstub uname
unstub sw_vers
} }
@test "passthrough CFLAGS_EXTRA to micropython compiler" { @test "passthrough CFLAGS_EXTRA to micropython compiler" {
mkdir -p "$INSTALL_ROOT/mpy-cross" mkdir -p "$INSTALL_ROOT/mpy-cross"
mkdir -p "$INSTALL_ROOT/ports/unix" mkdir -p "$INSTALL_ROOT/ports/unix"
mkdir -p "$INSTALL_ROOT/bin" mkdir -p "$INSTALL_ROOT/bin"
# touch "$INSTALL_ROOT/bin/python"
cd "$INSTALL_ROOT" cd "$INSTALL_ROOT"
stub make true true '(for a in "$@"; do echo $a; done)|grep -E "^CFLAGS_EXTRA="' true stub make true true '(for a in "$@"; do echo $a; done)|grep -E "^CFLAGS_EXTRA="' true
@@ -113,7 +118,7 @@ exec 4<&1
CFLAGS_EXTRA='-Wno-floating-conversion' build_package_micropython CFLAGS_EXTRA='-Wno-floating-conversion' build_package_micropython
DEF DEF
#assert_success assert_success
assert_output <<OUT assert_output <<OUT
CFLAGS_EXTRA=-DMICROPY_PY_SYS_PATH_DEFAULT='".frozen:${TMP}/install/lib/micropython"' -Wno-floating-conversion CFLAGS_EXTRA=-DMICROPY_PY_SYS_PATH_DEFAULT='".frozen:${TMP}/install/lib/micropython"' -Wno-floating-conversion
OUT OUT

View File

@@ -5,31 +5,36 @@ export PYENV_ROOT="${TMP}/pyenv"
setup() { setup() {
stub pyenv-hooks 'install : true' stub pyenv-hooks 'install : true'
stub pyenv-rehash 'true' stub pyenv-rehash true
} }
stub_python_build() { stub_python_build_lib() {
stub python-build "--lib : $BATS_TEST_DIRNAME/../bin/python-build --lib" "$@" stub python-build "--lib : $BATS_TEST_DIRNAME/../bin/python-build --lib" "$@"
stub pyenv-latest ": false"
} }
@test "install proper" { stub_python_build_no_latest() {
stub_python_build 'echo python-build "$@"' stub python-build "${@:-echo python-build \"\$@\"}"
}
stub_python_build() {
stub_python_build_no_latest "$@"
stub pyenv-latest false
}
@test "install a single version" {
stub_python_build_lib
stub_python_build
run pyenv-install 3.4.2 run pyenv-install 3.4.2
assert_success "python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2" assert_success "python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2"
unstub python-build unstub python-build
unstub pyenv-hooks
unstub pyenv-rehash
} }
@test "install proper multi versions" { @test "install multiple versions" {
#stub python-build "--lib : $BATS_TEST_DIRNAME/../bin/python-build --lib" 'echo python-build "$@"' 'echo python-build "$@"' stub_python_build_lib
#stub pyenv-latest ": false" ": false" stub_python_build
stub_python_build 'echo python-build "$@"' 'echo python-build "$@"' stub_python_build
stub pyenv-latest ": false"
stub pyenv-rehash 'true'
run pyenv-install 3.4.1 3.4.2 run pyenv-install 3.4.1 3.4.2
assert_success assert_success
@@ -40,61 +45,72 @@ OUT
unstub python-build unstub python-build
unstub pyenv-latest unstub pyenv-latest
unstub pyenv-hooks
unstub pyenv-rehash
} }
@test "install resolves a prefix" { @test "install multiple versions, some fail" {
stub_python_build 'echo python-build "$@"' stub_python_build_lib
stub pyenv-latest '-q -k 3.4 : echo 3.4.2' stub_python_build 'echo "fail: python-build" "$@"; false'
pyenv-latest || true # pass through the stub entry added by stub_python_build
run pyenv-install 3.4 run pyenv-install 3.4.1 3.4.2
assert_success "python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2" assert_failure
assert_output <<OUT
fail: python-build 3.4.1 ${TMP}/pyenv/versions/3.4.1
OUT
unstub python-build unstub python-build
unstub pyenv-hooks
unstub pyenv-rehash
} }
@test "install resolves a prefix with multi versions" {
stub_python_build 'echo python-build "$@"' 'echo python-build "$@"'
stub pyenv-latest '-q -k 3.4 : echo 3.4.2' '-q -k 3.5 : echo 3.5.2'
stub pyenv-rehash 'true'
pyenv-latest || true # pass through the stub entry added by stub_python_build
run pyenv-install 3.4 3.5 @test "install resolves a prefix" {
stub_python_build_lib
for i in {1..3}; do stub_python_build_no_latest; done
stub pyenv-latest \
'-q -k 3.4 : echo 3.4.2' \
'-q -k 3.5.1 : false' \
'-q -k 3.5 : echo 3.5.2'
run pyenv-install 3.4 3.5.1 3.5
assert_success <<OUT assert_success <<OUT
python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2 python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2
python-build 3.5.1 ${PYENV_ROOT}/versions/3.5.1
python-build 3.5.2 ${PYENV_ROOT}/versions/3.5.2 python-build 3.5.2 ${PYENV_ROOT}/versions/3.5.2
OUT OUT
unstub python-build unstub python-build
unstub pyenv-hooks
unstub pyenv-rehash
} }
@test "install pyenv local version by default" {
stub_python_build 'echo python-build "$1"'
stub pyenv-local 'echo 3.4.2'
run pyenv-install @test "install resolves :latest" {
assert_success "python-build 3.4.2" stub_python_build_lib
for i in {1..2}; do stub_python_build '--definitions : echo -e 3.4.2\\n3.5.1\\n3.5.2'; done
for i in {1..2}; do stub_python_build; done
pyenv-hooks install; unstub pyenv-hooks
PYENV_INSTALL_ROOT="$BATS_TEST_DIRNAME/../../.."
export PYENV_HOOK_PATH="$PYENV_INSTALL_ROOT/pyenv.d"
[[ -d "$PYENV_INSTALL_ROOT/libexec" ]] || skip "python-build is installed separately from pyenv"
export PATH="$PATH:$PYENV_INSTALL_ROOT/libexec"
run pyenv-install 3.4:latest 3:latest
assert_success <<!
python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2
python-build 3.5.2 ${PYENV_ROOT}/versions/3.5.2
!
unstub python-build unstub python-build
unstub pyenv-local
} }
@test "install pyenv local multi versions by default" { @test "install installs local versions by default" {
stub_python_build 'echo python-build "$1"' 'echo python-build "$1"' stub_python_build_lib
stub pyenv-local 'printf "%s\n%s\n" 3.4.2 3.4.1' stub_python_build
stub pyenv-latest ": false" stub_python_build
stub pyenv-local 'echo 3.4.2; echo 3.4.1'
run pyenv-install run pyenv-install
assert_success <<OUT assert_success <<OUT
python-build 3.4.2" python-build 3.4.2
python-build 3.4.1" python-build 3.4.1
OUT OUT
unstub python-build unstub python-build
@@ -102,8 +118,8 @@ OUT
} }
@test "list available versions" { @test "list available versions" {
stub_python_build \ stub_python_build_lib
"--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'" stub_python_build "--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'"
run pyenv-install --list run pyenv-install --list
assert_success assert_success
@@ -118,10 +134,11 @@ OUT
unstub python-build unstub python-build
} }
@test "nonexistent version" { @test "upgrade instructions given for a nonexistent version" {
stub brew false stub brew false
stub_python_build 'echo ERROR >&2 && exit 2' \ stub_python_build_lib
"--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'" stub_python_build 'echo ERROR >&2 && exit 2'
stub_python_build "--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'"
run pyenv-install 2.7.9 run pyenv-install 2.7.9
assert_failure assert_failure
@@ -142,8 +159,9 @@ OUT
unstub python-build unstub python-build
} }
@test "Homebrew upgrade instructions" { @test "homebrew upgrade instructions given when pyenv is homebrew-installed" {
stub brew "--prefix : echo '${BATS_TEST_DIRNAME%/*}'" stub brew "--prefix : echo '${BATS_TEST_DIRNAME%/*}'"
stub_python_build_lib
stub_python_build 'echo ERROR >&2 && exit 2' \ stub_python_build 'echo ERROR >&2 && exit 2' \
"--definitions : true" "--definitions : true"
@@ -165,15 +183,19 @@ OUT
@test "no build definitions from plugins" { @test "no build definitions from plugins" {
assert [ ! -e "${PYENV_ROOT}/plugins" ] assert [ ! -e "${PYENV_ROOT}/plugins" ]
stub_python_build_lib
stub_python_build 'echo $PYTHON_BUILD_DEFINITIONS' stub_python_build 'echo $PYTHON_BUILD_DEFINITIONS'
run pyenv-install 3.4.2 run pyenv-install 3.4.2
assert_success "" assert_success ""
unstub python-build
} }
@test "some build definitions from plugins" { @test "some build definitions from plugins" {
mkdir -p "${PYENV_ROOT}/plugins/foo/share/python-build" mkdir -p "${PYENV_ROOT}/plugins/foo/share/python-build"
mkdir -p "${PYENV_ROOT}/plugins/bar/share/python-build" mkdir -p "${PYENV_ROOT}/plugins/bar/share/python-build"
stub_python_build_lib
stub_python_build "echo \$PYTHON_BUILD_DEFINITIONS | tr ':' $'\\n'" stub_python_build "echo \$PYTHON_BUILD_DEFINITIONS | tr ':' $'\\n'"
run pyenv-install 3.4.2 run pyenv-install 3.4.2
@@ -183,11 +205,14 @@ OUT
${PYENV_ROOT}/plugins/bar/share/python-build ${PYENV_ROOT}/plugins/bar/share/python-build
${PYENV_ROOT}/plugins/foo/share/python-build ${PYENV_ROOT}/plugins/foo/share/python-build
OUT OUT
unstub python-build
} }
@test "list build definitions from plugins" { @test "list build definitions from plugins" {
mkdir -p "${PYENV_ROOT}/plugins/foo/share/python-build" mkdir -p "${PYENV_ROOT}/plugins/foo/share/python-build"
mkdir -p "${PYENV_ROOT}/plugins/bar/share/python-build" mkdir -p "${PYENV_ROOT}/plugins/bar/share/python-build"
stub_python_build_lib
stub_python_build "--definitions : echo \$PYTHON_BUILD_DEFINITIONS | tr ':' $'\\n'" stub_python_build "--definitions : echo \$PYTHON_BUILD_DEFINITIONS | tr ':' $'\\n'"
run pyenv-install --list run pyenv-install --list
@@ -198,12 +223,14 @@ Available versions:
${PYENV_ROOT}/plugins/bar/share/python-build ${PYENV_ROOT}/plugins/bar/share/python-build
${PYENV_ROOT}/plugins/foo/share/python-build ${PYENV_ROOT}/plugins/foo/share/python-build
OUT OUT
unstub python-build
} }
@test "completion results include build definitions from plugins" { @test "completion results include build definitions from plugins" {
mkdir -p "${PYENV_ROOT}/plugins/foo/share/python-build" mkdir -p "${PYENV_ROOT}/plugins/foo/share/python-build"
mkdir -p "${PYENV_ROOT}/plugins/bar/share/python-build" mkdir -p "${PYENV_ROOT}/plugins/bar/share/python-build"
stub python-build "--definitions : echo \$PYTHON_BUILD_DEFINITIONS | tr ':' $'\\n'" stub_python_build "--definitions : echo \$PYTHON_BUILD_DEFINITIONS | tr ':' $'\\n'"
run pyenv-install --complete run pyenv-install --complete
assert_success assert_success
@@ -220,10 +247,12 @@ OUT
${PYENV_ROOT}/plugins/bar/share/python-build ${PYENV_ROOT}/plugins/bar/share/python-build
${PYENV_ROOT}/plugins/foo/share/python-build ${PYENV_ROOT}/plugins/foo/share/python-build
OUT OUT
unstub python-build
} }
@test "not enough arguments for pyenv-install if no local version" { @test "not enough arguments for pyenv-install if no local version" {
stub_python_build stub_python_build_lib
stub pyenv-help 'install : true' stub pyenv-help 'install : true'
run pyenv-install run pyenv-install
@@ -232,17 +261,7 @@ OUT
assert_output "" assert_output ""
} }
@test "multi arguments for pyenv-install" {
stub_python_build
stub pyenv-help 'install : true'
run pyenv-install 3.4.1 3.4.2
assert_success
assert_output ""
}
@test "show help for pyenv-install" { @test "show help for pyenv-install" {
stub_python_build
stub pyenv-help 'install : true' stub pyenv-help 'install : true'
run pyenv-install -h run pyenv-install -h
@@ -263,7 +282,7 @@ OUT
unstub pyenv-help unstub pyenv-help
} }
@test "more than one argument for pyenv-uninstall" { @test "multiple arguments for pyenv-uninstall" {
mkdir -p "${PYENV_ROOT}/versions/3.4.1" mkdir -p "${PYENV_ROOT}/versions/3.4.1"
mkdir -p "${PYENV_ROOT}/versions/3.4.2" mkdir -p "${PYENV_ROOT}/versions/3.4.2"
run pyenv-uninstall -f 3.4.1 3.4.2 run pyenv-uninstall -f 3.4.1 3.4.2

View File

@@ -89,7 +89,7 @@ install_tmp_fixture() {
} }
resolve_link() { resolve_link() {
$(type -P greadlink readlink | head -1) "$1" $(type -P greadlink readlink | head -n1) "$1"
} }
run_inline_definition_with_name() { run_inline_definition_with_name() {
@@ -123,7 +123,7 @@ run_inline_definition_with_name() {
assert_build_log <<OUT assert_build_log <<OUT
patch -p0 --force -i $TMP/python-patch.XXX patch -p0 --force -i $TMP/python-patch.XXX
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib"
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -153,7 +153,7 @@ OUT
patch: bar patch: bar
patch: baz patch: baz
patch: foo patch: foo
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib"
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install make install
@@ -177,7 +177,7 @@ OUT
assert_success assert_success
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib"
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make altinstall make altinstall
@@ -245,25 +245,27 @@ OUT
} }
@test "enable framework" { @test "enable framework" {
mkdir -p "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin" framework_path="${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin"
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3" mkdir -p "$framework_path"
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3" for executable in python3{,.4}{,-config}; do
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4" touch "$framework_path/$executable"
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4" chmod +x "$framework_path/$executable"
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3-config" done
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3-config" unset framework_path executable
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config"
chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config"
for i in {1..3}; do stub uname '-s : echo Darwin'; done for i in {1..3}; do stub uname '-s : echo Darwin'; done
PYTHON_CONFIGURE_OPTS="--enable-framework" TMPDIR="$TMP" run_inline_definition <<OUT PYTHON_CONFIGURE_OPTS="--enable-framework" TMPDIR="$TMP" run_inline_definition <<OUT
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})" echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
echo "PYTHON_CONFIGURE_OPTS=(\${PYTHON_CONFIGURE_OPTS})"
echo "CONFIGURE_OPTS=(\${CONFIGURE_OPTS})"
verify_python python3.4 verify_python python3.4
OUT OUT
assert_success assert_success
assert_output <<EOS assert_output <<EOS
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-framework=${TMP}/install/Library/Frameworks) PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-framework=${TMP}/install/Library/Frameworks)
PYTHON_CONFIGURE_OPTS=()
CONFIGURE_OPTS=()
EOS EOS
[ -L "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python" ] [ -L "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python" ]
@@ -277,10 +279,14 @@ EOS
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})" echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
echo "PYTHON_CONFIGURE_OPTS=(\${PYTHON_CONFIGURE_OPTS})"
echo "CONFIGURE_OPTS=(\${CONFIGURE_OPTS})"
OUT OUT
assert_success assert_success
assert_output <<EOS assert_output <<EOS
PYTHON_CONFIGURE_OPTS_ARRAY=(--enable-shared --libdir=${TMP}/install/lib --enable-universalsdk=/) PYTHON_CONFIGURE_OPTS_ARRAY=(--enable-shared --libdir=${TMP}/install/lib --enable-universalsdk=/)
PYTHON_CONFIGURE_OPTS=()
CONFIGURE_OPTS=()
EOS EOS
} }
@@ -291,10 +297,14 @@ EOS
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})" echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
echo "PYTHON_CONFIGURE_OPTS=(\${PYTHON_CONFIGURE_OPTS})"
echo "CONFIGURE_OPTS=(\${CONFIGURE_OPTS})"
OUT OUT
assert_success assert_success
assert_output <<EOS assert_output <<EOS
PYTHON_CONFIGURE_OPTS_ARRAY=(--enable-shared --libdir=${TMP}/install/lib --enable-universalsdk=/ --with-universal-archs=universal2) PYTHON_CONFIGURE_OPTS_ARRAY=(--enable-shared --libdir=${TMP}/install/lib --enable-universalsdk=/ --with-universal-archs=universal2)
PYTHON_CONFIGURE_OPTS=()
CONFIGURE_OPTS=()
EOS EOS
} }
@@ -315,7 +325,7 @@ EOS
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
for i in {1..8}; do stub uname '-s : echo Linux'; done for i in {1..7}; do stub uname '-s : echo Linux'; done
stub "$MAKE" \ stub "$MAKE" \
" : echo \"$MAKE \$@\" >> build.log" \ " : echo \"$MAKE \$@\" >> build.log" \
" : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" " : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
@@ -324,7 +334,7 @@ EOS
assert_success assert_success
assert_build_log <<OUT assert_build_log <<OUT
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath=${TMP}/install/lib" Python-3.6.2: CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib"
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib --enable-unicode=ucs2 Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib --enable-unicode=ucs2
make -j 2 make -j 2
make install make install

View File

@@ -133,7 +133,7 @@ assert_output_contains() {
echo "assert_output_contains needs an argument" >&2 echo "assert_output_contains needs an argument" >&2
return 1 return 1
fi fi
echo "$output" | $(type -P ggrep grep | head -1) -F "$expected" >/dev/null || { echo "$output" | $(type -P ggrep grep | head -n1) -F "$expected" >/dev/null || {
{ echo "expected output to contain $expected" { echo "expected output to contain $expected"
echo "actual: $output" echo "actual: $output"
} | flunk } | flunk

View File

@@ -3,7 +3,7 @@
load test_helper load test_helper
bats_bin="${BATS_TEST_DIRNAME}/../bin/python-build" bats_bin="${BATS_TEST_DIRNAME}/../bin/python-build"
static_version="$(grep VERSION "$bats_bin" | head -1 | cut -d'"' -f 2)" static_version="$(grep VERSION "$bats_bin" | head -n1 | cut -d'"' -f 2)"
@test "python-build static version" { @test "python-build static version" {
stub git 'echo "ASPLODE" >&2; exit 1' stub git 'echo "ASPLODE" >&2; exit 1'

View File

@@ -1,13 +1,25 @@
DEFINITION_PREFIX="${DEFINITION%%:*}" pyenv_install_resolve_latest() {
DEFINITION_TYPE="${DEFINITION_PREFIX%%-*}" # TODO: support non-CPython versions local DEFINITION_PREFIX DEFINITION_TYPE
if [[ "${DEFINITION}" != "${DEFINITION_PREFIX}" ]]; then local -a DEFINITION_CANDIDATES
DEFINITION_CANDIDATES=(\ local DEFINITION="$1"
$(python-build --definitions | \
grep -F "${DEFINITION_PREFIX}" | \ DEFINITION_PREFIX="${DEFINITION%%:*}"
grep "^${DEFINITION_TYPE}" | \ DEFINITION_TYPE="${DEFINITION_PREFIX%%-*}" # TODO: support non-CPython versions
sed -E -e '/-dev$/d' -e '/-src$/d' -e '/(b|rc)[0-9]+$/d' | \ if [[ "${DEFINITION}" != "${DEFINITION_PREFIX}" ]]; then
sort -t. -k1,1r -k 2,2nr -k 3,3nr \ DEFINITION_CANDIDATES=(\
|| true)) $(python-build --definitions | \
DEFINITION="${DEFINITION_CANDIDATES}" grep -F "${DEFINITION_PREFIX}" | \
VERSION_NAME="${DEFINITION##*/}" grep "^${DEFINITION_TYPE}" | \
fi sed -E -e '/-dev$/d' -e '/-src$/d' -e '/(b|rc)[0-9]+$/d' | \
sort -t. -k1,1r -k 2,2nr -k 3,3nr \
|| true))
DEFINITION="${DEFINITION_CANDIDATES}"
fi
echo "$DEFINITION"
}
for i in ${!DEFINITIONS[*]}; do
DEFINITIONS[$i]="$(pyenv_install_resolve_latest "${DEFINITIONS[$i]}")"
done
unset pyenv_install_resolve_latest

View File

@@ -93,3 +93,22 @@ echo 3.10.6
3.10.8 3.10.8
! !
} }
@test "ignores rolling releases, branch tips, alternative srcs, prereleases and virtualenvs" {
create_executable pyenv-versions <<!
#!$BASH
echo 3.8.5-dev
echo 3.8.5-src
echo 3.8.5-latest
echo 3.8.5a2
echo 3.8.5b3
echo 3.8.5rc2
echo 3.8.1
echo 3.8.1/envs/foo
!
run pyenv-latest 3.8
assert_success
assert_output <<!
3.8.1
!
}

View File

@@ -6,6 +6,11 @@ create_version() {
mkdir -p "${PYENV_ROOT}/versions/$1" mkdir -p "${PYENV_ROOT}/versions/$1"
} }
create_alias() {
mkdir -p "${PYENV_ROOT}/versions"
ln -s "$2" "${PYENV_ROOT}/versions/$1"
}
setup() { setup() {
mkdir -p "$PYENV_TEST_DIR" mkdir -p "$PYENV_TEST_DIR"
cd "$PYENV_TEST_DIR" cd "$PYENV_TEST_DIR"
@@ -61,18 +66,38 @@ OUT
assert_success "3.3" assert_success "3.3"
} }
@test "multiple versions" { @test "multiple versions and envs" {
stub_system_python stub_system_python
create_version "2.7.6" create_version "2.7.6"
create_version "3.3.3"
create_version "3.4.0" create_version "3.4.0"
create_version "3.4.0/envs/foo"
create_version "3.4.0/envs/bar"
create_version "3.5.2"
run pyenv-versions run pyenv-versions
assert_success assert_success
assert_output <<OUT assert_output <<OUT
* system (set by ${PYENV_ROOT}/version) * system (set by ${PYENV_ROOT}/version)
2.7.6 2.7.6
3.4.0
3.4.0/envs/bar
3.4.0/envs/foo
3.5.2
OUT
}
@test "skips envs with --skip-envs" {
create_version "3.3.3"
create_version "3.4.0"
create_version "3.4.0/envs/foo"
create_version "3.4.0/envs/bar"
create_version "3.5.0"
run pyenv-versions --skip-envs
assert_success <<OUT
* system (set by ${PYENV_ROOT}/version)
3.3.3 3.3.3
3.4.0 3.4.0
3.5.0
OUT OUT
} }
@@ -138,7 +163,7 @@ OUT
@test "lists symlinks under versions" { @test "lists symlinks under versions" {
create_version "2.7.8" create_version "2.7.8"
ln -s "2.7.8" "${PYENV_ROOT}/versions/2.7" create_alias "2.7" "2.7.8"
run pyenv-versions --bare run pyenv-versions --bare
assert_success assert_success
@@ -150,9 +175,9 @@ OUT
@test "doesn't list symlink aliases when --skip-aliases" { @test "doesn't list symlink aliases when --skip-aliases" {
create_version "1.8.7" create_version "1.8.7"
ln -s "1.8.7" "${PYENV_ROOT}/versions/1.8" create_alias "1.8" "1.8.7"
mkdir moo mkdir moo
ln -s "${PWD}/moo" "${PYENV_ROOT}/versions/1.9" create_alias "1.9" "${PWD}/moo"
run pyenv-versions --bare --skip-aliases run pyenv-versions --bare --skip-aliases
assert_success assert_success
@@ -210,3 +235,14 @@ SH
1.9.0 1.9.0
OUT OUT
} }
@test "non-bare output shows symlink contents" {
create_version "1.9.0"
create_alias "link" "foo/bar"
run pyenv-versions
assert_success <<OUT
1.9.0
link --> foo/bar
OUT
}

View File

@@ -136,3 +136,22 @@ SH
PYENV_VERSION= run pyenv-which python PYENV_VERSION= run pyenv-which python
assert_success "${PYENV_ROOT}/versions/3.4/bin/python" assert_success "${PYENV_ROOT}/versions/3.4/bin/python"
} }
@test "resolves pyenv-latest prefixes" {
create_executable "3.4.2" "python"
PYENV_VERSION=3.4 run pyenv-which python
assert_success "${PYENV_ROOT}/versions/3.4.2/bin/python"
}
@test "hooks get resolved version name" {
create_hook which echo.bash <<!
echo version=\$version
exit
!
create_executable "3.4.2" "python"
PYENV_VERSION=3.4 run pyenv-which python
assert_success "version=3.4.2"
}