21 Commits

Author SHA1 Message Date
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
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Tim D. Smith
b1d9169ae6 language/python: add package_available? helper
Add helper to check whether a module is importable.

Closes Homebrew/homebrew#37345.

Signed-off-by: Tim D. Smith <git@tim-smith.us>
2015-03-03 06:31:29 -08:00
Tim D. Smith
c195f072d1 language/python: add --no-user-cfg to setuptools options
Closes Homebrew/homebrew#35681.
2015-01-09 23:13:36 -08:00
Tim D. Smith
65a7a631ea Language::Python.setup_install: add deprecation warning 2014-12-10 14:18:24 -08:00
Tim D. Smith
75535395ac language/python: setup_install_args
Add a helper like std_cmake_args that returns the correct incantation
for invoking setup.py in a consistent way and with our preferred
arguments. Replaces setup_install.
2014-12-10 14:18:23 -08:00
Tim D. Smith
7348206e53 language/python: make sure site_packages is writable 2014-11-14 16:05:18 -08:00
Tim D. Smith
cb684f6c1a language/python: new setup_install method
Closes Homebrew/homebrew#33988.
2014-11-10 15:41:57 -08:00
Tim D. Smith
b584689afa language/python: add helper methods for pth detection 2014-11-02 10:30:21 -08:00
Jack Nagel
4d9d01893e Move deprecated Formula class methods to compat
These have all been moved to Formulary.
2014-06-22 15:03:17 -05:00
Mike McQuaid
34edc35b9b Add Language::Python module. 2014-03-12 13:56:27 +00:00