60 Commits

Author SHA1 Message Date
Bo Anderson
f01d264c3c language/python: allow python@3.7 to be used for virtualenvs 2020-07-09 15:31:53 +01:00
Mike McQuaid
fa760a2f26
Fix brew style. 2020-07-07 13:12:37 +01:00
Rylan Polster
a7a9793f99 needs_python? separate formula name from tap name 2020-07-03 16:37:32 -04:00
Mike McQuaid
4f75a77b08
Update deprecations
Add more deprecations, disable deprecations and remove disabled code.
2020-05-18 13:50:46 +01:00
Bo Anderson
32ab83d055 language/python: move rewrite_python_shebang to compat 2020-03-27 22:27:06 +00:00
Bo Anderson
5d68856350 language/python: use rewrite_shebang, add detected_python_shebang 2020-03-27 19:18:23 +00:00
Michka Popoff
30c4383e86
Merge pull request #7141 from iMichka/regex
rewrite_python_shebang: make version part optional
2020-03-10 22:29:54 +01:00
Michka Popoff
cccd8d3655 rewrite_python_shebang: make version part optional
We forgot about the simplest case:
/usr/bin/env python
2020-03-10 22:11:45 +01:00
Bo Anderson
2594e7093e language/python: fix virtualenv symlinks for versioned Python 2020-03-10 14:17:30 +00:00
Alexander Bayandin
9bab086967 rewrite_python_shebang: move loop invariants out of loop 2020-03-05 23:20:16 +00:00
Peter Teixeira
7ccec0cdf0 Use literal "python" 2020-03-04 10:13:32 -05:00
Bo Anderson
f9481d4d35 python: Fix error in virtualenv_install_with_resources
Fixes #7115.
2020-03-04 14:13:41 +00:00
Mike McQuaid
f6631d6449
Merge pull request #7019 from iMichka/python2doc
brew: remove most traces of python@2
2020-03-04 11:21:07 +00:00
Michka Popoff
79a3d3568b python: add rewrite function for generic shebangs
From PEP 394
https://www.python.org/dev/peps/pep-0394/#for-python-script-publishers

In cases where the script is expected to be executed outside virtual environments,
developers will need to be aware of the following discrepancies across platforms and installation methods:

Older Linux distributions will provide a python command that refers to Python 2, and will likely not provide a python2 command.
Some newer Linux distributions will provide a python command that refers to Python 3.
Some Linux distributions will not provide a python command at all by default, but will provide a python3 command by default.

When potentially targeting these environments, developers may either use a Python package installation tool that rewrites shebang lines
for the installed environment, provide instructions on updating shebang lines interactively,
or else use more specific shebang lines that are tailored to the target environment.
2020-02-28 20:08:43 +01:00
Michka Popoff
c46a30b575 brew: remove most traces of python@2 2020-02-17 22:38:24 +01:00
Michka Popoff
38feac473c virtualenv: support mojave and high sierra system Python
On High Sierra and Mojave, virtualenv 16.x does not build when used with
system Python
Fall back to an older virtualenv version, which is known to work.
2019-12-30 20:18:55 +01:00
Alexander Bayandin
c92a3d3f84 virtualenv_install_with_resources: add python@3.8 handling 2019-12-19 17:23:15 +00:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
EricFromCanada
fa6404e0f5 grammar fixes 2019-04-13 21:29:32 -04:00
Jonathan Chang
46af0260f0 python: support pypy3 2019-03-11 20:14:03 +11:00
EricFromCanada
20167e5f1b Adjust comments to tidy API docs output. 2018-10-18 21:42:43 -04:00
Jonathan Chang
0fe273be5f language/python: support pypy 2018-09-24 16:24:30 -04:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
7762ce32aa Use more descriptive heredoc names. 2018-07-11 18:15:30 +02:00
commitay
e3ec061a3a language/python: python 3.7 2018-07-05 10:16:04 +10:00
Mike McQuaid
9fca172d03 Fix HOMEBREW_RUBY_WARNINGS="-w"
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00
ilovezfs
776fec7f6b virtualenv_install_with_resources: invoke python with versioned name.
The unversioned python executable no longer refers to python3.
2018-03-09 14:01:52 -08:00
ilovezfs
34bd99af8d language/python: expect @ in python@2 Cellar paths
The realpath of the python@2 Cellar contains "python@2" not "python2" so
check for "python@2" when doing Cellar->opt robustifications.
2018-03-08 08:10:48 -08:00
Mike McQuaid
bc3389bdae
Merge pull request #3863 from MikeMcQuaid/python3-changes
Adjust docs and more internal code for Python 3.
2018-03-03 18:17:04 +00:00
Mike McQuaid
70253f0009 Adjust docs and more internal code for Python 3.
Now we have `python` for Python 3 and `python@2` for Python 2 some more
adjustments need to be made.
2018-03-03 09:42:25 +00:00
Steven Peters
0d5ae6cf0b
language/python: version 3.6 in site_packages 2018-03-02 09:05:41 -08:00
ilovezfs
04cec369c7 language/python: handle python@* in each_python 2018-02-28 03:20:14 -08:00
ilovezfs
5496a04dd9 language/python: handle python@* in virtualenv_install_with_resources 2017-12-30 15:11:14 -08:00
Mike McQuaid
4b849dacd2
Merge pull request #3573 from DomT4/python_dead_code
python: remove package_available? logic
2017-12-13 08:50:05 +00:00
Dominyk Tiller
5a018f8650
python: remove package_available? logic
It was added in https://github.com/Homebrew/legacy-homebrew/pull/37345 for
a use case discussed in https://github.com/Homebrew/legacy-homebrew/pull/37340
that never seems to have actually emerged. I can find no reference of it
ever having been used, despite it existing for 2+ years here.
2017-12-13 06:16:02 +00:00
Dominyk Tiller
d6ebdf1e62
python: handle env filtering on pth check
Since ENV filtering became the default this has been chucking
erroneous warnings from both `brew doctor` and things like `brew install pygobject`
about needing to run:
```
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/xyz/Library/Python/2.7/lib/python/site-packages/homebrew.pth
```
even though I had Homebrew's `python` installed.
2017-12-13 06:09:37 +00:00
Markus Reiter
526299913f Remove usless comments. 2017-10-24 19:39:40 +02:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Mike McQuaid
01e9ec9a9f Rubocop: automatic rule fixes. 2017-09-24 21:23:59 +01:00
Mike McQuaid
ba3c46d24f More deprecations.
Deprecate more methods. Internal APIs have been verified to be unused
elsewhere and removed. External APIs have had deprecation methods added.
Existing deprecations have been either upgraded to produce warnings or
no longer deprecated and the reasoning documented.
2017-04-22 16:28:07 +01:00
Tim D. Smith
47d57ca995 Immortalize virtualenvs better
virtualenvs remember the prefix of the python that created them and do
magic to load packages from them; help them remember a more durable
path.
2016-10-04 22:57:08 -07:00
ilovezfs
23a38e0ff6 virtualenv_install_with_resources: select correct python
`virtualenv_install_with_resources` will now attempt to guess the
desired Python based on the active build options and based on the
dependencies and requirements. When the situation is ambiguous (e.g.,
`depends_on :python3` and `build.with? "python"` is true) raise
`FormulaAmbiguousPythonError` unless `:using => "python"` or
`:using => "python3"` has been passed to resolve the ambiguity.

In most cases, this will allow

```
    virtualenv_create(libexec, "python3")
    virtualenv_install_with_resources
```

to be changed to just

```
    virtualenv_install_with_resources
```
2016-10-02 18:08:56 -07:00
Mike McQuaid
16be0f105e language/python: fix Rubocop warnings. 2016-09-10 10:40:02 +01:00
Xu Cheng
a8566c9848 various: eliminate the usage of any? (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)).
2016-08-05 22:01:32 +08:00
Martin Afanasjew
b77a695b7a python: tweak script linking in virtualenv (#613)
* python: tweak script linking in virtualenv

Instead of making the formula author use a slightly awkward block like

  venv.link_scripts(bin) { venv.pip_install buildpath }

avoid exposing this implementation detail and offer the more familiar:

  venv.pip_install buildpath, :link_scripts => bin

* Add non-block form and use instead of recursion

* Update 'pip_install' documentation

* Remove obsolete 'link_scripts'

* Add test for 'pip_install' with linking scripts

Also drop no longer relevant (and broken) `link_scripts` test, that
served as a template for the new test.

* Restore compatibility with Ruby 1.8.7

* Replace option hash with 'pip_install_and_link'

* Avoid confusing 'Object#tap' and fix silly bug

* Avoid side effects in mock object parameter check

* Simplify argument check (no need for a block)
2016-08-02 13:37:15 -07:00
Tim D. Smith
a5a930c48b Allow virtualenvs to find Python bindings provided by deps (#608)
Allow virtualenvs to find Python bindings provided by deps

Closes #603.
2016-07-31 11:59:30 -07:00
Tim D. Smith
209d9e8a6e Refurbish args in virtualenv (#600)
Instead of adding additional lines to formula.rb:
  https://git.io/vKxxh
just turn on argument refurbishment for any formula that creates a
virtualenv.

cf Homebrew/ruby-macho#50, Homebrew/homebrew-core#1663
2016-07-29 08:45:26 -07:00
Tim D. Smith
2783adec4a Add helper class for Python virtualenvs 2016-07-26 21:34:06 -07:00
Vlad Shablinsky
3fb5d70a72
Unify Version.create usage
Substitue each Version.new and HeadVersion.new with Version.create
to unify Version and HeadVersion instantiation among core code.

Note that this does not relate to Mac::OS::Version class.
2016-07-16 20:39:13 +08:00
Martin Afanasjew
4f2e31b3e3 language/python: fix bogus require
Including the extension is not an error, but we don't normally do this.
2016-07-09 11:58:43 +02:00