1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-08 19:43:48 -05:00

Compare commits

...

63 Commits

Author SHA1 Message Date
Anton Petrov
066c05336f Update pyenv---version 2021-10-27 11:15:57 +03:00
Anton Petrov
1fa027af1e Update CHANGELOG.md 2021-10-27 11:15:29 +03:00
Ivan Pozdeev
a0cc289d15 Added a wiki page on how to setup shell as a login shell in MacOS 2021-10-27 00:27:14 +03:00
Danny Hermes
4bbf7d7bb0 Adding PyPy release 7.3.7 (Python 3.7 and 3.8). (#2132) 2021-10-26 05:09:48 +03:00
native-api
4b82f575c7 Append Homebrew custom prefix to search path (#1957)
This is needed to find other Python deps (e.g. libintl) in Homebrew if it has
nonstandard prefix (e.g. in Apple M1)

* Re-allow to search Homebrew for zlib everywhere
2021-10-26 04:36:01 +03:00
amd-9
c0d8b9cfe8 Add documentation for init command (#2125) 2021-10-25 15:30:50 +03:00
native-api
0388da7d0b Add setup instructions for the case when one installs Pyenv as part of a batch job (#2127) 2021-10-25 01:08:57 +03:00
amd-9
13efdea9ab Add documentation for completions command (#2126) 2021-10-24 23:33:32 +03:00
native-api
8db91d5516 Default --with-universal-archs to universal2 on Apple Silicon (#2122)
Don't override a user-supplied value
2021-10-23 22:01:57 +03:00
Khushl Vora
a015760854 Update README.md (#2120)
Minor changes to make the docs better.
2021-10-23 17:33:18 +03:00
Michael Šimáček
d4f45b0096 Add GraalPython 21.3.0 (#2117) 2021-10-21 18:04:03 +03:00
native-api
444088b1db Merge pull request #2111 from dand-oss/pypy3.8-7.3.6
Pypy ver 7.3.6 - python 3.7 and python 3.8
2021-10-19 17:20:46 +03:00
Dan Dees
09877f45cb pypy3.8-7.3.6 2021-10-19 09:36:29 -04:00
Dan Dees
f864294e0e pypy3.7-7.3.6 2021-10-19 09:36:29 -04:00
native-api
5963dc4f61 Discover Tcl/Tk reliably and use active version (#2106)
Link to the active version like other Homebrew deps --
this won't break when another binary-compatible version is installed.
Use a discovery method that doesn't break when other versions are present alongside.
2021-10-16 14:51:39 +03:00
native-api
0915c5b7b6 Update README.md 2021-10-16 01:57:05 +03:00
native-api
ed38af6409 Add Homerew alias to fix brew doctor's warning
Closes #106
2021-10-15 22:15:25 +03:00
native-api
208be7d6af Update ISSUE_TEMPLATE.md 2021-10-14 12:13:46 +03:00
Marcin Konowalczyk
07aa659dbb fish installation instructions (#2104) 2021-10-12 14:09:15 +03:00
native-api
88c3404997 Update ISSUE_TEMPLATE.md 2021-10-08 11:56:08 +03:00
native-api
3a35f43eb4 Update FUNDING.yml 2021-10-08 11:47:01 +03:00
Ivan Pozdeev
9a42b48da4 Merge branch 'master' of https://github.com/pyenv/pyenv 2021-10-07 02:37:36 +03:00
Ivan Pozdeev
f5cc25ed14 Fix "`build_package_pyston2.2': not a valid identifier" 2021-10-07 02:37:04 +03:00
Anton Petrov
e0e3244015 Merge pull request #2099 from nedbat/master
Add CPython 3.11.0a1
2021-10-06 14:48:38 +03:00
Ned Batchelder
9c72c27d76 Add CPython 3.11.0a1 2021-10-06 07:25:55 -04:00
Anton Petrov
483d95d6d2 Remove travis build status 2021-10-05 17:49:38 +03:00
Anton Petrov
05ca057bb2 Update pyenv---version 2021-10-05 17:32:37 +03:00
Anton Petrov
108a10a198 Update CHANGELOG.md 2021-10-05 17:32:15 +03:00
Anton Petrov
979e6f0a61 Merge pull request #2096 from ashwinvis/patch-1
Fix mambaforge-pypy3 build
2021-10-05 17:24:58 +03:00
Ashwin V. Mohanan
2a9c18372a Update mambaforge-pypy3
Fix typo `ase` -> `case`
2021-10-05 15:28:13 +02:00
native-api
8315e1528b Create FUNDING.yml 2021-10-05 12:27:48 +03:00
Anton Petrov
c81a28105f Merge pull request #2093 from Parnassius/py310
Add Python 3.10.0
2021-10-04 22:28:30 +03:00
Parnassius
d601efa0d5 Add Python 3.10.0 2021-10-04 21:16:19 +02:00
sandipanpanda
0688b17cc1 Add documentation for exec command (#2090) 2021-10-02 23:15:18 +03:00
sandipanpanda
bb6a747c02 Add documentation for shims command (#2091) 2021-10-02 23:10:37 +03:00
sandipanpanda
681d31bc36 Add documentation for hooks command (#2089) 2021-10-02 20:00:24 +03:00
sandipanpanda
3b1bc86031 Add documentation for root command (#2088)
* Add documentation for root command
2021-10-02 19:58:56 +03:00
sandipanpanda
6139b51af4 Add documentaion for prefix command (#2087) 2021-10-02 19:54:12 +03:00
Ivan Pozdeev
10a8c83888 Merge branch 'master' of https://github.com/pyenv/pyenv 2021-10-01 02:30:41 +03:00
Ivan Pozdeev
9985f7b436 Honor CONFIGURE_OPTS as well as PYTHON_CONFIGURE_OPTS when detecting options 2021-10-01 02:30:28 +03:00
Kevin Modzelewski
a7895e6ea8 Update to Pyston's v2 package of the 2.3.1 release (#2078)
This one gets rid of the extra "usr" subdirectory that we had and now fits the format that pyenv expects
2021-09-28 21:12:46 +03:00
Anton Petrov
7dd48d1665 Merge pull request #2075 from kmod/pyston_2.3.1
Add pyston-2.3.1 support
2021-09-27 21:45:33 +03:00
Kevin Modzelewski
11c54713bb This looks unnecessary now 2021-09-24 17:23:35 -04:00
Kevin Modzelewski
3051d21004 Add pyston-2.3.1 support
We changed the directory structure for pyston 2.3.1 slightly, where we now
include a top-level "pyston-2.3.1" directory when you unpack the tarball.
2021-09-24 15:10:50 -04:00
Anton Petrov
9ecfdd1073 Merge pull request #2074 from anton-petrov/master
Don't update conda when installing pip
2021-09-23 12:47:50 +03:00
Anton Petrov
47d3dee0bb Fix 2021-09-23 12:26:46 +03:00
Anton Petrov
0a3b72d890 Don't update conda when installing pip 2021-09-23 12:00:09 +03:00
native-api
f018056165 Merge pull request #2072 from aphedges/improve-add_miniconda 2021-09-21 08:07:42 +03:00
Alex Hedges
af55330d37 Add miniconda2-2.7-4.8.3, miniconda3-3.7-4.10.3, miniconda3-3.8-4.10.3, miniconda3-3.9-4.10.3 2021-09-21 08:06:57 +03:00
native-api
0211c345f7 Merge pull request #2073 from native-api/github_actions_tests
GitHub actions tests
2021-09-21 07:55:28 +03:00
Ivan Pozdeev
2f8c625a7d Fix test failures 2021-09-21 07:44:03 +03:00
Ivan Pozdeev
e28661c7e2 Fix random "broken pipe" 2021-09-21 07:43:58 +03:00
Ivan Pozdeev
6882be06a6 Bats: report unstub failure details 2021-09-21 07:43:58 +03:00
Ivan Pozdeev
c6c4e41eb9 Bats: show output on failed assertions 2021-09-21 05:07:17 +03:00
Ivan Pozdeev
f504b01818 consistent message 2021-09-21 05:07:12 +03:00
Ivan Pozdeev
876be1bb04 Bats: path_without: support multiple args 2021-09-21 05:07:12 +03:00
Ivan Pozdeev
6185bb55e6 allow for sys.executable to be different 2021-09-21 05:07:06 +03:00
Ivan Pozdeev
7f714c34ba Bats 1.2 requires readline from gnu coreutils in MacOS 2021-09-21 05:07:06 +03:00
Ivan Pozdeev
848e56e992 Add Pyenv tests to Github Actions
Now that Travis check has been removed from the repo
2021-09-21 05:07:06 +03:00
Alex Hedges
8b07b92c37 Support newer miniconda filenames 2021-09-20 19:47:26 -04:00
Alex Hedges
3a20ce7555 Add default verbosity to add_miniconda.py
Required to prevent a crash when no verbosity given.
2021-09-20 19:30:45 -04:00
rallyemax
0c6ad7c52b Fix sed commands (#2071)
In GNU `sed`, the `-iEe` argument is equivalent to `--in-place=Ee`, which would create `~/.profileEe` as backup of `~/.profile` if the command executed successfully. However, because the `e` is no longer being processed as an expression argument, `sed` does not correctly join the expressions and exits with `sed: -e expression #2, char 10: unexpected }`.

The intent is to use extended regex, perform the changes in-place, and use a series of expressions, so `-Ei -e` is used instead.
2021-09-21 00:30:11 +03:00
Takumi Sueda
1bd397112a Add Python 2.7.18 patches for Apple Silicon machines (#2061) 2021-09-20 22:10:58 +03:00
47 changed files with 1571 additions and 134 deletions

12
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [pyenv] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: pyenv # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.bountysource.com/teams/yyuu-pyenv/issues'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -17,5 +17,12 @@ Make sure you have checked all steps below.
- [ ] pyenv version: - [ ] pyenv version:
- [ ] Python version: - [ ] Python version:
- [ ] C Compiler information (e.g. gcc 7.3): - [ ] C Compiler information (e.g. gcc 7.3):
- [ ] Please attach verbose build log as gist - [ ] Please attach a debug trace log as gist
* You can turn on verbose debug logging using by setting `PYENV_DEBUG=1`, e.g. `env PYENV_DEBUG=1 pyenv install -v 3.6.4` * 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
```

35
.github/workflows/pyenv_tests.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: pyenv_tests
on: [pull_request, push]
jobs:
pyenv_tests:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-18.04
- macos-11
- macos-10.15
runs-on: ${{ matrix.os }}
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 Ubuntu
# - run: |
# sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
# libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
# xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
# https://github.com/pyenv/pyenv#installation
- run: |
if test "$RUNNER_OS" == "macOS"; then brew install coreutils; fi
- run: pwd
- env:
PYENV_ROOT: /home/runner/work/pyenv/pyenv
run: |
echo $PYENV_ROOT
echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH
- run: |
make test

View File

@@ -12,7 +12,7 @@ jobs:
- 3.7.10 - 3.7.10
- 3.8.10 - 3.8.10
- 3.9.5 - 3.9.5
- 3.10.0rc2 - 3.10.0
runs-on: Ubuntu-20.04 runs-on: Ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -1,5 +1,35 @@
## Version History ## Version History
## 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 completions command (#2126)
* Default --with-universal-archs to universal2 on Apple Silicon (#2122)
* Update README.md (#2120)
* 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)
* Add CPython 3.11.0a1 (#2099)
## Release 2.1.0
* Fix mambaforge-pypy3 build (#2096)
* Add Python 3.10.0 (#2093)
* Add documentation for exec command (#2090)
* Add documentation for shims command (#2091)
* Add documentation for hooks command (#2089)
* Add documentation for root command (#2088)
* Add documentaion for prefix command (#2087)
* Update to Pyston's v2 package of the 2.3.1 release (#2078)
* Add pyston-2.3.1 support (#2075)
* Don't update conda when installing pip (#2074)
* Improve `add_miniconda.py` (#2072)
* GitHub actions tests (#2073)
* Fix sed commands (#2071)
* macOS: fix the build of Python 2.7.18 on macOS 11.5.2 (Big Sur) + Apple Silicon (#2061)
## Release 2.0.7 ## Release 2.0.7
* Update setup instructions in the Readme (#2067) * Update setup instructions in the Readme (#2067)
* Allow tcl-tk as argument or try with homebrew by default (#1646) * Allow tcl-tk as argument or try with homebrew by default (#1646)

View File

@@ -16,7 +16,13 @@ The most common subcommands are:
* [`pyenv versions`](#pyenv-versions) * [`pyenv versions`](#pyenv-versions)
* [`pyenv which`](#pyenv-which) * [`pyenv which`](#pyenv-which)
* [`pyenv whence`](#pyenv-whence) * [`pyenv whence`](#pyenv-whence)
* [`pyenv exec`](#pyenv-exec)
* [`pyenv root`](#pyenv-root)
* [`pyenv prefix`](#pyenv-prefix)
* [`pyenv hooks`](#pyenv-hooks)
* [`pyenv shims`](#pyenv-shims)
* [`pyenv init`](#pyenv-init)
* [`pyenv completions`](#pyenv-completions)
## `pyenv commands` ## `pyenv commands`
@@ -278,3 +284,83 @@ Lists all Python versions with the given command installed.
2.6.8 2.6.8
2.7.6 2.7.6
3.3.3 3.3.3
## `pyenv exec`
`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`
is equivalent to:
`PATH="$PYENV_ROOT/versions/3.9.7/bin:$PATH" pip install -r requirements.txt`
## `pyenv root`
Displays the root directory where versions and shims are kept.
$ pyenv root
/home/user/.pyenv
## `pyenv prefix`
Displays the directory where a Python version is installed. If no
version is given, `pyenv prefix` displays the location of the
currently selected version.
$ pyenv prefix 3.9.7
/home/user/.pyenv/versions/3.9.7
## `pyenv hooks`
Lists installed hook scripts for a given pyenv command.
Usage: pyenv hooks <command>
## `pyenv shims`
List existing pyenv shims.
Usage: pyenv shims [--short]
$ pyenv shims
/home/user/.pyenv/shims/2to3
/home/user/.pyenv/shims/2to3-3.9
/home/user/.pyenv/shims/idle
/home/user/.pyenv/shims/idle3
/home/user/.pyenv/shims/idle3.9
/home/user/.pyenv/shims/pip
/home/user/.pyenv/shims/pip3
/home/user/.pyenv/shims/pip3.9
/home/user/.pyenv/shims/pydoc
/home/user/.pyenv/shims/pydoc3
/home/user/.pyenv/shims/pydoc3.9
/home/user/.pyenv/shims/python
/home/user/.pyenv/shims/python3
/home/user/.pyenv/shims/python3.9
/home/user/.pyenv/shims/python3.9-config
/home/user/.pyenv/shims/python3.9-gdb.py
/home/user/.pyenv/shims/python3-config
/home/user/.pyenv/shims/python-config
## `pyenv init`
Configure the shell environment for pyenv
Usage: eval "$(pyenv init [-|--path] [--no-rehash] [<shell>])"
- Initialize shims directory, print PYENV_SHELL variable, completions path
and shell function
--path Print shims path
--no-rehash Add no rehash command to output
## `pyenv completions`
Lists available completions for a given pyenv command.
Usage: pyenv completions <command> [arg1 arg2...]

View File

@@ -2,8 +2,6 @@
[![Join the chat at https://gitter.im/yyuu/pyenv](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yyuu/pyenv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/yyuu/pyenv](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yyuu/pyenv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/pyenv/pyenv.svg?branch=master)](https://travis-ci.org/pyenv/pyenv)
pyenv lets you easily switch between multiple versions of Python. It's pyenv lets you easily switch between multiple versions of Python. It's
simple, unobtrusive, and follows the UNIX tradition of single-purpose simple, unobtrusive, and follows the UNIX tradition of single-purpose
tools that do one thing well. tools that do one thing well.
@@ -14,13 +12,13 @@ This project was forked from [rbenv](https://github.com/rbenv/rbenv) and
![Terminal output example](/terminal_output.png) ![Terminal output example](/terminal_output.png)
### pyenv _does..._ ### what pyenv _does..._
* Let you **change the global Python version** on a per-user basis. * Lets you **change the global Python version** on a per-user basis.
* Provide support for **per-project Python versions**. * Provides support for **per-project Python versions**.
* Allow you to **override the Python version** with an environment * Allows you to **override the Python version** with an environment
variable. variable.
* Search commands from **multiple versions of Python at a time**. * Searches for commands from **multiple versions of Python at a time**.
This may be helpful to test across Python versions with [tox](https://pypi.python.org/pypi/tox). This may be helpful to test across Python versions with [tox](https://pypi.python.org/pypi/tox).
@@ -185,6 +183,28 @@ For pyenv to install python correctly you should [**install the Python build dep
``` ```
2. Then follow the rest of the post-installation steps under [Basic GitHub Checkout](https://github.com/pyenv/pyenv#basic-github-checkout), starting with #2 ("Configure your shell's environment for Pyenv"). 2. Then follow the rest of the post-installation steps under [Basic GitHub Checkout](https://github.com/pyenv/pyenv#basic-github-checkout), starting with #2 ("Configure your shell's environment for Pyenv").
3. OPTIONAL. To fix `brew doctor`'s warning _""config" scripts exist outside your system or Homebrew directories"_
If you're going to build Homebrew formulae from source that link against `libpython`
like Tkinter or NumPy
_(This is only generally the case if you are a developer of such a formula,
or if you have an EOL version of MacOS for which prebuilt bottles are no longer available
and are using such a formula)._
To avoid them accidentally linking against a Pyenv-provided Python,
add the following line into your interactive shell's configuration:
* Bash/Zsh:
~~~bash
alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew'
~~~
* Fish:
~~~fish
alias brew="env PATH=(string replace (pyenv root)/shims '' \"\$PATH\") brew"
~~~
### Windows ### Windows
@@ -228,7 +248,7 @@ easy to fork and contribute any changes back upstream.
section below to figure out what you need to do in your specific case. section below to figure out what you need to do in your specific case.
**General MacOS note:** **General MacOS note:**
Make sure that your terminal app is configured to run the shell as a login shell [Make sure that your terminal app is configured to run the shell as a login shell](https://github.com/pyenv/pyenv/wiki/MacOS-login-shell)
(especially if you're using an alternative terminal app and/or shell). (especially if you're using an alternative terminal app and/or shell).
The configuration samples for MacOS are written under this assumption and won't work otherwise. The configuration samples for MacOS are written under this assumption and won't work otherwise.
@@ -239,7 +259,7 @@ easy to fork and contribute any changes back upstream.
~~~bash ~~~bash
# the sed invocation inserts the lines at the start of the file # the sed invocation inserts the lines at the start of the file
# after any initial comment lines # after any initial comment lines
sed -iEe '/^([^#]|$)/ {a \ sed -Ei -e '/^([^#]|$)/ {a \
export PYENV_ROOT="$HOME/.pyenv" export PYENV_ROOT="$HOME/.pyenv"
a \ a \
export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/bin:$PATH"
@@ -253,7 +273,7 @@ easy to fork and contribute any changes back upstream.
- **If your `~/.bash_profile` sources `~/.bashrc` (Red Hat, Fedora, CentOS):** - **If your `~/.bash_profile` sources `~/.bashrc` (Red Hat, Fedora, CentOS):**
~~~ bash ~~~ bash
sed -iEe '/^([^#]|$)/ {a \ sed -Ei -e '/^([^#]|$)/ {a \
export PYENV_ROOT="$HOME/.pyenv" export PYENV_ROOT="$HOME/.pyenv"
a \ a \
export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/bin:$PATH"
@@ -291,7 +311,7 @@ easy to fork and contribute any changes back upstream.
In MacOS, make sure that your terminal app runs the shell as a login shell. In MacOS, make sure that your terminal app runs the shell as a login shell.
- **Temporary environments (CI, batch jobs):** - **Temporary environments (CI, Docker, batch jobs):**
In CI/build environments, paths and the environment are usually already set up for you In CI/build environments, paths and the environment are usually already set up for you
in one of the above ways. in one of the above ways.
@@ -303,6 +323,18 @@ easy to fork and contribute any changes back upstream.
echo 'eval "$(pyenv init -)"' echo 'eval "$(pyenv init -)"'
~~~ ~~~
If you are installing Pyenv yourself as part of the batch job,
after installing the files, run the following in the job's shell
to be able to use it.
~~~bash
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH" # if `pyenv` is not already on PATH
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
~~~
**General Bash warning**: There are some systems where the `BASH_ENV` variable is configured **General Bash warning**: There are some systems where the `BASH_ENV` variable is configured
to point to `.bashrc`. On such systems, you should almost certainly put the to point to `.bashrc`. On such systems, you should almost certainly put the
`eval "$(pyenv init -)"` line into `.bash_profile`, and **not** into `.bashrc`. Otherwise, you `eval "$(pyenv init -)"` line into `.bash_profile`, and **not** into `.bashrc`. Otherwise, you
@@ -349,7 +381,7 @@ easy to fork and contribute any changes back upstream.
echo 'eval "$(pyenv init -)"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc
~~~ ~~~
- For **Fish shell**: - For **Fish shell**:
Execute this interactively: Execute this interactively:

View File

@@ -12,7 +12,7 @@
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
version="2.0.7" version="2.2.0"
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

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

View File

@@ -773,10 +773,13 @@ build_package_standard_build() {
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS" local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
if [ "$package_var_name" = "PYTHON" ]; then if [ "$package_var_name" = "PYTHON" ]; then
use_tcltk || true use_homebrew || true
use_homebrew_readline || use_freebsd_pkg || true use_tcltk || true
use_homebrew_readline || use_freebsd_pkg || true
if is_mac -ge 1014; then if is_mac -ge 1014; then
use_xcode_sdk_zlib || use_homebrew_zlib || true use_xcode_sdk_zlib || use_homebrew_zlib || true
else
use_homebrew_zlib || true
fi fi
fi fi
@@ -858,8 +861,8 @@ build_package_jython_builder() {
( cd "dist" && build_package_jython ) ( cd "dist" && build_package_jython )
} }
build_package_pyston() { build_package_pyston2_2() {
# currently supported version 2.2 and upper # currently supported version 2.2 and 2.3
build_package_copy build_package_copy
mkdir -p "${PREFIX_PATH}/bin" "${PREFIX_PATH}/lib" mkdir -p "${PREFIX_PATH}/bin" "${PREFIX_PATH}/lib"
local bin local bin
@@ -876,6 +879,11 @@ build_package_pyston() {
shopt -u nullglob shopt -u nullglob
} }
build_package_pyston() {
# currently supported version 2.3.1v2 and higher
build_package_copy
}
build_package_ironpython() { build_package_ironpython() {
mkdir -p "${PREFIX_PATH}/bin" mkdir -p "${PREFIX_PATH}/bin"
cp -fR . "${PREFIX_PATH}/bin" cp -fR . "${PREFIX_PATH}/bin"
@@ -1042,7 +1050,9 @@ build_package_anaconda() {
build_package_miniconda() { build_package_miniconda() {
build_package_anaconda "$@" build_package_anaconda "$@"
"${PREFIX_PATH}/bin/conda" install --yes "pip" # Workaround to not upgrade conda when installing pip
# see https://github.com/pyenv/pyenv/issues/2070
"${PREFIX_PATH}/bin/conda" install --yes "pip" "conda=$(${PREFIX_PATH}/bin/conda --version | cut -d ' ' -f 2)"
} }
build_package_copy() { build_package_copy() {
@@ -1318,6 +1328,19 @@ configured_with_package_dir() {
return 1 return 1
} }
use_homebrew() {
# unless Homebrew is at the default /usr/local, need to add its paths to
# compiler search to be able to use non-keg-only deps from there
if command -v brew &>/dev/null; then
local brew_prefix="$(brew --prefix 2>/dev/null || true)"
# /usr/local/lib:/usr/lib is the default library search path
if [[ -n $brew_prefix && $brew_prefix != "/usr" && $brew_prefix != "/usr/local" ]]; then
export CPPFLAGS="${CPPFLAGS:+${CPPFLAGS% } }-I${brew_prefix}/include"
export LDFLAGS="${LDFLAGS:+${LDFLAGS% } }-L${brew_prefix}/lib"
fi
fi
}
needs_yaml() { needs_yaml() {
! configured_with_package_dir "python" "yaml.h" && ! configured_with_package_dir "python" "yaml.h" &&
! use_homebrew_yaml ! use_homebrew_yaml
@@ -1526,12 +1549,13 @@ use_xcode_sdk_zlib() {
use_homebrew_tcltk() { use_homebrew_tcltk() {
# get the version from the folder that homebrew versions # get the version from the folder that homebrew versions
local tcltk_version_long="$(ls "$(brew --cellar tcl-tk)")" local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
local tcltk_version="${tcltk_version_long%.*}" if [ -d "$tcltk_libdir" ]; then
local tcltk_flags="--with-tcltk-includes=-I$tcltk_libdir/include --with-tcltk-libs=-L$tcltk_libdir/lib -ltcl$tcltk_version -ltk$tcltk_version" echo "python-build: use tcl-tk from homebrew"
echo "python-build: use tcl-tk from homebrew" local tcltk_version="$(sh -c '. '"$tcltk_libdir"'/lib/tclConfig.sh; echo $TCL_VERSION')"
package_option python configure --with-tcltk-libs="-L$tcltk_libdir/lib -ltcl$tcltk_version -ltk$tcltk_version" package_option python configure --with-tcltk-libs="-L$tcltk_libdir/lib -ltcl$tcltk_version -ltk$tcltk_version"
package_option python configure --with-tcltk-includes="-I$tcltk_libdir/include" package_option python configure --with-tcltk-includes="-I$tcltk_libdir/include"
fi
} }
# FIXME: this function is a workaround for #1125 # FIXME: this function is a workaround for #1125
@@ -1647,7 +1671,7 @@ apply_python_patch() {
} }
build_package_symlink_version_suffix() { build_package_symlink_version_suffix() {
if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then if [[ "$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-frameowrk` (#590)
rm -rf "${PREFIX_PATH}/bin.orig" rm -rf "${PREFIX_PATH}/bin.orig"
@@ -2096,7 +2120,7 @@ fi
package_option python configure --libdir="${PREFIX_PATH}/lib" 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" == *"--enable-shared"* ]] || [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-shared"* ]]; then if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--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="* ]] && ! is_mac; then
export LDFLAGS="-Wl,-rpath=${PREFIX_PATH}/lib ${LDFLAGS}" export LDFLAGS="-Wl,-rpath=${PREFIX_PATH}/lib ${LDFLAGS}"
@@ -2109,7 +2133,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)
if [[ "$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." >&2 echo "python-build: framework installation is not supported." >&2
exit 1 exit 1
@@ -2129,13 +2153,21 @@ if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then
package_option python configure --enable-framework="${PREFIX_PATH}/Library/Frameworks" package_option python configure --enable-framework="${PREFIX_PATH}/Library/Frameworks"
fi fi
# Build against universal SDK (#219, #220) # Build against universal SDK
if [[ "$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." >&2 echo "python-build: universal installation is not supported." >&2
exit 1 exit 1
fi fi
package_option python configure --enable-universalsdk=/ --with-universal-archs=intel package_option python configure --enable-universalsdk=/
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" != *"--enable-universal-archs"* ]]; then
# 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
# Apple Silicon cannot build these, in it, it rather makes sense to default to Universal2 binaries
if [[ $(arch) == "arm64" ]]; then
package_option python configure --with-universal-archs=universal2
fi
fi
fi fi
# Compile with `--enable-unicode=ucs4` by default (#257) # Compile with `--enable-unicode=ucs4` by default (#257)

View File

@@ -44,7 +44,7 @@ esac
install_line_fmt = """ install_line_fmt = """
"{os}-{arch}" ) "{os}-{arch}" )
install_script "Miniconda{suffix}-{version_str}-{os}-{arch}" "{repo}/Miniconda{suffix}-{version_str}-{os}-{arch}.sh#{md5}" "miniconda" verify_{py_version} install_script "Miniconda{suffix}-{version_py_version}{version_str}-{os}-{arch}" "{repo}/Miniconda{suffix}-{version_py_version}{version_str}-{os}-{arch}.sh#{md5}" "miniconda" verify_{py_version}
;; ;;
""".strip() """.strip()
@@ -126,17 +126,29 @@ class VersionStr(str):
class MinicondaVersion(NamedTuple): class MinicondaVersion(NamedTuple):
suffix: Suffix suffix: Suffix
version_str: VersionStr version_str: VersionStr
py_version: Optional[PyVersion]
@classmethod @classmethod
def from_str(cls, s): def from_str(cls, s):
miniconda_n, ver = s.split("-") components = s.split("-")
return MinicondaVersion(Suffix(miniconda_n[-1]), VersionStr(ver)) if len(components) == 3:
miniconda_n, py_ver, ver = components
py_ver = PyVersion(f"py{py_ver.replace('.', '')}")
else:
miniconda_n, ver = components
py_ver = None
return MinicondaVersion(Suffix(miniconda_n[-1]), VersionStr(ver), py_ver)
def to_filename(self): def to_filename(self):
return f"miniconda{self.suffix}-{self.version_str}" if self.py_version:
return f"miniconda{self.suffix}-{self.py_version.version()}-{self.version_str}"
else:
return f"miniconda{self.suffix}-{self.version_str}"
def default_py_version(self): def default_py_version(self):
if self.suffix == Suffix.TWO: if self.py_version:
return self.py_version
elif self.suffix == Suffix.TWO:
return PyVersion.PY27 return PyVersion.PY27
elif self.version_str.info() < (4, 7): elif self.version_str.info() < (4, 7):
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html # https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html
@@ -146,7 +158,7 @@ class MinicondaVersion(NamedTuple):
def with_version_triple(self): def with_version_triple(self):
return MinicondaVersion( return MinicondaVersion(
self.suffix, VersionStr.from_info(self.version_str.info()[:3]) self.suffix, VersionStr.from_info(self.version_str.info()[:3]), self.py_version
) )
@@ -160,8 +172,13 @@ class MinicondaSpec(NamedTuple):
@classmethod @classmethod
def from_filestem(cls, stem, md5, py_version=None): def from_filestem(cls, stem, md5, py_version=None):
miniconda_n, ver, os, arch = stem.split("-") miniconda_n, ver, os, arch = stem.split("-")
if ver.startswith("py"):
py_ver, ver = ver.split("_", maxsplit=1)
py_ver = PyVersion(py_ver)
else:
py_ver = None
spec = MinicondaSpec( spec = MinicondaSpec(
MinicondaVersion(Suffix(miniconda_n[-1]), VersionStr(ver)), MinicondaVersion(Suffix(miniconda_n[-1]), VersionStr(ver), py_ver),
SupportedOS(os), SupportedOS(os),
SupportedArch(arch), SupportedArch(arch),
md5, md5,
@@ -175,6 +192,7 @@ class MinicondaSpec(NamedTuple):
repo=MINICONDA_REPO, repo=MINICONDA_REPO,
suffix=self.version.suffix, suffix=self.version.suffix,
version_str=self.version.version_str, version_str=self.version.version_str,
version_py_version=f"{self.version.py_version}_" if self.version.py_version else "",
os=self.os, os=self.os,
arch=self.arch, arch=self.arch,
md5=self.md5, md5=self.md5,
@@ -250,7 +268,7 @@ if __name__ == "__main__":
help="Do not write scripts, just report them to stdout", help="Do not write scripts, just report them to stdout",
) )
parser.add_argument( parser.add_argument(
"-v", "--verbose", action="count", "-v", "--verbose", action="count", default=0,
help="Increase verbosity of logging", help="Increase verbosity of logging",
) )
parsed = parser.parse_args() parsed = parser.parse_args()

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 "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 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 if has_tar_xz_support; then
install_package "Python-3.10.0rc2" "https://www.python.org/ftp/python/3.10.0/Python-3.10.0rc2.tar.xz#e75b56088548b7b9ad1f2571e6f5a2315e4808cb6b5fbe8288502afc802b2f24" standard verify_py310 copy_python_gdb ensurepip install_package "Python-3.10.0" "https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz#5a99f8e7a6a11a7b98b4e75e0d1303d3832cada5534068f69c7b6222a7b1b002" standard verify_py310 copy_python_gdb ensurepip
else else
install_package "Python-3.10.0rc2" "https://www.python.org/ftp/python/3.10.0/Python-3.10.0rc2.tgz#0f8bf53dbe6f85785d502e73984aa3f12f67ac4958d9b8d8012019c35c646fe2" standard verify_py310 copy_python_gdb ensurepip install_package "Python-3.10.0" "https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz#c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758" standard verify_py310 copy_python_gdb ensurepip
fi fi

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.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
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
fi

View File

@@ -0,0 +1,48 @@
# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
VERSION='21.3.0'
BUILD=''
case "$(pypy_architecture 2>/dev/null || true)" in
"linux64" )
graalpython_arch="linux"
checksum="b17bbc9753fb04f03290660952acfd212020676603970323780f190509b061b9"
;;
"osx64" )
graalpython_arch="macos"
checksum="feecbd2567a43aeaeb5ca6a7385ef3d5bd2c94e563b64afee7dcce0c8f87a1c9"
;;
* )
{ echo
colorize 1 "ERROR"
echo ": No binary distribution of GraalPython is available for $(pypy_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac
if [ -n "${BUILD}" ]; then
urlprefix="https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/${VERSION}-${BUILD}"
else
urlprefix="https://github.com/oracle/graalpython/releases/download/vm-${VERSION}"
fi
install_package "graalpython-${VERSION}${BUILD}" "${urlprefix}/graalpython-${VERSION}-${graalpython_arch}-amd64.tar.gz#${checksum}" "graalpython" ensurepip

View File

@@ -1,4 +1,4 @@
ase "$(anaconda_architecture 2>/dev/null || true)" in case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-ppc64le" ) "Linux-ppc64le" )
install_script "Mambaforge-pypy3-Linux-ppc64le" "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-pypy3-Linux-ppc64le.sh" "miniconda" verify_py3_latest install_script "Mambaforge-pypy3-Linux-ppc64le" "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-pypy3-Linux-ppc64le.sh" "miniconda" verify_py3_latest
;; ;;

View File

@@ -0,0 +1,19 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-ppc64le" )
install_script "Miniconda2-py27_4.8.3-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda2-py27_4.8.3-Linux-ppc64le.sh#120b300120b1362831f2075cc0bd452f" "miniconda" verify_py27
;;
"Linux-x86_64" )
install_script "Miniconda2-py27_4.8.3-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda2-py27_4.8.3-Linux-x86_64.sh#19ce7d0039ab349914d928e7f32b1c1b" "miniconda" verify_py27
;;
"MacOSX-x86_64" )
install_script "Miniconda2-py27_4.8.3-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda2-py27_4.8.3-MacOSX-x86_64.sh#14e2d294decc5a48a449b588f5819c10" "miniconda" verify_py27
;;
* )
{ 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,19 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-ppc64le" )
install_script "Miniconda3-py37_4.10.3-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-ppc64le.sh#a926bbaf28d59ac1264799e3ca770a44" "miniconda" verify_py37
;;
"Linux-x86_64" )
install_script "Miniconda3-py37_4.10.3-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh#9f186c1d86c266acc47dbc1603f0e2ed" "miniconda" verify_py37
;;
"MacOSX-x86_64" )
install_script "Miniconda3-py37_4.10.3-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py37_4.10.3-MacOSX-x86_64.sh#b88a2eb66917c55a6bd1973fabaf05b3" "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,19 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-ppc64le" )
install_script "Miniconda3-py38_4.10.3-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-ppc64le.sh#12ddb1b94f30f8fc633c3223b0398d2f" "miniconda" verify_py38
;;
"Linux-x86_64" )
install_script "Miniconda3-py38_4.10.3-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh#14da4a9a44b337f7ccb8363537f65b9c" "miniconda" verify_py38
;;
"MacOSX-x86_64" )
install_script "Miniconda3-py38_4.10.3-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-MacOSX-x86_64.sh#cb609591c280423e999fc421cdb779d3" "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,19 @@
case "$(anaconda_architecture 2>/dev/null || true)" in
"Linux-ppc64le" )
install_script "Miniconda3-py39_4.10.3-Linux-ppc64le" "https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-ppc64le.sh#07ea41c691bdcc7d9c71cae1a1a88151" "miniconda" verify_py39
;;
"Linux-x86_64" )
install_script "Miniconda3-py39_4.10.3-Linux-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh#8c69f65a4ae27fb41df0fe552b4a8a3b" "miniconda" verify_py39
;;
"MacOSX-x86_64" )
install_script "Miniconda3-py39_4.10.3-MacOSX-x86_64" "https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-MacOSX-x86_64.sh#09bb30a9204ced74ce3c06762cb442fc" "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,41 @@
From 5495fb4719fa67ea3abeda0434699c8b28c77bb3 Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 16:50:14 +0900
Subject: [PATCH 1/7] Detect arm64 in configure
---
configure | 3 +++
configure.ac | 3 +++
2 files changed, 6 insertions(+)
diff --git a/configure b/configure
index 63d675312d..c40ec120de 100755
--- a/configure
+++ b/configure
@@ -8474,6 +8474,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 efe6922b5d..df05bee87b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2066,6 +2066,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

View File

@@ -0,0 +1,237 @@
From f17b9e30bd295b1eec68105e3f04568477ce6286 Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 17:14:34 +0900
Subject: [PATCH 2/7] 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 | 148 +++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 106 insertions(+), 42 deletions(-)
diff --git a/setup.py b/setup.py
index f764223d06..da1d34efaf 100644
--- a/setup.py
+++ b/setup.py
@@ -50,6 +50,7 @@ def add_dir_to_list(dirlist, dir):
dirlist.insert(0, dir)
MACOS_SDK_ROOT = None
+MACOS_SDK_SPECIFIED = None
def macosx_sdk_root():
"""Return the directory of the current macOS SDK.
@@ -61,8 +62,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:
@@ -72,8 +74,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:
@@ -101,6 +105,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
@@ -1834,31 +1859,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
@@ -1868,32 +1934,20 @@ 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('-arch\s+(\w+)', cflags)
- if is_macosx_sdk_path(F):
- fp = os.popen("file %s/Tk.framework/Tk | grep 'for architecture'"%(os.path.join(sysroot, F[1:]),))
- else:
- fp = os.popen("file %s/Tk.framework/Tk | grep 'for architecture'"%(F,))
-
+ fp = os.popen("file %s/Tk.framework/Tk | grep 'for architecture'"%(F,))
detected_archs = []
for ln in fp:
a = ln.split()[-1]
@@ -1901,16 +1955,26 @@ class PyBuildExt(build_ext):
detected_archs.append(ln.split()[-1])
fp.close()
+ 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

View File

@@ -0,0 +1,34 @@
From d93a26fee21a5f91c51d8cb14ecaf29122f1b222 Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 17:25:00 +0900
Subject: [PATCH 3/7] Support "arm64" in Mac/Tools/pythonw
Imported from: https://github.com/Homebrew/formula-patches/blob/master/python/3.8.7.patch
---
Mac/Tools/pythonw.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Mac/Tools/pythonw.c b/Mac/Tools/pythonw.c
index 76734c1063..ebe5e8d975 100644
--- a/Mac/Tools/pythonw.c
+++ b/Mac/Tools/pythonw.c
@@ -116,10 +116,16 @@ setup_spawnattr(posix_spawnattr_t* spawnattr)
#elif defined(__ppc__)
cpu_types[0] = CPU_TYPE_POWERPC;
+
#elif defined(__i386__)
cpu_types[0] = CPU_TYPE_X86;
+
+#elif defined(__arm64__)
+ cpu_types[0] = CPU_TYPE_ARM64;
+
#else
# error "Unknown CPU"
+
#endif
if (posix_spawnattr_setbinpref_np(spawnattr, count,
--
2.30.1

View File

@@ -0,0 +1,85 @@
From a1b08c7de72c27d80a86b92c263d1f5b351e581b Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 18:07:48 +0900
Subject: [PATCH 4/7] Use system libffi for Mac OS 10.15 and up
Modified and imported from: https://github.com/Homebrew/formula-patches/blob/master/python/3.8.7.patch
---
setup.py | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/setup.py b/setup.py
index da1d34efaf..c92d0552e3 100644
--- a/setup.py
+++ b/setup.py
@@ -126,6 +126,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
@@ -2180,7 +2187,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 = []
@@ -2224,15 +2235,24 @@ class PyBuildExt(build_ext):
sources=['_ctypes/_ctypes_test.c'])
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
+ #inc_dirs = self.inc_dirs.copy()
+ inc_dirs = self.compiler.include_dirs[:]
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')
+ 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'
+ sources.remove('_ctypes/malloc_closure.c')
+ else:
+ # 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:
@@ -2247,8 +2267,7 @@ 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
--
2.30.1

View File

@@ -0,0 +1,221 @@
From 4394ec26842b04335b30b9a0595fcc8591c68496 Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 18:59:44 +0900
Subject: [PATCH 5/7] ctypes: use the correct ABI for variadic functions
Modified and imported from https://github.com/Homebrew/formula-patches/blob/master/python/3.8.7.patch
---
Doc/library/ctypes.rst | 6 +++++
Lib/test/test_str.py | 2 ++
Lib/test/test_unicode.py | 3 +++
Modules/_ctypes/_ctypes.c | 31 +++++++++++++++++++++++
Modules/_ctypes/callproc.c | 51 +++++++++++++++++++++++++++++---------
Modules/_ctypes/ctypes.h | 1 +
6 files changed, 82 insertions(+), 12 deletions(-)
diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index 6a5299145f..ec97da607f 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -1584,6 +1584,12 @@ 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
diff --git a/Lib/test/test_str.py b/Lib/test/test_str.py
index 73ed542a51..131f6d13e0 100644
--- a/Lib/test/test_str.py
+++ b/Lib/test/test_str.py
@@ -489,6 +489,8 @@ class CAPITest(unittest.TestCase):
c_char_p)
PyString_FromFormat = pythonapi.PyString_FromFormat
+ PyString_FromFormat.variadic = True
+ PyString_FromFormat.argtypes = (c_char_p,)
PyString_FromFormat.restype = py_object
# basic tests
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 92476f68a5..23e9e643e0 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -1676,6 +1676,7 @@ class CAPITest(unittest.TestCase):
def test_from_format(self):
test_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)
@@ -1684,6 +1685,8 @@ class CAPITest(unittest.TestCase):
else:
name = "PyUnicodeUCS4_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 bef251ef04..d03b98d09c 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3253,6 +3253,34 @@ PyCFuncPtr_get_restype(PyCFuncPtrObject *self)
}
}
+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)
{
@@ -3299,6 +3327,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 }
};
@@ -5838,6 +5868,7 @@ init_ctypes(void)
PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyInt_FromLong(FUNCFLAG_USE_ERRNO));
PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyInt_FromLong(FUNCFLAG_USE_LASTERROR));
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI));
+ PyModule_AddObject(m, "FUNCFLAG_VARIADIC", PyInt_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 066fefc0cc..39a539db47 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -88,6 +88,9 @@
#define DONT_USE_SEH
#endif
+#if defined(__APPLE__) && __arm64__
+#define HAVE_FFI_PREP_CIF_VAR 1
+#endif
#define CTYPES_CAPSULE_ERROROBJ "_ctypes/callproc.c error object"
CTYPES_CAPSULE_INSTANTIATE_DESTRUCTOR(CTYPES_CAPSULE_ERROROBJ)
@@ -773,7 +776,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 */
@@ -801,15 +805,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 +1209,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 12b56c4342..8aec3d1ade 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -325,6 +325,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
--
2.30.1

View File

@@ -0,0 +1,108 @@
From 43819cd35cddd189cbe513032e76f1c1a6ec6d8c Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 19:14:50 +0900
Subject: [PATCH 6/7] ctypes: probe libffi for ffi_closure_alloc and
ffi_prep_cif_var
Modified and imported from https://github.com/Homebrew/formula-patches/blob/master/python/3.8.7.patch
---
Modules/_ctypes/callproc.c | 4 ----
setup.py | 34 +++++++++++++++++++++++++---------
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 39a539db47..5273e8d246 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -88,10 +88,6 @@
#define DONT_USE_SEH
#endif
-#if defined(__APPLE__) && __arm64__
-#define HAVE_FFI_PREP_CIF_VAR 1
-#endif
-
#define CTYPES_CAPSULE_ERROROBJ "_ctypes/callproc.c error object"
CTYPES_CAPSULE_INSTANTIATE_DESTRUCTOR(CTYPES_CAPSULE_ERROROBJ)
diff --git a/setup.py b/setup.py
index c92d0552e3..beaf60f3e5 100644
--- a/setup.py
+++ b/setup.py
@@ -141,6 +141,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
@@ -2235,7 +2242,7 @@ class PyBuildExt(build_ext):
sources=['_ctypes/_ctypes_test.c'])
self.extensions.extend([ext, ext_test])
- ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
ffi_lib = None
#inc_dirs = self.inc_dirs.copy()
@@ -2245,18 +2252,19 @@ class PyBuildExt(build_ext):
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_inc = ffi_in_sdk
ffi_lib = 'ffi'
- sources.remove('_ctypes/malloc_closure.c')
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 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()
@@ -2267,14 +2275,22 @@ class PyBuildExt(build_ext):
ffi_inc = None
print('Header file {} does not define LIBFFI_H or '
'ffi_wrapper_h'.format(ffi_h))
- if ffi_lib is None and ffi_inc is not None:
+ 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

View File

@@ -0,0 +1,40 @@
From 41ee254166bb690feb665991fc2442e335631314 Mon Sep 17 00:00:00 2001
From: Takumi Sueda <puhitaku@gmail.com>
Date: Sat, 11 Sep 2021 19:20:30 +0900
Subject: [PATCH 7/7] Remove QuickTime from link args
---
Mac/Modules/qt/setup.py | 2 +-
setup.py | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Mac/Modules/qt/setup.py b/Mac/Modules/qt/setup.py
index 8442011ab9..4b5bc2bc20 100644
--- a/Mac/Modules/qt/setup.py
+++ b/Mac/Modules/qt/setup.py
@@ -6,7 +6,7 @@ from distutils.core import Extension, setup
setup(name="QuickTime", version="0.2",
ext_modules=[
Extension('QuickTime._Qt', ['_Qtmodule.c'],
- extra_link_args=['-framework', 'Carbon', '-framework', 'QuickTime'])
+ extra_link_args=['-framework', 'Carbon'])
],
py_modules=['QuickTime.Qt', 'QuickTime.QuickTime'],
package_dir={'QuickTime':'../../../Lib/plat-mac/Carbon'}
diff --git a/setup.py b/setup.py
index beaf60f3e5..ff2298af91 100644
--- a/setup.py
+++ b/setup.py
@@ -1819,8 +1819,7 @@ class PyBuildExt(build_ext):
exts.append( Extension('_Qt', ['qt/_Qtmodule.c'],
extra_compile_args=carbon_extra_compile_args,
- extra_link_args=['-framework', 'QuickTime',
- '-framework', 'Carbon']) )
+ extra_link_args=['-framework', 'Carbon']) )
self.extensions.extend(exts)
--
2.30.1

View File

@@ -0,0 +1,43 @@
VERSION='7.3.6'
PYVER='3.7'
# https://www.pypy.org/checksums.html
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#459e77c845b31fa9367f7b1b1122155f0ba7888b1d4ce4455c35d2111eeeb275" "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#c41d07063b1d002a91ad2a0763b4baaca2b306ec635889c2e4826e706cc7f9ca" "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#d446b6987eeaa03d706603863e83d6b99df69232cf1e06d3ee5706add6a84cd6" "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#26f0c5c2a5f4a2ce35281d2fa760aa10715300dd110387eac43699a78ed32365" "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
;;
"s390x" )
install_package "pypy${PYVER}-v${VERSION}-s390x" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-s390x.tar.bz2#3659bf96a177a53426ffc38d3619c6ee307e600c80e924edc9cee604680c141d" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"win64" )
install_zip "pypy${PYVER}-v${VERSION}-win64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win64.zip#341e69a369da5a1f4f69dbbd47e7dff5e745439b203e28c7afcf98308a24b003" "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,7 @@
VERSION='7.3.6'
PYVER='3.7'
#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 "pypy${PYVER}-v${VERSION}-src" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-src.tar.bz2#9252ccaa130094205b3c7f0a2cad5adc0d9dfba31658ff3172f788dec1fdb348" "pypy_builder" "verify_py${PYVER//./}" ensurepip

View File

@@ -0,0 +1,43 @@
VERSION='7.3.7'
PYVER='3.7'
# https://www.pypy.org/checksums.html
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#0ab9e2e8ae1ac463bb811b9d3ba24d138f41f7378c17ca9e2d8dee51bf151d19" "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#8332f923755441fedfe4767a84601c94f4d6f8475384406cb5f259ad8d0b2002" "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#a1a84882525dd574c4b051b66e9b7ef0e132392acc2f729420d7825f96835216" "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#edc9df7d0f7c56f7ee05b24117bdb6c03aa65e768471e210c05ccdbbfd11a866" "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
;;
"s390x" )
install_package "pypy${PYVER}-v${VERSION}-s390x" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-s390x.tar.bz2#7f91efc65a69e727519cc885ca6351f4bfdd6b90580dced2fdcc9ae1bf10013b" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"win64" )
install_zip "pypy${PYVER}-v${VERSION}-win64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win64.zip#53505dc0b57590290efd7656117ee5384bcd036f7f7c4f0bc3f5cd10299037d1" "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,7 @@
VERSION='7.3.7'
PYVER='3.7'
#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 "pypy${PYVER}-v${VERSION}-src" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-src.tar.bz2#2ed02ac9e710859c41bc82deafb08619792bb9a27eeaa1676c741ededd214dd7" "pypy_builder" "verify_py${PYVER//./}" ensurepip

View File

@@ -0,0 +1,43 @@
VERSION='7.3.6'
PYVER='3.8'
# https://www.pypy.org/checksums.html
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#e857a04a76285f0ef5bae84f6f5e9943ca415d499204c531b1c33fe8f015b48d" "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#8579ea990e95d2b7e101ef47fd9ebf25a9500d5086e8f708c43f9bae83306ece" "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#704d5303096e8a3173e73435f3bb204e31a8bf02ed5ba617a4a0f1e7491edf50" "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#8195e52a20cf2a4f42c2d7e4969fbf44fe349c1f80f758e20525dd0f8c134bec" "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
;;
"s390x" )
install_package "pypy${PYVER}-v${VERSION}-s390x" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-s390x.zip#a36208d5e950ec4b630b33d0aede8ca3da383d973fc5ca387082c7e5bad8d245" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"win64" )
install_zip "pypy${PYVER}-v${VERSION}-win64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win64.zip#1b216fd75f8f0a48633cc21dce7d6f25ba65016142df758842e1df661269b458" "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,8 @@
VERSION='7.3.6'
PYVER='3.8'
# https://www.pypy.org/checksums.html
#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 "pypy${PYVER}-v${VERSION}-src" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-src.tar.bz2#f234c56eb0d4ab0afb196232fb38cd1ca8e19b1c65cf7b65eb691695499be259" "pypy_builder" "verify_py${PYVER//./}" ensurepip

View File

@@ -0,0 +1,43 @@
VERSION='7.3.7'
PYVER='3.8'
# https://www.pypy.org/checksums.html
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#dfb9d005f0fc917edc60fd618143e4934c412f9168b55166f5519ba0a3b1a835" "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#5dee37c7c3cb8b160028fbde3a5901c68043dfa545a16794502b897d4bc40d7e" "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#cbd44e0a9146b3c03a9d14b265774a848f387ed846316c3e984847e278d0efd3" "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#1f044fe7bbdd443b7913ecf554683dab6dade5dcd7f47d4e6d01f4bb4cf84836" "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
;;
"s390x" )
install_package "pypy${PYVER}-v${VERSION}-s390x" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-s390x.zip#ae7d6a76490b317a74b87788d596610c7ffd0ae2d3ffa2433d5bb5300f6b4b77" "pypy" "verify_py${PYVER//./}" ensurepip
;;
"win64" )
install_zip "pypy${PYVER}-v${VERSION}-win64" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-win64.zip#8ceb03d2f7b73c6ce0758290bc42ba366a45c46e033eda36f1779d957a905735" "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,8 @@
VERSION='7.3.7'
PYVER='3.8'
# https://www.pypy.org/checksums.html
#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 "pypy${PYVER}-v${VERSION}-src" "https://downloads.python.org/pypy/pypy${PYVER}-v${VERSION}-src.tar.bz2#21ae339f4f5016d6ca7300305f3e3b554373835cb3c39a9041fe30e6811c80c6" "pypy_builder" "verify_py${PYVER//./}" ensurepip

View File

@@ -6,7 +6,7 @@ echo
case "$(pyston_architecture 2>/dev/null || true)" in case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" ) "linux64" )
install_package "pyston_2.2" "https://github.com/pyston/pyston/releases/download/pyston_2.2/pyston_2.2_portable.tar.gz#d113cc4d1f6821c0f117f7a84978823d8ac751d7970fa7841eb994663ec5a59f" "pyston" verify_py38 get_pip install_package "pyston_2.2" "https://github.com/pyston/pyston/releases/download/pyston_2.2/pyston_2.2_portable.tar.gz#d113cc4d1f6821c0f117f7a84978823d8ac751d7970fa7841eb994663ec5a59f" "pyston2_2" verify_py38 get_pip
;; ;;
* ) * )
{ echo { echo

View File

@@ -6,7 +6,7 @@ echo
case "$(pyston_architecture 2>/dev/null || true)" in case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" ) "linux64" )
install_package "pyston_2.3" "https://github.com/pyston/pyston/releases/download/v2.3/pyston_2.3_portable-v2.tar.gz#90185e29e4a1a19562c095f2bb4e81a5d0715150fa10eca363ec1188b5ba7ee7" "pyston" verify_py38 get_pip install_package "pyston_2.3" "https://github.com/pyston/pyston/releases/download/v2.3/pyston_2.3_portable-v2.tar.gz#90185e29e4a1a19562c095f2bb4e81a5d0715150fa10eca363ec1188b5ba7ee7" "pyston2_2" verify_py38 get_pip
;; ;;
* ) * )
{ echo { echo

View File

@@ -0,0 +1,19 @@
echo
colorize 1 "WARNING"
echo ": Pyston only runs on x86_64 platforms, and only has been tested on Ubuntu"
echo "so, your mileage may vary with other Linux distributions."
echo
case "$(pyston_architecture 2>/dev/null || true)" in
"linux64" )
install_package "pyston_2.3.1" "https://github.com/pyston/pyston/releases/download/pyston_2.3.1/pyston_2.3.1_portable_v2.tar.gz#4e16df1eaf5f226c0629f2db1e63033454c94cb9e29f50154177819662df5b15" "pyston" verify_py38 get_pip
;;
* )
{ echo
colorize 1 "ERROR"
echo ": A Pyston 2.3.1 binary is not available for $(pyston_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -62,10 +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"
# pyenv/pyenv#1026 for i in {1..4}; do stub uname '-s : echo Linux'; done
stub uname false false
stub uname '-s : echo Linux' '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@@ -92,10 +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"
# pyenv/pyenv#1026 for i in {1..4}; do stub uname '-s : echo Linux'; done
stub uname false false
stub uname '-s : echo Linux' '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@@ -154,23 +148,50 @@ make install
OUT OUT
} }
@test "homebrew with uncommon prefix is added to search path" {
cached_tarball "Python-3.6.2"
BREW_PREFIX="$TMP/homebrew-prefix"
mkdir -p "$BREW_PREFIX"
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
stub brew "--prefix : echo '$BREW_PREFIX'" false
stub_make_install
run_inline_definition <<DEF
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
DEF
assert_success
unstub sw_vers
unstub uname
unstub make
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"
Python-3.6.2: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2
make install
OUT
}
@test "yaml is linked from Homebrew" { @test "yaml is linked from Homebrew" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
brew_libdir="$TMP/homebrew-yaml" brew_libdir="$TMP/homebrew-yaml"
mkdir -p "$brew_libdir" mkdir -p "$brew_libdir"
# pyenv/pyenv#1026 for i in {1..4}; do stub uname '-s : echo Darwin'; done
stub uname false false for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
stub brew "--prefix libyaml : echo '$brew_libdir'"
stub uname '-s : echo Linux' for i in {1..4}; do stub brew false; done
stub uname '-s : echo Darwin'
stub brew "--prefix libyaml : echo '$brew_libdir'" false false
stub_make_install stub_make_install
install_fixture definitions/needs-yaml install_fixture definitions/needs-yaml
assert_success assert_success
unstub sw_vers
unstub uname unstub uname
unstub brew unstub brew
unstub make unstub make
@@ -188,11 +209,10 @@ OUT
readline_libdir="$TMP/homebrew-readline" readline_libdir="$TMP/homebrew-readline"
mkdir -p "$readline_libdir" mkdir -p "$readline_libdir"
stub uname false
# pyenv/pyenv#1026 for i in {1..2}; do stub brew false; done
stub uname false false stub brew "--prefix readline : echo '$readline_libdir'"
stub brew false
stub brew false "--prefix readline : echo '$readline_libdir'"
stub_make_install stub_make_install
run_inline_definition <<DEF run_inline_definition <<DEF
@@ -222,7 +242,7 @@ OUT
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false
stub brew false for i in {1..3}; do stub brew false; done
stub_make_install stub_make_install
export PYTHON_CONFIGURE_OPTS="CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib" export PYTHON_CONFIGURE_OPTS="CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib"
@@ -244,18 +264,15 @@ OUT
@test "tcl-tk is linked from Homebrew" { @test "tcl-tk is linked from Homebrew" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
tcl_tk_version=8.6
# python build
tcl_tk_libdir="$TMP/homebrew-tcl-tk" tcl_tk_libdir="$TMP/homebrew-tcl-tk"
tcl_tk_version_long="8.6.10" mkdir -p "$tcl_tk_libdir/lib"
tcl_tk_version="${tcl_tk_version_long%.*}" echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh"
mkdir -p "$tcl_tk_libdir"
mkdir -p "$tcl_tk_libdir/$tcl_tk_version_long"
# pyenv/pyenv#1026 stub uname false
stub uname false false stub brew false
for i in {1..2}; do stub brew "--prefix tcl-tk : echo '$tcl_tk_libdir'"; done
stub brew "--prefix tcl-tk : echo '$tcl_tk_libdir'" "--cellar tcl-tk : echo '$TMP/homebrew-tcl-tk'" false for i in {1..2}; do stub brew false; done
stub_make_install stub_make_install
run_inline_definition <<DEF run_inline_definition <<DEF
@@ -284,7 +301,7 @@ OUT
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false
stub brew false false for i in {1..4}; do stub brew false; done
stub_make_install stub_make_install
export PYTHON_CONFIGURE_OPTS="--with-tcltk-libs='-L${TMP}/custom-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version'" export PYTHON_CONFIGURE_OPTS="--with-tcltk-libs='-L${TMP}/custom-tcl-tk/lib -ltcl$tcl_tk_version -ltk$tcl_tk_version'"

View File

@@ -63,13 +63,9 @@ DEF
mkdir -p "$INSTALL_ROOT" mkdir -p "$INSTALL_ROOT"
cd "$INSTALL_ROOT" cd "$INSTALL_ROOT"
# pyenv/pyenv#1026 for i in {1..5}; do stub uname '-s : echo Darwin'; done
stub uname false '-s : echo Darwin' false '-s : echo Darwin' '-s : echo Darwin' for i in {1..4}; do stub sw_vers '-productVersion : echo 10.10'; done
stub sw_vers '-productVersion : echo 10.10'
stub sw_vers '-productVersion : echo 10.10'
stub sw_vers '-productVersion : echo 10.10'
stub sw_vers '-productVersion : echo 10.10'
stub cc 'false' stub cc 'false'
stub brew 'false' stub brew 'false'
stub make \ stub make \

View File

@@ -136,7 +136,7 @@ OUT
@test "apply built-in python patches should be sorted by its name" { @test "apply built-in python patches should be sorted by its name" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub brew false for i in {1..2}; do stub brew '* : false'; done
stub_make_install stub_make_install
stub patch ' : for arg; do [[ "$arg" == "-"* ]] || sed -e "s/^/patch: /" "$arg"; done >> build.log' stub patch ' : for arg; do [[ "$arg" == "-"* ]] || sed -e "s/^/patch: /" "$arg"; done >> build.log'
@@ -144,9 +144,7 @@ OUT
echo "bar" | install_patch definitions/vanilla-python "Python-3.6.2/bar.patch" echo "bar" | install_patch definitions/vanilla-python "Python-3.6.2/bar.patch"
echo "baz" | install_patch definitions/vanilla-python "Python-3.6.2/baz.patch" echo "baz" | install_patch definitions/vanilla-python "Python-3.6.2/baz.patch"
# yyuu/pyenv#257 for i in {1..2}; do stub uname '-s : echo Linux'; done
stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null
assert_success assert_success
@@ -173,9 +171,7 @@ OUT
" : 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'"
# yyuu/pyenv#257 for i in {1..4}; do stub uname '-s : echo Darwin'; done
stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
PYTHON_MAKE_INSTALL_TARGET="altinstall" TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null PYTHON_MAKE_INSTALL_TARGET="altinstall" TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null
assert_success assert_success
@@ -259,10 +255,7 @@ OUT
touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config" 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" chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config"
# yyuu/pyenv#257 for i in {1..3}; do stub uname '-s : echo Darwin'; done
stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin'
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[@]})"
@@ -278,24 +271,51 @@ EOS
} }
@test "enable universalsdk" { @test "enable universalsdk" {
# yyuu/pyenv#257
stub uname '-s : echo Darwin' for i in {1..3}; do stub uname '-s : echo Darwin'; done
stub arch "echo x86_64"
stub uname '-s : echo Darwin'
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[@]})"
OUT OUT
assert_success assert_success
assert_output <<EOS assert_output <<EOS
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/ --with-universal-archs=intel) PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/)
EOS
}
@test "enable universalsdk on Apple Silicon" {
for i in {1..3}; do stub uname '-s : echo Darwin'; done
stub arch "echo arm64"
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
OUT
assert_success
assert_output <<EOS
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/ --with-universal-archs=universal2)
EOS
}
@test "enable universalsdk with explicit archs argument" {
for i in {1..3}; do stub uname '-s : echo Darwin'; done
PYTHON_CONFIGURE_OPTS="--enable-universalsdk --with-universal-archs=foo" TMPDIR="$TMP" run_inline_definition <<OUT
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
OUT
assert_success
assert_output <<EOS
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/)
EOS EOS
} }
@test "enable custom unicode configuration" { @test "enable custom unicode configuration" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub brew false for i in {1..4}; do stub brew false; done
for i in {1..3}; 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'"
@@ -311,6 +331,8 @@ make install
OUT OUT
unstub make unstub make
unstub uname
unstub brew
} }
@test "default MACOSX_DEPLOYMENT_TARGET" { @test "default MACOSX_DEPLOYMENT_TARGET" {

View File

@@ -11,11 +11,10 @@ _STUB_RUN="${PROGRAM}_STUB_RUN"
_STUB_INDEX="${PROGRAM}_STUB_INDEX" _STUB_INDEX="${PROGRAM}_STUB_INDEX"
_STUB_RESULT="${PROGRAM}_STUB_RESULT" _STUB_RESULT="${PROGRAM}_STUB_RESULT"
_STUB_END="${PROGRAM}_STUB_END" _STUB_END="${PROGRAM}_STUB_END"
_STUB_DEBUG="${PROGRAM}_STUB_DEBUG" _STUB_LOG="${PROGRAM}_STUB_LOG"
if [ -n "${!_STUB_DEBUG}" ]; then [ -n "${!_STUB_LOG}" ] || eval "${_STUB_LOG}"="${TMPDIR}/${program}-stub-log"
echo "$program" "$@" >&${!_STUB_DEBUG} if test -z "${!_STUB_END}"; then echo "$program" "$@" >>"${!_STUB_LOG}"; fi
fi
[ -e "${!_STUB_PLAN}" ] || exit 1 [ -e "${!_STUB_PLAN}" ] || exit 1
[ -n "${!_STUB_RUN}" ] || eval "${_STUB_RUN}"="${TMPDIR}/${program}-stub-run" [ -n "${!_STUB_RUN}" ] || eval "${_STUB_RUN}"="${TMPDIR}/${program}-stub-run"
@@ -24,7 +23,7 @@ fi
# Initialize or load the stub run information. # Initialize or load the stub run information.
eval "${_STUB_INDEX}"=1 eval "${_STUB_INDEX}"=1
eval "${_STUB_RESULT}"=0 eval "${_STUB_RESULT}"=0
[ ! -e "${!_STUB_RUN}" ] || source "${!_STUB_RUN}" if test -e "${!_STUB_RUN}"; then source "${!_STUB_RUN}"; fi
# Loop over each line in the plan. # Loop over each line in the plan.
@@ -80,14 +79,39 @@ done < "${!_STUB_PLAN}"
if [ -n "${!_STUB_END}" ]; then if [ -n "${!_STUB_END}" ]; then
# Clean up the run file.
rm -f "${!_STUB_RUN}"
# If the number of lines in the plan is larger than # If the number of lines in the plan is larger than
# the requested index, we failed. # the requested index, we failed.
if [ $index -ge "${!_STUB_INDEX}" ]; then if [ $index -ge "${!_STUB_INDEX}" ]; then
eval "${_STUB_RESULT}"=1 eval "${_STUB_RESULT}"=1
{
echo "index: $index; stub index: ${!_STUB_INDEX}"
echo "plan:"
cat "${!_STUB_PLAN}"
echo "run:"
cat "${!_STUB_RUN}"
echo "log:"
cat "${!_STUB_LOG}"
} >&2
fi fi
if [ "${!_STUB_RESULT}" -ne 0 ]; then
{
echo "index: $index; stub index: ${!_STUB_INDEX}"
echo "plan:"
cat "${!_STUB_PLAN}" || true
echo "run:"
cat "${!_STUB_RUN}" || true
echo "log:"
cat "${!_STUB_LOG}" || true
} >&2
fi
# Clean up the run file.
rm -f "${!_STUB_RUN}"
rm -f "${!_STUB_LOG}"
# Clean up the run file.
rm -f "${!_STUB_RUN}"
rm -f "${!_STUB_LOG}"
# Return the result. # Return the result.
exit "${!_STUB_RESULT}" exit "${!_STUB_RESULT}"

View File

@@ -25,6 +25,7 @@ stub() {
export "${prefix}_STUB_PLAN"="${TMP}/${program}-stub-plan" export "${prefix}_STUB_PLAN"="${TMP}/${program}-stub-plan"
export "${prefix}_STUB_RUN"="${TMP}/${program}-stub-run" export "${prefix}_STUB_RUN"="${TMP}/${program}-stub-run"
export "${prefix}_STUB_LOG"="${TMP}/${program}-stub-log"
export "${prefix}_STUB_END"= export "${prefix}_STUB_END"=
mkdir -p "${TMP}/bin" mkdir -p "${TMP}/bin"

View File

@@ -32,8 +32,7 @@ static_version="$(grep VERSION "$bats_bin" | head -1 | cut -d'"' -f 2)"
@test "git remote doesn't match" { @test "git remote doesn't match" {
stub git \ stub git \
'remote -v : echo origin https://github.com/Homebrew/homebrew.git' \ 'remote -v : echo origin https://github.com/Homebrew/homebrew.git'
"describe --tags HEAD : echo v1984-12-gSHA"
run python-build --version run python-build --version
assert_success "python-build ${static_version}" assert_success "python-build ${static_version}"
} }

View File

@@ -79,7 +79,7 @@ OUT
} }
@test "sys.executable with system version (#98)" { @test "sys.executable with system version (#98)" {
system_python=$(which python3) system_python="$(python3 -c 'import sys; print(sys.executable)')"
PYENV_VERSION="custom" PYENV_VERSION="custom"
create_executable "python3" "" create_executable "python3" ""

View File

@@ -25,7 +25,7 @@ load test_helper
} }
#Arch has Python at sbin as well as bin #Arch has Python at sbin as well as bin
@test "prefix for sbin system" { @test "prefix for system in sbin" {
mkdir -p "${PYENV_TEST_DIR}/sbin" mkdir -p "${PYENV_TEST_DIR}/sbin"
touch "${PYENV_TEST_DIR}/sbin/python" touch "${PYENV_TEST_DIR}/sbin/python"
chmod +x "${PYENV_TEST_DIR}/sbin/python" chmod +x "${PYENV_TEST_DIR}/sbin/python"
@@ -46,6 +46,6 @@ OUT
} }
@test "prefix for invalid system" { @test "prefix for invalid system" {
PATH="$(path_without python)" run pyenv-prefix system PATH="$(path_without python python2 python3)" run pyenv-prefix system
assert_failure "pyenv: system version not found in PATH" assert_failure "pyenv: system version not found in PATH"
} }

View File

@@ -44,7 +44,8 @@ flunk() {
assert_success() { assert_success() {
if [ "$status" -ne 0 ]; then if [ "$status" -ne 0 ]; then
flunk "command failed with exit status $status" flunk "command failed with exit status $status" $'\n'\
"output: $output"
elif [ "$#" -gt 0 ]; then elif [ "$#" -gt 0 ]; then
assert_output "$1" assert_output "$1"
fi fi
@@ -52,7 +53,8 @@ assert_success() {
assert_failure() { assert_failure() {
if [ "$status" -eq 0 ]; then if [ "$status" -eq 0 ]; then
flunk "expected failed exit status" flunk "expected failed exit status" $'\n'\
"output: $output"
elif [ "$#" -gt 0 ]; then elif [ "$#" -gt 0 ]; then
assert_output "$1" assert_output "$1"
fi fi
@@ -111,24 +113,26 @@ assert() {
# Output a modified PATH that ensures that the given executable is not present, # Output a modified PATH that ensures that the given executable is not present,
# but in which system utils necessary for pyenv operation are still available. # but in which system utils necessary for pyenv operation are still available.
path_without() { path_without() {
local exe="$1"
local path=":${PATH}:" local path=":${PATH}:"
local found alt util for exe; do
for found in $(which -a "$exe"); do local found alt util
found="${found%/*}" for found in $(PATH="$path" which -a "$exe"); do
if [ "$found" != "${PYENV_ROOT}/shims" ]; then found="${found%/*}"
alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')" if [ "$found" != "${PYENV_ROOT}/shims" ]; then
mkdir -p "$alt" alt="${PYENV_TEST_DIR}/$(echo "${found#/}" | tr '/' '-')"
for util in bash head cut readlink greadlink; do mkdir -p "$alt"
if [ -x "${found}/$util" ]; then for util in bash head cut readlink greadlink which; do
ln -s "${found}/$util" "${alt}/$util" if [ -x "${found}/$util" ]; then
fi ln -s "${found}/$util" "${alt}/$util"
done fi
path="${path/:${found}:/:${alt}:}" done
fi path="${path/:${found}:/:${alt}:}"
fi
done
done done
path="${path#:}" path="${path#:}"
echo "${path%:}" path="${path%:}"
echo "$path"
} }
create_hook() { create_hook() {

View File

@@ -25,7 +25,7 @@ stub_system_python() {
} }
@test "not even system python available" { @test "not even system python available" {
PATH="$(path_without python)" run pyenv-versions PATH="$(path_without python python2 python3)" run pyenv-versions
assert_failure assert_failure
assert_output "Warning: no Python detected on the system" assert_output "Warning: no Python detected on the system"
} }