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

Compare commits

...

37 Commits

Author SHA1 Message Date
Anton Petrov
40d35f84b4 Update CHANGELOG.md 2021-12-22 09:48:46 +03:00
Anton Petrov
8675031879 Update pyenv---version 2021-12-22 09:48:21 +03:00
Yudai Hayashi
381002dbe2 Add pypy2.7-7.3.2~7.3.6 (#2194) 2021-12-20 13:51:28 +03:00
Christian Hammond
2d9e981d60 Fix Python 3.7.12 compilation on macOS arm64/M1. (#2190)
This change ports pyenv and Python patches to 3.7.12 to enable the
`ctypes `and `decimal` modules to compile.

While Python 3.7.12 itself compiles on arm64/M1, both of these modules
fail to compile, due to missing support for locating system libffi and
due to architecture gate-keeping. These issues have been fixed in newer
releases of Python, and in other pyenv patch bundles.

The following patches are provided:

1. `0001-Port-ctypes-and-system-libffi-patches-for-arm64-macO.patch` -
   Fixes system `ffi.h`/`libffi` path determination and usage and
   enables calling of variadic functions, fixing ctypes support
   (consolidated port of existing pyenv patches for 2.7.18 that iterate
   on this logic).

2. `0002-bpo-41100-fix-_decimal-for-arm64-Mac-OS-GH-21228.patch` -
   Adds arm64 to the list of allowable architectures for the
   `decimal` module (port of Python patch introduced in 3.8.10).
2021-12-20 07:14:14 +03:00
Christian Hammond
152457a428 Fix Python 3.6.15 compilation on macOS arm64/M1. (#2189)
This change ports several established patches to the Python 3.6.15
build, enabling compilation on arm64/Apple M1 architectures:

1. `0001-Detect-arm64-in-configure.patch` -
   Updates configure to detect arm64 architectures (port of an existing
   pyenv patch for 2.7.18).

2. `0002-bpo-36231-Support-building-on-macOS-without-usr-incl.patch` -
   Adds macOS SDK root computation logic for determining include paths
   (port of existing Python patches introduced in 2.7.17 and 3.7.4).

3. `0003-Fix-macOS-_tkinter-use-of-Tck-Tk-in-Library-Framewor.patch` -
   Fixes Tcl/Tk support on macOS (port of an existing pyenv patch
   for 2.7.18).

4. `0004-Port-ctypes-and-system-libffi-patches-for-arm64-macO.patch` -
   Fixes system `ffi.h`/`libffi` path determination and usage and
   enables calling of variadic functions, fixing ctypes support
   (consolidated port of existing pyenv patches for 2.7.18 that iterate
   on this logic).

5. `0005-BPO-41100-Support-macOS-11-when-building-GH-21113.patch` -
   Updates Darwin version checks to handle macOS 11's major version
   bump (port of Python patches introduced in 3.7.0 and 3.9.0).

6. `0006-bpo-41100-fix-_decimal-for-arm64-Mac-OS-GH-21228.patch` -
   Adds arm64 to the list of allowable architectures for the
   `decimal` module (port of Python patch introduced in 3.8.10).
2021-12-20 07:09:38 +03:00
SouthWolf
86ca164a11 Add Anaconda3-2021.11 (#2193)
* Use verify_py39 since anaconda3-2021.11 is using python-3.9 according to release notes
2021-12-19 18:43:01 +03:00
Ned Batchelder
943c5f995d Add CPython 3.11.0a3 (#2187) 2021-12-09 21:41:09 +03:00
John Miller
c80b1cdfb9 Fix errant "echo" in build env install instructions (#2185) 2021-12-08 07:12:53 +03:00
Juan Luis Cano Rodríguez
15677f7f5a Add Miniforge and Mambaforge 4.10.3-10 (#2184) 2021-12-07 21:39:30 +03:00
Ricardo Madriz
631bf6a23a Add CPython 3.10.1 (#2183) 2021-12-07 08:50:30 -05:00
native-api
2862858052 Merge pull request #2182 from J-M0/fix_3.6.15
Fix 3.6.15 build on macOS
2021-12-06 20:01:42 +03:00
James Morris
a7e09ce2ea Update macOS test dependencies 2021-12-05 19:23:21 -05:00
James Morris
4d56947277 Fix Python 3.6.15 build 2021-12-03 16:50:13 -05:00
James Morris
07b7471819 Add macOS tests 2021-12-03 16:48:22 -05:00
James Morris
3d4fc164a2 Update Python 3.6 in Ubuntu tests 2021-12-03 16:47:42 -05:00
Ivan Pozdeev
f2925393e4 update ISSUE_TEMPLATE.md 2021-11-23 20:22:59 +03:00
Anton Petrov
a681e756e1 Update CHANGELOG.md 2021-11-22 22:35:16 +03:00
Anton Petrov
dc3a201301 Update pyenv---version 2021-11-22 22:33:10 +03:00
Xiangyu Xu
7706a45080 Add macOS Apple M1 to Miniconda-latest (#2164)
[source](https://www.anaconda.com/blog/anaconda-individual-edition-2021-11#:~:text=Update%20on%20macOS%20Apple%20M1%20Support)
2021-11-20 23:58:42 +03:00
Josh Friend
23dfe75b73 v2.2.1 2021-11-20 09:04:59 -05:00
Illia Volochii
df7ccfe0e8 Add CPython 3.9.9 (#2162) 2021-11-16 19:17:00 +03:00
native-api
e342d84715 Merge pull request #2158 from scop/micropythons 2021-11-14 00:05:58 +03:00
Ville Skyttä
e54cd5f49d Add micropython 1.17 2021-11-13 22:56:51 +02:00
Ville Skyttä
80ec306155 Add micropython 1.16 2021-11-13 22:56:42 +02:00
Ville Skyttä
a9e11ba164 Use command and type instead of which (#2144)
`which` has been deprecated in Debian's debianutils 5.0+
They suggest using `type` and `command` as replacements:
3a8dd10b45 ,
610a65c6ef
2021-11-11 21:08:12 +03:00
native-api
5b7c140f5b Dummy for https://github.com/pyenv/pyenv/issues/106 (#2156)
The issue has been resolved in ed38af6409
but the bounty didn't trigger -- allegedly 'cuz it's not a PR.

Bountysource support replied "we're looking" but never did anything
so I'm going to try to trigger it via a dummy PR.
2021-11-09 20:48:12 +03:00
Ivan Pozdeev
aebed1c0a4 Merge branch 'master' of https://github.com/pyenv/pyenv 2021-11-09 20:19:35 +03:00
Ivan Pozdeev
4adc45ef8a Dummy for https://github.com/pyenv/pyenv/issues/106 2021-11-09 20:19:16 +03:00
native-api
d79bda4602 Patch 3.10.0 configure (#2155)
* Fix "PKG_PROG_PKG_CONFIG: command not found"

Apply f146ca36f8
* bpo-45350: Rerun autoreconf with the pkg-config macros (GH-28707)
2021-11-09 19:06:42 +03:00
Oğuzhan Çelikarslan
552d943762 Fix typos in command examples (#2147) 2021-11-09 09:50:29 +03:00
Parnassius
663abeb5fa Add CPython 3.9.8 (#2152) 2021-11-07 17:43:58 +03:00
Ned Batchelder
748261869a CPython 3.11.0a2 (#2150) 2021-11-06 14:21:35 +03:00
native-api
54889eb87a Make gist generation instructions more explicit; add Zsh PS4 2021-10-31 05:14:03 +03:00
sandipanpanda
cfe2aba670 Add definition of pyenv help in COMMANDS.md (#2139) 2021-10-30 22:11:42 +03:00
Ivan Pozdeev
009fea2b20 Merge branch 'master' of https://github.com/pyenv/pyenv 2021-10-29 12:20:30 +03:00
Ivan Pozdeev
6e214570d1 Use OpenSSL 1 for 2.7.18 2021-10-29 12:20:20 +03:00
native-api
abfa1c6d92 Explicitly state to enable verbose mode 2021-10-29 01:21:23 +03:00
41 changed files with 2073 additions and 28 deletions

View File

@@ -17,12 +17,5 @@ Make sure you have checked all steps below.
- [ ] pyenv version:
- [ ] Python version:
- [ ] C Compiler information (e.g. gcc 7.3):
- [ ] Please attach a debug trace log as gist
* If the problem happens in a Pyenv invocation, you can turn on debug logging by setting `PYENV_DEBUG=1`, e.g. `env PYENV_DEBUG=1 pyenv install -v 3.6.4`
* If the problem happens outside of a Pyenv invocation, get the debug log like this:
```
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -x
<reproduce the problem>
set +x
```
- [ ] Please attach the debug trace of the failing command as a gist:
* Run `env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.log` and attach `trace.log`. E.g. if you have a problem with installing Python, run `env PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log` (note the `-v` option to `pyenv install`).

41
.github/workflows/macos_tests.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: macos_tests
on: [pull_request, push]
jobs:
macos_tests:
strategy:
fail-fast: false
matrix:
python-version:
- 2.7.18
- 3.5.10
- 3.6.15
- 3.7.10
- 3.8.10
- 3.9.5
- 3.10.0
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
# Normally, we would use the superbly maintained...
# - uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# ... but in the repo, we want to test pyenv builds on macOS
- run: |
brew install openssl readline sqlite3 xz zlib
# https://github.com/pyenv/pyenv#installation
- run: pwd
- env:
PYENV_ROOT: /Users/runner/work/pyenv/pyenv
run: |
echo $PYENV_ROOT
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
bin/pyenv install ${{ matrix.python-version }}
bin/pyenv global ${{ matrix.python-version }}
bin/pyenv rehash
- run: python --version
- run: python -m pip --version
- shell: python # Prove that actual Python == expected Python
env:
EXPECTED_PYTHON: ${{ matrix.python-version }}
run: import os, sys ; assert sys.version.startswith(os.getenv("EXPECTED_PYTHON"))

View File

@@ -8,7 +8,7 @@ jobs:
python-version:
- 2.7.18
- 3.5.10
- 3.6.13
- 3.6.15
- 3.7.10
- 3.8.10
- 3.9.5

View File

@@ -1,14 +1,41 @@
## Version History
## Release 2.2.3
* Add new pypy versions (pypy2.7-7.3.2~7.3.5) to the version list (#2194)
* Fix Python 3.7.12 compilation on macOS arm64/M1. (#2190)
* Fix Python 3.6.15 compilation on macOS arm64/M1. (#2189)
* Add Anaconda3-2021.11 (#2193)
* CPython 3.11.0a3 (#2187)
* Fix errant "echo" in README install instructions (#2185)
* Add Miniforge and Mambaforge 4.10.3-10 (#2184)
* Add CPython 3.10.1 (#2183)
* Fix 3.6.15 build on macOS (#2182)
## Release 2.2.2
* Add support for macOS Apple M1 (#2164)
## Release 2.2.1
* Add CPython 3.9.9 (#2162)
* Add CPython 3.9.8 (#2152)
* Add Add micropython 1.17 (#2158)
* Add Add micropython 1.16 (#2158)
* Patch 3.10.0 configure, fixes https://bugs.python.org/issue45350 (#2155)
* Use command and type instead of which (#2144)
* Add definition of pyenv help in COMMANDS.md #2139
* Use OpenSSL 1.0 for CPython 2.7.18
## Release 2.2.0
* Adding PyPy release 7.3.7 (Python 3.7 and 3.8). (#2132)
* Append Homebrew custom prefix to search path (#1957)
* Add documentation for init command (#2125)
* Add setup instructions for the case when one installs Pyenv as part of a batch job (#2127)
* Add documentation for init command (#2125)
* Add setup instructions for the case when one installs Pyenv as part of a batch job (#2127)
* Add documentation for completions command (#2126)
* Default --with-universal-archs to universal2 on Apple Silicon (#2122)
* Update README.md (#2120)
* Add GraalPython 21.3.0 (#2117)
* Add GraalPython 21.3.0 (#2117)
* Pypy ver 7.3.6 - python 3.7 and python 3.8 (#2111)
* Discover Tcl/Tk reliably and use active version (#2106)
* Fish installation instructions (#2104)

View File

@@ -5,6 +5,7 @@ first argument.
The most common subcommands are:
* [`pyenv help`](#pyenv-help)
* [`pyenv commands`](#pyenv-commands)
* [`pyenv local`](#pyenv-local)
* [`pyenv global`](#pyenv-global)
@@ -24,6 +25,11 @@ The most common subcommands are:
* [`pyenv init`](#pyenv-init)
* [`pyenv completions`](#pyenv-completions)
## `pyenv help`
List all available pyenv commands along with a brief description of what they do. Run `pyenv help <command>` for information on a specific command. For full documentation, see: https://github.com/pyenv/pyenv#readme
## `pyenv commands`
Lists all available pyenv commands.
@@ -287,18 +293,18 @@ Lists all Python versions with the given command installed.
## `pyenv exec`
`Usage: pyenv exec <command> [arg1 arg2...]`
Usage: pyenv exec <command> [arg1 arg2...]
Runs an executable by first preparing PATH so that the selected Python
version's `bin` directory is at the front.
For example, if the currently selected Python version is 3.9.7:
`pyenv exec pip install -r requirements.txt`
pyenv exec pip install -r requirements.txt
is equivalent to:
`PATH="$PYENV_ROOT/versions/3.9.7/bin:$PATH" pip install -r requirements.txt`
PATH="$PYENV_ROOT/versions/3.9.7/bin:$PATH" pip install -r requirements.txt
## `pyenv root`

View File

@@ -320,7 +320,7 @@ easy to fork and contribute any changes back upstream.
to be a shell function (e.g. `shell` and Pyenv-Virtualenv's `activate`).
~~~bash
echo 'eval "$(pyenv init -)"'
eval "$(pyenv init -)"
~~~
If you are installing Pyenv yourself as part of the batch job,

View File

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

View File

@@ -8,10 +8,10 @@
# version's `bin' directory is at the front.
#
# For example, if the currently selected Python version is 2.7.6:
# pyenv exec pip install -rrequirements.txt
# pyenv exec pip install -r requirements.txt
#
# is equivalent to:
# PATH="$PYENV_ROOT/versions/2.7.6/bin:$PATH" pip install -rrequirements.txt
# PATH="$PYENV_ROOT/versions/2.7.6/bin:$PATH" pip install -r requirements.txt
set -e
[ -n "$PYENV_DEBUG" ] && set -x

View File

@@ -1,4 +1,4 @@
#require_gcc
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@1.1 openssl@1.0 openssl"
install_package "openssl-1.0.2q" "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2q.tar.gz#5744cfcbcec2b1b48629f7354203bc1e5e9b5466998bbccc5b5fcde3b18eb684" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then

View File

@@ -0,0 +1,10 @@
#require_gcc
prefer_openssl11
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1k" "https://www.openssl.org/source/openssl-1.1.1k.tar.gz#892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.10.1" "https://www.python.org/ftp/python/3.10.1/Python-3.10.1.tar.xz#a7f1265b6e1a5de1ec5c3ec7019ab53413469934758311e9d240c46e5ae6e177" standard verify_py310 copy_python_gdb ensurepip
else
install_package "Python-3.10.1" "https://www.python.org/ftp/python/3.10.1/Python-3.10.1.tgz#b76117670e7c5064344b9c138e141a377e686b9063f3a8a620ff674fa8ec90d3" standard verify_py310 copy_python_gdb ensurepip
fi

View File

@@ -4,7 +4,7 @@ export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1k" "https://www.openssl.org/source/openssl-1.1.1k.tar.gz#892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5" mac_openssl --if has_broken_mac_openssl
install_package "readline-8.0" "https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz#e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461" mac_readline --if has_broken_mac_readline
if has_tar_xz_support; then
install_package "Python-3.11.0a1" "https://www.python.org/ftp/python/3.11.0/Python-3.11.0a1.tar.xz#966319daafa40f337e4d85a0b26fbdd919135c321eb3961a9b3d758abbc95376" standard verify_py311 copy_python_gdb ensurepip
install_package "Python-3.11.0a3" "https://www.python.org/ftp/python/3.11.0/Python-3.11.0a3.tar.xz#96fbe735d377dec46a007974d1315868bde9f06aea5e56dee99500d620d814a3" standard verify_py311 copy_python_gdb ensurepip
else
install_package "Python-3.11.0a1" "https://www.python.org/ftp/python/3.11.0/Python-3.11.0a1.tgz#d2c83771a671d0755d1cda5d82aaea70ef32d337fe5bf87036bd113fc088edff" standard verify_py311 copy_python_gdb ensurepip
install_package "Python-3.11.0a3" "https://www.python.org/ftp/python/3.11.0/Python-3.11.0a3.tgz#8af25618be3901a60d0d82176b91476c93dd8c086f40b849e9c4811424d13c35" standard verify_py311 copy_python_gdb ensurepip
fi

View File

@@ -1,6 +1,5 @@
#require_gcc
prefer_openssl11
export PYTHON_BUILD_CONFIGURE_WITH_OPENSSL=1
install_package "openssl-1.1.1k" "https://www.openssl.org/source/openssl-1.1.1k.tar.gz#892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5" 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

View File

@@ -0,0 +1,10 @@
#require_gcc
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
if has_tar_xz_support; then
install_package "Python-3.9.8" "https://www.python.org/ftp/python/3.9.8/Python-3.9.8.tar.xz#675ce09bf23c09836bf1969b744b1ea4c1a18c32788626632525f08444ebad5c" standard verify_py39 copy_python_gdb ensurepip
else
install_package "Python-3.9.8" "https://www.python.org/ftp/python/3.9.8/Python-3.9.8.tgz#7447fb8bb270942d620dd24faa7814b1383b61fa99029a240025fd81c1db8283" standard verify_py39 copy_python_gdb ensurepip
fi

View File

@@ -0,0 +1,10 @@
#require_gcc
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
if has_tar_xz_support; then
install_package "Python-3.9.9" "https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz#06828c04a573c073a4e51c4292a27c1be4ae26621c3edc7cf9318418ce3b6d27" standard verify_py39 copy_python_gdb ensurepip
else
install_package "Python-3.9.9" "https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz#2cc7b67c1f3f66c571acc42479cdf691d8ed6b47bee12c9b68430413a17a44ea" standard verify_py39 copy_python_gdb ensurepip
fi

View File

@@ -0,0 +1,19 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-ppc64le" )
install_script "Anaconda3-2021.11-Linux-ppc64le" "https://repo.continuum.io/archive/Anaconda3-2021.11-Linux-ppc64le.sh#7eb6a95925ee756240818599f8dcbba7a155adfb05ef6cd5336aa3c083de65f3" "anaconda" verify_py39
;;
"Linux-x86_64" )
install_script "Anaconda3-2021.11-Linux-x86_64" "https://repo.continuum.io/archive/Anaconda3-2021.11-Linux-x86_64.sh#fedf9e340039557f7b5e8a8a86affa9d299f5e9820144bd7b92ae9f7ee08ac60" "anaconda" verify_py39
;;
"MacOSX-x86_64" )
install_script "Anaconda3-2021.11-MacOSX-x86_64" "https://repo.continuum.io/archive/Anaconda3-2021.11-MacOSX-x86_64.sh#6a9217d1a08c599f860045d56ef64fc6c3e3112b55cc97f3d07c573d7bbcdb58" "anaconda" verify_py39
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Anaconda3 is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,22 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-x86_64" )
install_script "Mambaforge-4.10.3-10-Linux-x86_64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Mambaforge-4.10.3-10-Linux-x86_64.sh#8b789c619d03760e606a9c9b3d098414653f6037b80f16174ad94f0ee0c679d8" "miniconda" verify_py38
;;
"Linux-aarch64" )
install_script "Mambaforge-4.10.3-10-Linux-aarch64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Mambaforge-4.10.3-10-Linux-aarch64.sh#60a1d50c92fe1d48e2744effca9e7b51bfd5cc4e863dbcdb762ed48020703e3a" "miniconda" verify_py38
;;
"MacOSX-arm64" )
install_script "Mambaforge-4.10.3-10-MacOSX-arm64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Mambaforge-4.10.3-10-MacOSX-arm64.sh#72bc86612ab9435915b616c2edb076737cbabe2c33fd684d58c2f9ae72e1957c" "miniconda" verify_py39
;;
"MacOSX-x86_64" )
install_script "Mambaforge-4.10.3-10-MacOSX-x86_64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Mambaforge-4.10.3-10-MacOSX-x86_64.sh#7c44259a0982cd3ef212649678af5f0dd4e0bb7306e8fffc93601dd1d739ec0b" "miniconda" verify_py38
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Miniforge is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,4 @@
has_tar_xz_support \
&& { install=install_package; src="https://micropython.org/resources/source/micropython-1.16.tar.xz#48271fb5da97efc22325c3fc1d87ba45b32bab25673206d8d8136c25e4ff29a9"; } \
|| { install=install_zip; src="https://micropython.org/resources/source/micropython-1.16.zip#427adc00d2a99d102e4ce46d9eb4933d168e863f859bb3ce5b84735f0899c1ed"; }
$install micropython-1.16 "$src" micropython

View File

@@ -0,0 +1,4 @@
has_tar_xz_support \
&& { install=install_package; src="https://micropython.org/resources/source/micropython-1.17.tar.xz#e322f915cee784de0f8614779cdb88fce175956975b3864e2d1898a53638a2f7"; } \
|| { install=install_zip; src="https://micropython.org/resources/source/micropython-1.17.zip#4dfc60e2ba67e89c0b794c0533bb4e43a10d4e38095d0640b64b4faa9160f244"; }
$install micropython-1.17 "$src" micropython

View File

@@ -8,6 +8,9 @@ case "$(anaconda_architecture 2>/dev/null || true)" in
"MacOSX-x86_64" )
install_script "Miniconda3-latest-MacOSX-x86_64" "https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh" "miniconda" verify_py3_latest
;;
"MacOSX-arm64" )
install_script "Miniconda3-latest-MacOSX-arm64" "https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-arm64.sh" "miniconda" verify_py3_latest
;;
* )
{ echo
colorize 1 "ERROR"

View File

@@ -0,0 +1,25 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-ppc64le" )
install_script "Miniforge3-4.10.3-10-Linux-ppc64le" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Miniforge3-4.10.3-10-Linux-ppc64le.sh#8df85d4af3d2d24f86bb6784d4c196b770b7b9c0be8917d79aec9e08f517d0e9" "miniconda" verify_py38
;;
"Linux-x86_64" )
install_script "Miniforge3-4.10.3-10-Linux-x86_64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Miniforge3-4.10.3-10-Linux-x86_64.sh#8ed8cd582d16cd58e0ccd87e692fbe71de6365a51678b579b2f40d8d6f6e5771" "miniconda" verify_py38
;;
"Linux-aarch64" )
install_script "Miniforge3-4.10.3-10-Linux-aarch64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Miniforge3-4.10.3-10-Linux-aarch64.sh#b2d510c6cd0aac3964a7a7838a7f7376b804fbdd0ba04909ece53f883f624233" "miniconda" verify_py38
;;
"MacOSX-arm64" )
install_script "Miniforge3-4.10.3-10-MacOSX-arm64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Miniforge3-4.10.3-10-MacOSX-arm64.sh#bd4d59ead779a6e2d9af69fd8cdcaac8e1446191c59ab446ae8547a1aecd75b7" "miniconda" verify_py39
;;
"MacOSX-x86_64" )
install_script "Miniforge3-4.10.3-10-MacOSX-x86_64" "https://github.com/conda-forge/miniforge/releases/download/4.10.3-10/Miniforge3-4.10.3-10-MacOSX-x86_64.sh#7d325a5370664ec2fe1c09c3066c22fd905431f338c7eed31ad7e14c7ce4bd83" "miniconda" verify_py38
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of Miniforge is not available for $(anaconda_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,535 @@
From f146ca36f81075f222aa3a1595042597d96dfad3 Mon Sep 17 00:00:00 2001
From: Pablo Galindo Salgado <Pablogsal@gmail.com>
Date: Mon, 4 Oct 2021 00:39:54 +0100
Subject: [PATCH] bpo-45350: Rerun autoreconf with the pkg-config macros
(GH-28707)
diff --git a/aclocal.m4 b/aclocal.m4
index 987bfdf215..2f1bd37528 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -275,3 +275,347 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
AC_SUBST([OPENSSL_LDFLAGS])
])
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 11 (pkg-config-0.29.1)
+
+dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29.1])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+ [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])dnl PKG_PROG_PKG_CONFIG
+
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])dnl _PKG_CONFIG
+
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
+
+
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])dnl PKG_CHECK_MODULES
+
+
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+ [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_INSTALLDIR
+
+
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+ [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR
+
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+ [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+ [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+ [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+ AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+ [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+ [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+ [auto],[PKG_CHECK_MODULES([$1],[$2],
+ [m4_n([def_action_if_found]) $3],
+ [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+ [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+ [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
+
diff --git a/configure b/configure
index 753f956469..02d882ed39 100755
--- a/configure
+++ b/configure
@@ -630,7 +630,6 @@ OPENSSL_RPATH
OPENSSL_LDFLAGS
OPENSSL_LIBS
OPENSSL_INCLUDES
-PKG_CONFIG
ENSUREPIP
SRCDIRS
THREADHEADERS
@@ -662,6 +661,9 @@ DTRACE
TCLTK_LIBS
TCLTK_INCLUDES
LIBFFI_INCLUDEDIR
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
TZPATH
SHLIBS
CFLAGSFORSHARED
@@ -873,7 +875,10 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
-PROFILE_TASK'
+PROFILE_TASK
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR'
# Initialize some variables set by options.
@@ -1637,6 +1642,11 @@ Some influential environment variables:
CPP C preprocessor
PROFILE_TASK
Python args for PGO generation task
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -10542,7 +10552,126 @@ $as_echo "no" >&6; }
fi
-PKG_PROG_PKG_CONFIG
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+fi
# Check for use of the system expat library
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-system-expat" >&5
--
2.29.2.windows.2

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,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,240 @@
From 942db3e6b96225ef8330f5329c702d62483c6ef8 Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 17:14:34 +0900
Subject: [PATCH 3/6] Fix macOS _tkinter use of Tck/Tk in /Library/Framework
Modified and imported from https://github.com/Homebrew/formula-patches/blob/master/python/3.8.7.patch
---
setup.py | 147 ++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 107 insertions(+), 40 deletions(-)
diff --git a/setup.py b/setup.py
index e2c1898253..8e03c77997 100644
--- a/setup.py
+++ b/setup.py
@@ -91,6 +91,7 @@ def sysroot_paths(make_vars, subdirs):
return dirs
MACOS_SDK_ROOT = None
+MACOS_SDK_SPECIFIED = None
def macosx_sdk_root():
"""Return the directory of the current macOS SDK.
@@ -102,8 +103,9 @@ def macosx_sdk_root():
(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.
+ Also sets MACOS_SDK_SPECIFIED for use by macosx_sdk_specified().
"""
- global MACOS_SDK_ROOT
+ global MACOS_SDK_ROOT, MACOS_SDK_SPECIFIED
# If already called, return cached result.
if MACOS_SDK_ROOT:
@@ -113,8 +115,10 @@ def macosx_sdk_root():
m = re.search(r'-isysroot\s+(\S+)', cflags)
if m is not None:
MACOS_SDK_ROOT = m.group(1)
+ MACOS_SDK_SPECIFIED = MACOS_SDK_ROOT != '/'
else:
MACOS_SDK_ROOT = '/'
+ MACOS_SDK_SPECIFIED = False
cc = sysconfig.get_config_var('CC')
tmpfile = '/tmp/setup_sdk_root.%d' % os.getpid()
try:
@@ -142,6 +146,27 @@ def macosx_sdk_root():
return MACOS_SDK_ROOT
+def macosx_sdk_specified():
+ """Returns true if an SDK was explicitly configured.
+
+ True if an SDK was selected at configure time, either by specifying
+ --enable-universalsdk=(something other than no or /) or by adding a
+ -isysroot option to CFLAGS. In some cases, like when making
+ decisions about macOS Tk framework paths, we need to be able to
+ know whether the user explicitly asked to build with an SDK versus
+ the implicit use of an SDK when header files are no longer
+ installed on a running system by the Command Line Tools.
+ """
+ global MACOS_SDK_SPECIFIED
+
+ # If already called, return cached result.
+ if MACOS_SDK_SPECIFIED:
+ return MACOS_SDK_SPECIFIED
+
+ # Find the sdk root and set MACOS_SDK_SPECIFIED
+ macosx_sdk_root()
+ return MACOS_SDK_SPECIFIED
+
def is_macosx_sdk_path(path):
"""
Returns True if 'path' can be located in an OSX SDK
@@ -1758,31 +1783,72 @@ class PyBuildExt(build_ext):
return 1
def detect_tkinter_darwin(self, inc_dirs, lib_dirs):
- # The _tkinter module, using frameworks. Since frameworks are quite
- # different the UNIX search logic is not sharable.
- from os.path import join, exists
- framework_dirs = [
- '/Library/Frameworks',
- '/System/Library/Frameworks/',
- join(os.getenv('HOME'), '/Library/Frameworks')
- ]
+ # Build default _tkinter on macOS using Tcl and Tk frameworks.
+ #
+ # The macOS native Tk (AKA Aqua Tk) and Tcl are most commonly
+ # built and installed as macOS framework bundles. However,
+ # for several reasons, we cannot take full advantage of the
+ # Apple-supplied compiler chain's -framework options here.
+ # Instead, we need to find and pass to the compiler the
+ # absolute paths of the Tcl and Tk headers files we want to use
+ # and the absolute path to the directory containing the Tcl
+ # and Tk frameworks for linking.
+ #
+ # We want to handle here two common use cases on macOS:
+ # 1. Build and link with system-wide third-party or user-built
+ # Tcl and Tk frameworks installed in /Library/Frameworks.
+ # 2. Build and link using a user-specified macOS SDK so that the
+ # built Python can be exported to other systems. In this case,
+ # search only the SDK's /Library/Frameworks (normally empty)
+ # and /System/Library/Frameworks.
+ #
+ # Any other use case should be able to be handled explicitly by
+ # using the options described above in detect_tkinter_explicitly().
+ # In particular it would be good to handle here the case where
+ # you want to build and link with a framework build of Tcl and Tk
+ # that is not in /Library/Frameworks, say, in your private
+ # $HOME/Library/Frameworks directory or elsewhere. It turns
+ # out to be difficult to make that work automtically here
+ # without bringing into play more tools and magic. That case
+ # can be hamdled using a recipe with the right arguments
+ # to detect_tkinter_explicitly().
+ #
+ # Note also that the fallback case here is to try to use the
+ # Apple-supplied Tcl and Tk frameworks in /System/Library but
+ # be forewarned that they are deprecated by Apple and typically
+ # out-of-date and buggy; their use should be avoided if at
+ # all possible by installing a newer version of Tcl and Tk in
+ # /Library/Frameworks before bwfore building Python without
+ # an explicit SDK or by configuring build arguments explicitly.
- sysroot = macosx_sdk_root()
+ from os.path import join, exists
+ sysroot = macosx_sdk_root() # path to the SDK or '/'
+
+ if macosx_sdk_specified():
+ # Use case #2: an SDK other than '/' was specified.
+ # Only search there.
+ framework_dirs = [
+ join(sysroot, 'Library', 'Frameworks'),
+ join(sysroot, 'System', 'Library', 'Frameworks'),
+ ]
+ else:
+ # Use case #1: no explicit SDK selected.
+ # Search the local system-wide /Library/Frameworks,
+ # not the one in the default SDK, othewise fall back to
+ # /System/Library/Frameworks whose header files may be in
+ # the default SDK or, on older systems, actually installed.
+ framework_dirs = [
+ join('/', 'Library', 'Frameworks'),
+ join(sysroot, 'System', 'Library', 'Frameworks'),
+ ]
- # Find the directory that contains the Tcl.framework and Tk.framework
- # bundles.
- # XXX distutils should support -F!
+ # Find the directory that contains the Tcl.framework and
+ # Tk.framework bundles.
for F in framework_dirs:
# both Tcl.framework and Tk.framework should be present
-
-
for fw in 'Tcl', 'Tk':
- if is_macosx_sdk_path(F):
- if not exists(join(sysroot, F[1:], fw + '.framework')):
- break
- else:
- if not exists(join(F, fw + '.framework')):
- break
+ if not exists(join(F, fw + '.framework')):
+ break
else:
# ok, F is now directory with both frameworks. Continure
# building
@@ -1792,24 +1858,16 @@ class PyBuildExt(build_ext):
# will now resume.
return 0
- # For 8.4a2, we must add -I options that point inside the Tcl and Tk
- # frameworks. In later release we should hopefully be able to pass
- # the -F option to gcc, which specifies a framework lookup path.
- #
include_dirs = [
join(F, fw + '.framework', H)
for fw in ('Tcl', 'Tk')
- for H in ('Headers', 'Versions/Current/PrivateHeaders')
+ for H in ('Headers',)
]
- # For 8.4a2, the X11 headers are not included. Rather than include a
- # complicated search, this is a hard-coded path. It could bail out
- # if X11 libs are not found...
- include_dirs.append('/usr/X11R6/include')
- frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
+ # Add the base framework directory as well
+ compile_args = ['-F', F]
- # All existing framework builds of Tcl/Tk don't support 64-bit
- # architectures.
+ # Do not build tkinter for archs that this Tk was not built with.
cflags = sysconfig.get_config_vars('CFLAGS')[0]
archs = re.findall(r'-arch\s+(\w+)', cflags)
@@ -1819,10 +1877,7 @@ class PyBuildExt(build_ext):
# Note: cannot use os.popen or subprocess here, that
# requires extensions that are not available here.
- if is_macosx_sdk_path(F):
- os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(os.path.join(sysroot, F[1:]), tmpfile))
- else:
- os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F, tmpfile))
+ os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F, tmpfile))
with open(tmpfile) as fp:
detected_archs = []
@@ -1832,16 +1887,26 @@ class PyBuildExt(build_ext):
detected_archs.append(ln.split()[-1])
os.unlink(tmpfile)
+ arch_args = []
for a in detected_archs:
- frameworks.append('-arch')
- frameworks.append(a)
+ arch_args.append('-arch')
+ arch_args.append(a)
+
+ compile_args += arch_args
+ link_args = [','.join(['-Wl', '-F', F, '-framework', 'Tcl', '-framework', 'Tk'])] + arch_args
+
+ # The X11/xlib.h file bundled in the Tk sources can cause function
+ # prototype warnings from the compiler. Since we cannot easily fix
+ # that, suppress the warnings here instead.
+ if '-Wstrict-prototypes' in cflags.split():
+ compile_args.append('-Wno-strict-prototypes')
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
define_macros=[('WITH_APPINIT', 1)],
include_dirs = include_dirs,
libraries = [],
- extra_compile_args = frameworks[2:],
- extra_link_args = frameworks,
+ extra_compile_args = compile_args,
+ extra_link_args = link_args,
)
self.extensions.append(ext)
return 1
--
2.30.1 (Apple Git-130)

View File

@@ -0,0 +1,315 @@
From: Christian Hammond <christian@beanbaginc.com>
Date: Wed, 15 Dec 2021 23:12:36 -0800
Subject: Port ctypes and system libffi patches for arm64/macOS 10.15+ to Python 3.6.15
This ports the following ctypes and libffi pyenv patches for Python
2.7.18 to Python 3.6.15:
* `0004-Use-system-libffi-for-Mac-OS-10.15-and-up.patch`
* `0005-ctypes-use-the-correct-ABI-for-variadic-functions.patch`
* `0006-ctypes-probe-libffi-for-ffi_closure_alloc-and-ffi_pr.patch`
These patches enable use of system libffi (fixing a broken `ctypes`
module on arm64 targets) and enable calling variadic functions on arm64.
They've been combined from patches port from Homebrew to pyenv by Takumi
Sueda, updated to work on the Python 3.6.15 codebase.
The Homebrew patches are themselves backports of changes in Python 3.9
and 3.10. That patch can be found at:
https://github.com/Homebrew/formula-patches/blob/master/python/3.8.7.patch
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index a7cc0c84df..f25f3c78d9 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -1551,6 +1551,13 @@ They are instances of a private class:
value usable as argument (integer, string, ctypes instance). This allows
defining adapters that can adapt custom objects as function parameters.
+ .. attribute:: variadic
+
+ Assign a boolean to specify that the function takes a variable number of
+ arguments. This does not matter on most platforms, but for Apple arm64
+ platforms variadic functions have a different calling convention than
+ normal functions.
+
.. attribute:: errcheck
Assign a Python function or another callable to this attribute. The
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 56ab0ad732..013b1e9ce7 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -2443,11 +2443,14 @@ class CAPITest(unittest.TestCase):
def test_from_format(self):
support.import_module('ctypes')
from ctypes import (
+ c_char_p,
pythonapi, py_object, sizeof,
c_int, c_long, c_longlong, c_ssize_t,
c_uint, c_ulong, c_ulonglong, c_size_t, c_void_p)
name = "PyUnicode_FromFormat"
_PyUnicode_FromFormat = getattr(pythonapi, name)
+ _PyUnicode_FromFormat.argtypes = (c_char_p,)
+ _PyUnicode_FromFormat.variadic = True
_PyUnicode_FromFormat.restype = py_object
def PyUnicode_FromFormat(format, *args):
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 24d64858ed..351f274ad3 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3120,6 +3120,34 @@ PyCFuncPtr_get_restype(PyCFuncPtrObject *self, void *Py_UNUSED(ignored))
}
}
+static int
+PyCFuncPtr_set_variadic(PyCFuncPtrObject *self, PyObject *ob)
+{
+ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
+ assert(dict);
+ int r = PyObject_IsTrue(ob);
+ if (r == 1) {
+ dict->flags |= FUNCFLAG_VARIADIC;
+ return 0;
+ } else if (r == 0) {
+ dict->flags &= ~FUNCFLAG_VARIADIC;
+ return 0;
+ } else {
+ return -1;
+ }
+}
+
+static PyObject *
+PyCFuncPtr_get_variadic(PyCFuncPtrObject *self)
+{
+ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
+ assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
+ if (dict->flags & FUNCFLAG_VARIADIC)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
static int
PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
{
@@ -3166,6 +3194,8 @@ static PyGetSetDef PyCFuncPtr_getsets[] = {
{ "argtypes", (getter)PyCFuncPtr_get_argtypes,
(setter)PyCFuncPtr_set_argtypes,
"specify the argument types", NULL },
+ { "variadic", (getter)PyCFuncPtr_get_variadic, (setter)PyCFuncPtr_set_variadic,
+ "specify if function takes variable number of arguments", NULL },
{ NULL, NULL }
};
@@ -5576,6 +5606,7 @@ PyInit__ctypes(void)
PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyLong_FromLong(FUNCFLAG_USE_ERRNO));
PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyLong_FromLong(FUNCFLAG_USE_LASTERROR));
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
+ PyModule_AddObject(m, "FUNCFLAG_VARIADIC", PyLong_FromLong(FUNCFLAG_VARIADIC));
PyModule_AddStringConstant(m, "__version__", "1.1.0");
PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 2bb289bce0..12951eadbf 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -752,7 +754,8 @@ static int _call_function_pointer(int flags,
ffi_type **atypes,
ffi_type *restype,
void *resmem,
- int argcount)
+ int argcount,
+ int argtypecount)
{
#ifdef WITH_THREAD
PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
@@ -780,15 +783,39 @@ static int _call_function_pointer(int flags,
if ((flags & FUNCFLAG_CDECL) == 0)
cc = FFI_STDCALL;
#endif
- if (FFI_OK != ffi_prep_cif(&cif,
- cc,
- argcount,
- restype,
- atypes)) {
- PyErr_SetString(PyExc_RuntimeError,
- "ffi_prep_cif failed");
- return -1;
+
+#if HAVE_FFI_PREP_CIF_VAR
+ /* Everyone SHOULD set f.variadic=True on variadic function pointers, but
+ * lots of existing code will not. If there's at least one arg and more
+ * args are passed than are defined in the prototype, then it must be a
+ * variadic function. */
+ if ((flags & FUNCFLAG_VARIADIC) ||
+ (argtypecount != 0 && argcount > argtypecount))
+ {
+ if (FFI_OK != ffi_prep_cif_var(&cif,
+ cc,
+ argtypecount,
+ argcount,
+ restype,
+ atypes)) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "ffi_prep_cif_var failed");
+ return -1;
+ }
+ } else {
+#endif
+ if (FFI_OK != ffi_prep_cif(&cif,
+ cc,
+ argcount,
+ restype,
+ atypes)) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "ffi_prep_cif failed");
+ return -1;
+ }
+#if HAVE_FFI_PREP_CIF_VAR
}
+#endif
if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) {
error_object = _ctypes_get_errobj(&space);
@@ -1181,9 +1208,8 @@ PyObject *_ctypes_callproc(PPROC pProc,
if (-1 == _call_function_pointer(flags, pProc, avalues, atypes,
rtype, resbuf,
- Py_SAFE_DOWNCAST(argcount,
- Py_ssize_t,
- int)))
+ Py_SAFE_DOWNCAST(argcount, Py_ssize_t, int),
+ Py_SAFE_DOWNCAST(argtype_count, Py_ssize_t, int)))
goto cleanup;
#ifdef WORDS_BIGENDIAN
diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index 5d3b966338..1299ec25aa 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -285,6 +285,7 @@ PyObject *_ctypes_callproc(PPROC pProc,
#define FUNCFLAG_PYTHONAPI 0x4
#define FUNCFLAG_USE_ERRNO 0x8
#define FUNCFLAG_USE_LASTERROR 0x10
+#define FUNCFLAG_VARIADIC 0x20
#define TYPEFLAG_ISPOINTER 0x100
#define TYPEFLAG_HASPOINTER 0x200
diff --git a/setup.py b/setup.py
index 8e03c77997..3b124c4b7b 100644
--- a/setup.py
+++ b/setup.py
@@ -167,6 +167,13 @@ def macosx_sdk_specified():
macosx_sdk_root()
return MACOS_SDK_SPECIFIED
+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
@@ -175,6 +182,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
@@ -2115,7 +2129,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 = []
@@ -2162,20 +2180,30 @@ class PyBuildExt(build_ext):
libraries=math_libs)
self.extensions.extend([ext, ext_test])
+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
+ ffi_lib = None
+ inc_dirs = self.compiler.include_dirs[:]
+
if host_platform == 'darwin':
- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
- return
- # OS X 10.5 comes with libffi.dylib; the include files are
- # in /usr/include/ffi
- inc_dirs.append('/usr/include/ffi')
+ 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
- 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 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()
@@ -2186,15 +2214,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', 'ffi_pic'):
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.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,312 @@
From: Christian Hammond <christian@beanbaginc.com>
Date: Wed, 15 Dec 2021 23:12:36 -0800
Subject: Port ctypes and system libffi patches for arm64/macOS 10.15+ to Python 3.7.12
This ports the following ctypes and libffi pyenv patches for Python
2.7.18 to Python 3.7.12:
* `0004-Use-system-libffi-for-Mac-OS-10.15-and-up.patch`
* `0005-ctypes-use-the-correct-ABI-for-variadic-functions.patch`
* `0006-ctypes-probe-libffi-for-ffi_closure_alloc-and-ffi_pr.patch`
These patches enable use of system libffi (fixing a broken `ctypes`
module on arm64 targets) and enable calling variadic functions on arm64.
They've been combined from patches port from Homebrew to pyenv by Takumi
Sueda, updated to work on the Python 3.7.12 codebase.
The Homebrew patches are themselves backports of changes in Python 3.9
and 3.10. That patch can be found at:
https://github.com/Homebrew/formula-patches/blob/master/python/3.8.7.patch
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index 715d595b24..7743144978 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -1551,6 +1551,13 @@ They are instances of a private class:
value usable as argument (integer, string, ctypes instance). This allows
defining adapters that can adapt custom objects as function parameters.
+ .. attribute:: variadic
+
+ Assign a boolean to specify that the function takes a variable number of
+ arguments. This does not matter on most platforms, but for Apple arm64
+ platforms variadic functions have a different calling convention than
+ normal functions.
+
.. attribute:: errcheck
Assign a Python function or another callable to this attribute. The
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 4ebd82d3e0..7b73c190b6 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -2458,11 +2458,14 @@ class CAPITest(unittest.TestCase):
def test_from_format(self):
support.import_module('ctypes')
from ctypes import (
+ c_char_p,
pythonapi, py_object, sizeof,
c_int, c_long, c_longlong, c_ssize_t,
c_uint, c_ulong, c_ulonglong, c_size_t, c_void_p)
name = "PyUnicode_FromFormat"
_PyUnicode_FromFormat = getattr(pythonapi, name)
+ _PyUnicode_FromFormat.argtypes = (c_char_p,)
+ _PyUnicode_FromFormat.variadic = True
_PyUnicode_FromFormat.restype = py_object
def PyUnicode_FromFormat(format, *args):
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index dd0c61fd8a..79137e1dc7 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3174,6 +3174,34 @@ PyCFuncPtr_get_restype(PyCFuncPtrObject *self, void *Py_UNUSED(ignored))
}
}
+static int
+PyCFuncPtr_set_variadic(PyCFuncPtrObject *self, PyObject *ob)
+{
+ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
+ assert(dict);
+ int r = PyObject_IsTrue(ob);
+ if (r == 1) {
+ dict->flags |= FUNCFLAG_VARIADIC;
+ return 0;
+ } else if (r == 0) {
+ dict->flags &= ~FUNCFLAG_VARIADIC;
+ return 0;
+ } else {
+ return -1;
+ }
+}
+
+static PyObject *
+PyCFuncPtr_get_variadic(PyCFuncPtrObject *self)
+{
+ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
+ assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
+ if (dict->flags & FUNCFLAG_VARIADIC)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
static int
PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
{
@@ -3219,6 +3247,8 @@ static PyGetSetDef PyCFuncPtr_getsets[] = {
{ "argtypes", (getter)PyCFuncPtr_get_argtypes,
(setter)PyCFuncPtr_set_argtypes,
"specify the argument types", NULL },
+ { "variadic", (getter)PyCFuncPtr_get_variadic, (setter)PyCFuncPtr_set_variadic,
+ "specify if function takes variable number of arguments", NULL },
{ NULL, NULL }
};
@@ -5632,6 +5662,7 @@ PyInit__ctypes(void)
PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyLong_FromLong(FUNCFLAG_USE_ERRNO));
PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyLong_FromLong(FUNCFLAG_USE_LASTERROR));
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
+ PyModule_AddObject(m, "FUNCFLAG_VARIADIC", PyLong_FromLong(FUNCFLAG_VARIADIC));
PyModule_AddStringConstant(m, "__version__", "1.1.0");
PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 9cbf9801ad..e7fe11176b 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -754,7 +756,8 @@ static int _call_function_pointer(int flags,
ffi_type **atypes,
ffi_type *restype,
void *resmem,
- int argcount)
+ int argcount,
+ int argtypecount)
{
PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
PyObject *error_object = NULL;
@@ -780,15 +783,39 @@ static int _call_function_pointer(int flags,
if ((flags & FUNCFLAG_CDECL) == 0)
cc = FFI_STDCALL;
#endif
- if (FFI_OK != ffi_prep_cif(&cif,
- cc,
- argcount,
- restype,
- atypes)) {
- PyErr_SetString(PyExc_RuntimeError,
- "ffi_prep_cif failed");
- return -1;
+
+#if HAVE_FFI_PREP_CIF_VAR
+ /* Everyone SHOULD set f.variadic=True on variadic function pointers, but
+ * lots of existing code will not. If there's at least one arg and more
+ * args are passed than are defined in the prototype, then it must be a
+ * variadic function. */
+ if ((flags & FUNCFLAG_VARIADIC) ||
+ (argtypecount != 0 && argcount > argtypecount))
+ {
+ if (FFI_OK != ffi_prep_cif_var(&cif,
+ cc,
+ argtypecount,
+ argcount,
+ restype,
+ atypes)) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "ffi_prep_cif_var failed");
+ return -1;
+ }
+ } else {
+#endif
+ if (FFI_OK != ffi_prep_cif(&cif,
+ cc,
+ argcount,
+ restype,
+ atypes)) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "ffi_prep_cif failed");
+ return -1;
+ }
+#if HAVE_FFI_PREP_CIF_VAR
}
+#endif
if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) {
error_object = _ctypes_get_errobj(&space);
@@ -1187,9 +1214,8 @@ PyObject *_ctypes_callproc(PPROC pProc,
if (-1 == _call_function_pointer(flags, pProc, avalues, atypes,
rtype, resbuf,
- Py_SAFE_DOWNCAST(argcount,
- Py_ssize_t,
- int)))
+ Py_SAFE_DOWNCAST(argcount, Py_ssize_t, int),
+ Py_SAFE_DOWNCAST(argtype_count, Py_ssize_t, int)))
goto cleanup;
#ifdef WORDS_BIGENDIAN
diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index e58f85233c..e45975f6ad 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -285,6 +285,7 @@ PyObject *_ctypes_callproc(PPROC pProc,
#define FUNCFLAG_PYTHONAPI 0x4
#define FUNCFLAG_USE_ERRNO 0x8
#define FUNCFLAG_USE_LASTERROR 0x10
+#define FUNCFLAG_VARIADIC 0x20
#define TYPEFLAG_ISPOINTER 0x100
#define TYPEFLAG_HASPOINTER 0x200
diff --git a/setup.py b/setup.py
index bf90600eaa..48ff120e9a 100644
--- a/setup.py
+++ b/setup.py
@@ -142,6 +142,13 @@ def macosx_sdk_root():
return MACOS_SDK_ROOT
+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
@@ -150,6 +157,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
@@ -1972,7 +1986,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 = []
@@ -2018,30 +2036,49 @@ class PyBuildExt(build_ext):
libraries=['m'])
self.extensions.extend([ext, ext_test])
+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
+ ffi_lib = None
+
+ #inc_dirs = self.inc_dirs.copy()
+ inc_dirs = self.compiler.include_dirs[:]
if host_platform == 'darwin':
- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
+ if not self.use_system_libffi:
return
- # 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'
+ 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')
+
+ 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'
if not os.path.exists(ffi_h):
ffi_inc = None
print('Header file {} does not exist'.format(ffi_h))
- ffi_lib = None
- if ffi_inc is not None:
- for lib_name in ('ffi', 'ffi_pic'):
+
+ if ffi_lib is None and ffi_inc:
+ 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.30.1 (Apple Git-130)

View File

@@ -0,0 +1,36 @@
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,39 @@
VERSION='7.3.2'
PYVER='2.7'
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
install_package "pypy${PYVER}-v${VERSION}-linux32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux32.tar.bz2#78f30ac17abe3cc077fc2456ef55adb51b052c5126011b2a32bacc858acaca7d" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux64" )
install_package "pypy${PYVER}-v${VERSION}-linux64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux64.tar.bz2#8d4f08116a97153a0f739de8981874d544b564cbc87dd064cca33f36c29da13b" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux-aarch64" )
install_package "pypy${PYVER}-v${VERSION}-aarch64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-aarch64.tar.bz2#fce1f06f20ab8bcacb9ac1c33572d6425033de53c3a93fbd5391189cc3e106cb" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"osx64" )
if require_osx_version "10.13"; then
install_package "pypy${PYVER}-v${VERSION}-osx64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-osx64.tar.bz2#10ca57050793923aea3808b9c8669cf53b7342c90c091244e9660bf797d397c7" "pypy" "verify_py${PYVER//./}" ensurepip
else
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true), OS X < 10.13."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
fi
;;
"win32" )
install_zip "pypy${PYVER}-v${VERSION}-win32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win32.zip#0fd62265e0421a02432f10a294a712a5e784a8e061375e6d8ea5fd619be1be62" "pypy" "verify_py${PYVER//./}" ensurepip
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,4 @@
#require_gcc
prefer_openssl11
install_package "openssl-1.1.1f" "https://www.openssl.org/source/openssl-1.1.1f.tar.gz#186c6bfe6ecfba7a5b48c47f8a1673d0f3b0e5ba2e25602dd23b629975da3f35" mac_openssl --if has_broken_mac_openssl
install_package "pypy2.7-v7.3.2-src" "https://downloads.python.org/pypy/pypy2.7-v7.3.2-src.tar.bz2#8189480d8350ad6364d05c2b39fd7d832644d4b1cd018f785126389df45928d1" "pypy_builder" verify_py27 ensurepip

View File

@@ -0,0 +1,39 @@
VERSION='7.3.3'
PYVER='2.7'
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
install_package "pypy${PYVER}-v${VERSION}-linux32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux32.tar.bz2#bfbc81874b137837a8ba8c517b97de29f5a336f7ec500c52f2bfdbd3580d1703" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux64" )
install_package "pypy${PYVER}-v${VERSION}-linux64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux64.tar.bz2#f412b602ccd6912ddee0e7523e0e38f4b2c7a144449c2cad078cffbdb66fd7b1" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux-aarch64" )
install_package "pypy${PYVER}-v${VERSION}-aarch64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-aarch64.tar.bz2#23b145b7cfbaeefb6ee76fc8216c83b652ab1daffac490558718edbbd60082d8" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"osx64" )
if require_osx_version "10.13"; then
install_package "pypy${PYVER}-v${VERSION}-osx64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-osx64.tar.bz2#f34dc4f5ded1f6bcea05841aa9781b9307329e3ab755607917148568824ae0b0" "pypy" "verify_py${PYVER//./}" ensurepip
else
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true), OS X < 10.13."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
fi
;;
"win32" )
install_zip "pypy${PYVER}-v${VERSION}-win32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win32.zip#b3e660dae8d25d8278fd6a0db77e76a16ac9a8c1dca22e7e103d39ed696dc69e" "pypy" "verify_py${PYVER//./}" ensurepip
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,4 @@
#require_gcc
prefer_openssl11
install_package "openssl-1.1.1f" "https://www.openssl.org/source/openssl-1.1.1f.tar.gz#186c6bfe6ecfba7a5b48c47f8a1673d0f3b0e5ba2e25602dd23b629975da3f35" mac_openssl --if has_broken_mac_openssl
install_package "pypy2.7-v7.3.3-src" "https://downloads.python.org/pypy/pypy2.7-v7.3.3-src.tar.bz2#f63488051ba877fd65840bf8d53822a9c6423d947839023b8720139f4b6e2336" "pypy_builder" verify_py27 ensurepip

View File

@@ -0,0 +1,39 @@
VERSION='7.3.4'
PYVER='2.7'
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
install_package "pypy${PYVER}-v${VERSION}-linux32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux32.tar.bz2#653cc3f0612399e494021027f4463d62639dffa4345736a16d0704f3f8a61d5f" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux64" )
install_package "pypy${PYVER}-v${VERSION}-linux64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux64.tar.bz2#d3f7b0625e770d9be62201765d7d2316febc463372fba9c93a12969d26ae03dd" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux-aarch64" )
install_package "pypy${PYVER}-v${VERSION}-aarch64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-aarch64.tar.bz2#9e741162ce486b14fbcf5aa377796d26b0529a9352fb602ee8b66c005f8420d1" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"osx64" )
if require_osx_version "10.13"; then
install_package "pypy${PYVER}-v${VERSION}-osx64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-osx64.tar.bz2#ee7bf42ce843596521e02c763408a5164d18f23c9617f1b8e032ce0675686582" "pypy" "verify_py${PYVER//./}" ensurepip
else
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true), OS X < 10.13."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
fi
;;
"win32" )
install_zip "pypy${PYVER}-v${VERSION}-win32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win32.zip#1080012d7a3cea65182528259b51d52b1f61a3717377c2d9ba11ef36e06162d5" "pypy" "verify_py${PYVER//./}" ensurepip
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,4 @@
#require_gcc
prefer_openssl11
install_package "openssl-1.1.1f" "https://www.openssl.org/source/openssl-1.1.1f.tar.gz#186c6bfe6ecfba7a5b48c47f8a1673d0f3b0e5ba2e25602dd23b629975da3f35" mac_openssl --if has_broken_mac_openssl
install_package "pypy2.7-v7.3.4-src" "https://downloads.python.org/pypy/pypy2.7-v7.3.4-src.tar.bz2#ff9b928237767efe08ccfba79dae489519b3c768fb6e3af52d39c2a8a1c21ca4" "pypy_builder" verify_py27 ensurepip

View File

@@ -0,0 +1,39 @@
VERSION='7.3.5'
PYVER='2.7'
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
install_package "pypy${PYVER}-v${VERSION}-linux32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux32.tar.bz2#35bb5cb1dcca8e05dc58ba0a4b4d54f8b4787f24dfc93f7562f049190e4f0d94" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux64" )
install_package "pypy${PYVER}-v${VERSION}-linux64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux64.tar.bz2#4858b347801fba3249ad90af015b3aaec9d57f54d038a58d806a1bd3217d5150" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux-aarch64" )
install_package "pypy${PYVER}-v${VERSION}-aarch64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-aarch64.tar.bz2#8dc2c753f8a94eca1a304d7736c99b439c09274f492eaa3446770c6c32ed010e" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"osx64" )
if require_osx_version "10.13"; then
install_package "pypy${PYVER}-v${VERSION}-osx64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-osx64.tar.bz2#8b10442ef31c3b28048816f858adde6d6858a190d9367001a49648e669cbebb6" "pypy" "verify_py${PYVER//./}" ensurepip
else
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true), OS X < 10.13."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
fi
;;
"win32" )
install_zip "pypy${PYVER}-v${VERSION}-win32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win32.zip#0b90eded11ba89a526c4288f17fff7e75000914ac071bd6d67912748ae89d761" "pypy" "verify_py${PYVER//./}" ensurepip
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,4 @@
#require_gcc
prefer_openssl11
install_package "openssl-1.1.1f" "https://www.openssl.org/source/openssl-1.1.1f.tar.gz#186c6bfe6ecfba7a5b48c47f8a1673d0f3b0e5ba2e25602dd23b629975da3f35" mac_openssl --if has_broken_mac_openssl
install_package "pypy2.7-v7.3.5-src" "https://downloads.python.org/pypy/pypy2.7-v7.3.5-src.tar.bz2#c0444fd9873058c1c0d99e13a934e92285cb05992c9968bf523c32bf9bec0a9d" "pypy_builder" verify_py27 ensurepip

View File

@@ -0,0 +1,39 @@
VERSION='7.3.6'
PYVER='2.7'
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
install_package "pypy${PYVER}-v${VERSION}-linux32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux32.tar.bz2#7a1145f3a278ffab4da0e2d4c4bd024ab8d67106a502e4bb7f6d67337e7af2b7" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux64" )
install_package "pypy${PYVER}-v${VERSION}-linux64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-linux64.tar.bz2#82127f43fae6ce75d47d6c4539f8c1ea372e9c2dbfa40fae8b58351d522793a4" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"linux-aarch64" )
install_package "pypy${PYVER}-v${VERSION}-aarch64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-aarch64.tar.bz2#9a97de82037d4be1949ec0c35a4d638ba635e8b34948549ae2fa08abd2cbaa8c" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"osx64" )
if require_osx_version "10.13"; then
install_package "pypy${PYVER}-v${VERSION}-osx64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-osx64.tar.bz2#8b10442ef31c3b28048816f858adde6d6858a190d9367001a49648e669cbebb6" "pypy" "verify_py${PYVER//./}" ensurepip
else
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true), OS X < 10.13."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
fi
;;
"win32" )
install_zip "pypy${PYVER}-v${VERSION}-win32" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win32.zip#fcc8f6b3b472a77eaa754951f288fe234b4953bfba845888dd839b9b862cb891" "pypy" "verify_py${PYVER//./}" ensurepip
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo "try 'pypy${PYVER}-${VERSION}-src' to build from source."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,4 @@
#require_gcc
prefer_openssl11
install_package "openssl-1.1.1f" "https://www.openssl.org/source/openssl-1.1.1f.tar.gz#186c6bfe6ecfba7a5b48c47f8a1673d0f3b0e5ba2e25602dd23b629975da3f35" mac_openssl --if has_broken_mac_openssl
install_package "pypy2.7-v7.3.6-src" "https://downloads.python.org/pypy/pypy2.7-v7.3.6-src.tar.bz2#0114473c8c57169cdcab1a69c60ad7fef7089731fdbe6f46af55060b29be41e4" "pypy_builder" verify_py27 ensurepip

View File

@@ -183,7 +183,7 @@ OUT
}
@test "pyenv-install has usage help preface" {
run head "$(which pyenv-install)"
run head "$(command -v pyenv-install)"
assert_output_contains 'Usage: pyenv install'
}
@@ -212,6 +212,6 @@ OUT
}
@test "pyenv-uninstall has usage help preface" {
run head "$(which pyenv-uninstall)"
run head "$(command -v pyenv-uninstall)"
assert_output_contains 'Usage: pyenv uninstall'
}

View File

@@ -116,12 +116,12 @@ path_without() {
local path=":${PATH}:"
for exe; do
local found alt util
for found in $(PATH="$path" which -a "$exe"); do
for found in $(PATH="$path" type -aP "$exe"); do
found="${found%/*}"
if [ "$found" != "${PYENV_ROOT}/shims" ]; then
alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')"
mkdir -p "$alt"
for util in bash head cut readlink greadlink which; do
for util in bash head cut readlink greadlink; do
if [ -x "${found}/$util" ]; then
ln -s "${found}/$util" "${alt}/$util"
fi