Commit Graph
408 Commits
Author SHA1 Message Date
Jack Nagel e9bf7ae8ed Update Formula#to_hash for tweaked conflicts implementation 2013-06-09 15:20:36 -05:00
Jack Nagel 70069c5d75 Separate formula conflicts from requirements
Closes #20357.
2013-06-09 13:45:25 -05:00
Jack Nagel 455916b1c7 Make Test::Unit assertions available in formula tests
Closes #18753.
Closes #20358.
2013-06-08 21:31:44 -05:00
Adam Vandenberg 76b89b6a82 Add class name to method_added error 2013-06-06 16:41:26 -07:00
Jack Nagel dc315dc525 Use ivar accessors 2013-06-06 12:10:41 -05:00
Samuel John 432545f258 Hotfix: Revert Python module 2013-06-06 13:18:32 +02:00
Samuel John 02ddd442f2 PythonInstalled: Don't require superenv
* The python do ... end block does no longer
  require 'superenv' but saves and restores
  the ENV by using ENV.to_hash and `ensure`.
  This should resolve some build problems
  with formulae using `env :std`!
* `python_helper` is now in a module `Python`.
* Imporoved some comments in python_dependency.rb
2013-06-06 12:33:28 +02:00
Adam Vandenberg d9a9673409 Consolidate formula visibility blocks
Closes #20261.
2013-06-05 09:48:12 -07:00
Jack Nagel 0759cce3c2 Extract attr_rw from Formula for reuse
Closes #20239.
2013-06-04 11:06:18 -05:00
Jack Nagel f970e6d3a5 Remove unnecessary use of instance_eval 2013-06-03 17:03:09 -05:00
Samuel John 0b50110107 Python 2.x and 3.x support
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.

To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.

The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:

python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.

Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.

python do
  system python, 'setup.py', "--prefix=#{prefix}"
end

Read more in the Homebrew wiki.
2013-06-03 17:29:43 +02:00
Jack Nagel d734e46667 Fix Formula#installed_prefix logic
Due to the precedence of "and" relative to "||", this was not working as
intended; but because #version influences #prefix, the outcome was still
correct. So we can simplify this method quite a bit, and take the
opportunity to share code with #prefix.
2013-05-25 19:24:08 -05:00
Mike McQuaid d6dae4544f Remove cat_without_underscores bottle methods. 2013-05-25 16:02:18 +01:00
Jack Nagel fad23bc4fd Formula: move pin methods somewhere less intrusive 2013-05-21 22:41:21 -05:00
Jack Nagel 64810fbc84 Use subdirs to avoid checking for .DS_Store 2013-05-16 17:48:12 -05:00
Jack Nagel a648559887 Formula: remove specs accessor
This information is only used by the downloader, no need to expose it.
2013-05-16 15:33:31 -05:00
Jack Nagel 5b529b0851 Formula#fetch: always return the cached path
This allows us to remove some type checks that were protecting against
potential nils.
2013-05-16 14:06:26 -05:00
Jack Nagel 75e371684e Adjust semantics of Formula#fetch
It doesn't really make logical sense that this method returns both the
fetched path (or sometimes nil!) and the downloader, so just return the
path (again, or nil!) and callers that want the downloader can ask for
it separately.
2013-05-16 14:06:26 -05:00
Jack Nagel a8fec19304 Use Enumerable#grep 2013-05-10 23:45:06 -05:00
Misty De Meo e585ea04e3 Formula: fix to_hash output for bottles 2013-05-05 10:58:12 -05:00
Adam Vandenberg 11bf38b2b1 Add frameworks helper to formula 2013-05-03 11:41:55 -07:00
Jack Nagel 03a4ecfbca Allow brew versions to work with underspecified formulae 2013-04-27 14:44:48 -05:00
Simon Sigurdhsson d6a2964eab Remove global methods from formulae
Removes any global methods from formulae, and moves #kext_prefix (which
seems to be at least somewhat abstractable) into the Formula class. The
only formula with global methods is now aspell; it (and its generating
script in contrib) has been changed to prefix that method with
`aspell_`, to minimize the risk of name collisions.

Closes #19331.
Closes #19343.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-21 23:48:50 -05:00
Jack Nagel b596f73c03 Add tests for FormulaPin and simplify implementation 2013-04-16 01:58:11 -05:00
Jack Nagel f4ab1431dc Avoid expensive Pathname concatenation 2013-04-15 15:00:57 -05:00
Jack Nagel 176908621d Style nit 2013-04-14 23:29:15 -05:00
Jack Nagel bed85d1a5d Don't use Pathname#/ in performance-critical code
This method (well, really, #join) is *twice* as slow as simple
concatenation, and shouldn't really be used at all in non-Formula code.
2013-04-14 20:09:20 -05:00
Jack Nagel 6f252fe1d2 Raise a useful exception for incomplete formulae 2013-04-13 17:40:14 -05:00
Jack Nagel f0b7f44415 Allow "devel-only" formulae
It seems only natural that this should be possible, or at the very
least, it should not result in calling methods on nil.
2013-04-13 17:40:13 -05:00
Jack Nagel 563d8be6bd Improved formula attribute validation
The initializer for Formula does a number of validations, but it does
them in a weird order, and some attributes aren't validated under
certain circumstances. This became even more of a mess when most
software package attributes were moved into the SoftwareSpec class.

This commit removes the last vestiges of storing these attributes as
instance variables. In particular, it eliminates #set_instance_variable
and #validate_variable, replacing them with methods that operate on
SoftwareSpec instances, and generate more useful errors.

Doing these validations unconditionally in the initializer means we bail
out much earlier if the formula has invalid attributes or is not fully
specified, and no longer need to validate in #prefix.

Technically we don't need to validate in #brew either, but we continue
to do so anyway as a safety measure, and because we cannot enforce calls
to super in subclasses.
2013-04-13 17:40:12 -05:00
Jack Nagel 0dd8fe8928 Check existence rather than rescue exceptions 2013-04-09 19:40:08 -05:00
Jack Nagel 18f07bb0e7 Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this).
2013-04-07 20:59:49 -05:00
Jack Nagel fb673a39a1 Remove obsolete comment about download_strategy
The canonical way to select a custom download strategy is to pass

  :using => StrategyClass

as an argument to the url DSL method.
2013-04-05 14:41:14 -05:00
Mike McQuaid 391aa8408e Add optional post_install method to Formula.
Sometimes we may want to run commands after bottle installation (such as
creating directories outside the Cellar) so this method allows us to do
so.

Closes #18382.
2013-04-01 22:12:43 +01:00
Simon Sigurdhsson 85eb73ced7 brew-pin: prevent selected formulae from upgrade.
* Added `pin` et. al. to manpage.
* Added `brew pin` to `brew.1` * Added `brew unpin` to `brew.1`
* Added `brew list --pinned` to `brew.1`
* Added information about frozen formulae to `brew upgrade` in `brew.1`
* Added `pin` et.al. to completion scripts.
* Unpin formulae when uninstalling them
* Unpin and re-pin formulae when upgrading (avoids stale symlink)

References #18386.
Closes #18515.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-30 19:50:47 +00:00
Jack Nagel 1bff4c6bc3 Make clear that this method discards arguments 2013-03-28 17:37:28 -05:00
Jack Nagel 10afa74c06 Move this method somewhere more appropriate 2013-03-20 22:32:56 -05:00
Jack Nagel ba38f0937b Move Formula.all to compat 2013-03-20 22:32:56 -05:00
Mike McQuaid 5010dca995 brew-info: specify whether poured or built.
- Store in the tab if a bottle was poured for the build.
- Add an additional line of output to `brew info` outputting whether
  the formula was built from source or poured from a bottle.

Closes #18430.
Closes #18475.
2013-03-20 23:06:38 +00:00
Jack Nagel 31fd139e57 Simplify SoftwareSpec checksum methods
Reader methods for specific checksum types have been absent from the
Formula class for some time, so there isn't any reason to expose them in
SoftwareSpec, either.

Thus, these methods now only act as setters, and #checksum should be
used to access the constructed Checksum object.
2013-03-18 15:10:36 -05:00
Jack Nagel aa69b671b3 Use a priority queue to select compilers
The existing case-statement with nested if-statements is gross and hard
to extend. Replacing it with a priority queue simplifies the logic and
makes it very easy to add new compilers to the fails_with system, which
we will likely want to do in the future.
2013-03-16 13:05:02 -05:00
Jack Nagel f91df69127 Replace custom collection with Set
The original constraints that led to using a custom collection rather
than Array or Set here no longer exist, so let's avoid the pointless
abstraction here.
2013-03-16 13:05:02 -05:00
Jack Nagel 5ddd40b844 Switch compilers when no build is specified
Given the current state of OS X compilers, the original fails_with
behavior is becoming less useful, mostly resulting in build failures
each time the compiler is updated. So make the following changes:

When a build is specified, we retain the old behavior: switch compilers
if the available compiler is <= the build, don't switch if it is > the
build.

When no build is specified, unconditionally switch compilers, and don't
output the advice message. This allows us to mark formulae as
perpetually failing, avoiding the need to update formulae each time a
new compiler build is made available.

As a bonus, this makes the logic much easier to reason about.

Closes #18175.
2013-03-12 13:55:15 -05:00
Jack Nagel e5a103b3b8 Pass filename and lineno arguments to class_eval 2013-03-12 00:38:52 -05:00
Mike McQuaid 041060e28f Support 32-bit 10.6 bottles.
Closes #17735.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-01 17:49:09 +00:00
Mike McQuaid d1cd6b2d86 Add custom bottle URL support.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-01 17:49:09 +00:00
Adam Vandenberg b9f0824565 Revert "Shouldn't override def patch"
This reverts commit 6963a35651.
2013-02-24 12:16:32 -08:00
Adam Vandenberg 6963a35651 Shouldn't override def patch 2013-02-22 09:34:06 -08:00
Jack Nagel 117977ca32 Formula: fix class-level version accessor
When given no arguments, this should return the stable version, but it
hasn't since we stopped setting this direction in the class's @version
variable.
2013-02-21 22:19:11 -06:00
Mike McQuaid c0793d5296 Only fails_with compiler version for developers.
Actually works properly now.

This reverts commit a0e56345ea.
2013-02-21 21:40:15 +00:00