143 Commits

Author SHA1 Message Date
Mike McQuaid
b14ff8d163 dependency_collector: pass second tag as import.
Closes Homebrew/homebrew#27346.
2014-03-09 17:25:26 +00:00
Jack Nagel
8bfcdf0bd8 Remove special X11 proxy deps 2014-03-05 20:45:44 -06:00
Jack Nagel
c6bc01ab58 Add TapDependency 2014-02-28 11:16:55 -06:00
Jack Nagel
74eb25df81 Cache and reuse Dependency objects 2014-02-27 14:22:43 -06:00
Mike McQuaid
28143fb653 PythonDependency: massive refactoring.
Closes Homebrew/homebrew#24842.
2014-01-20 15:42:52 -08:00
Jack Nagel
36d3a2dfa8 Homebrew CVS is required for Xcode 5+ 2013-12-04 01:19:17 -06:00
Adam Vandenberg
268feffae4 support .lz archives
Closes Homebrew/homebrew#24775.
2013-11-29 15:18:49 -08:00
Jack Nagel
1f190890fd Implement inferred CVS dependency
Fixes Homebrew/homebrew#24444.
Closes Homebrew/homebrew#24445.
Closes Homebrew/homebrew#24458.
2013-11-18 19:56:15 -06:00
Jack Nagel
6c3ee52d14 Remove special cases in build-time dep audit
Closes Homebrew/homebrew#23931.
2013-11-04 12:10:26 -06:00
Jack Nagel
076df32be3 Add ant dependency
Closes Homebrew/homebrew#23484.
Closes Homebrew/homebrew#23494.
Closes Homebrew/homebrew#23681.
2013-10-28 14:44:20 -05:00
Jack Nagel
3df31557c8 Avoid the need to defensively flatten tags array 2013-10-15 13:26:23 -05:00
Jack Nagel
c5289f2503 Infer dependencies from download strategies and URLs
Closes Homebrew/homebrew#20849.
Closes Homebrew/homebrew#22871.
2013-09-28 16:37:05 -05:00
Mike McQuaid
315c7a1212 Rename PythonInstalled to PythonDependency.
Make it more consistent with other requirements.
2013-09-14 12:21:49 +01:00
Jack Nagel
f2ebc0e325 Stop mutating dependency specifications 2013-09-13 09:57:53 -05:00
Samuel John
fb7f16fc94 Allow specifying version in depends_on :python
Note, in the explict form:

    PythonInstalled.new('2.7') => :recommended

the tag :recommended is ignored (not a limitation
of PythonInstalled itself). One solution was to write

    PythonInstalled.new('2.7', [:recommended])

but that is not as beautiful as we like it.

Therefore, now it is possible to:

    depends_on :python => ['2.7', :recommended]

Only the first tag is attempted to be parsed as
a version specifyer "x" or "x.y" or "x.y.z"...
2013-07-16 11:04:57 +02:00
Jack Nagel
919aac0b89 Add syntax sugar for MPIDependency
Closes Homebrew/homebrew#20797.
2013-06-26 22:18:13 -05:00
Jack Nagel
249a3f1465 Print inspected values in dependency collector errors 2013-06-26 15:25:09 -05:00
Jack Nagel
3abd9455a3 Rename Fortran requirement to fix option generation
So, `depends_on :fortran => :optional` will generate "--with-fortran"
rather than "--with-fortranRequired".
2013-06-25 21:12:15 -05:00
Adam Vandenberg
0f1d491d81 Add :fortran requirement 2013-06-24 07:35:42 -07:00
Samuel John
a3a0146d7c Python module deps, ext. python fix and 10.6 fix
* Fixes Homebrew/homebrew#20572 by tweaking the logic that decides
  which python is used by the `python` object
  inside a formula. There was a bug when on 10.6
  there is no Python 2.7 but a :recommended
  Python was still treated as being available.

* Use the user's PATH when looking for an external
  Python. Until now only brewed or OS X system's
  python have been found by `depends_on :python`.

  But now we support any Python in PATH (e.g.
  pyenv's python).

* Further, instead of handling python modules
  and import tests in LanguageModuleDependency,
  these are now handled by:

        depends_on :python => 'numpy'  # for example

  The old style

        depends_on 'numpy' => :python

  is still supported and is only an alias
  for the newer style (only for :python, the
  other languages are not altered by this commit).

  The reasoning is that if a formula requires
  a python module, it basically also needs
  python itself - and further that specific
  version of python has to provide the module.
  So the `PythonInstalled` is the natural place
  to check for the availability of a python
  module.

  Using a python module and other tags like
  :optional or :recommended is done like so:

        depends_on :python => [:optional, 'numpy']

  Specifying another PyPi (Python Package index)
  name than the module import name is seldom used
  but supported, too:

         depends_on :python => ['enchant'=>'pyenchant']

  A last note: For clarity, you can define
  multiple depends_on statements with different
  modules to be importable.`
2013-06-18 10:30:17 +02:00
Adam Vandenberg
32f637d590 Add minimum OS X version requirement
Closes Homebrew/homebrew#19998.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-06-16 20:36:50 -07:00
Misty De Meo
c9c5e56363 Add :ld64 dependency
This allows formulae which won't build with Tiger's ld to conditionally
request a dependency on the ld64 formula. This modifies the build
environment appropriately, and will only be active on Tiger.
2013-06-08 19:10:38 -05:00
Samuel John
c524895666 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
b322020338 Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the side effect of
cleaning up the dependency API.
2013-05-06 16:08:50 -05:00
Jack Nagel
894a6c9776 TypeError is appropriate here 2013-05-06 16:08:49 -05:00
Jack Nagel
666b48e391 Check Requirement before Dependency
It's much more likely that an instance of Requirement is passed.
2013-05-06 16:08:49 -05:00
Jack Nagel
f47e43aa2b Extract string and class logic from parse_spec 2013-05-06 16:08:49 -05:00
Jack Nagel
368ba306d7 Don't accept Formula objects as dep specs
It was pointed out that this isn't used at all.
2013-04-18 01:17:15 -05:00
Jack Nagel
7ea15918bb Reorder dep spec types by frequency 2013-04-17 14:12:41 -05:00
Adam Vandenberg
a7714a804b Add :hg build requirement.
Closes Homebrew/homebrew#19074.
2013-04-17 10:01:38 -07:00
Jack Nagel
0fb4f9c426 Reduce repeated array inclusion check
Currently we check if "tag" is present in LANGUAGE_MODULES for every
String dep, even if tag is nil. Stop doing this, and make the
LANGUAGE_MODULES array into a Set instead to improve lookup performance.
2013-04-16 09:53:02 -05:00
Jack Nagel
9db0e68eb6 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
ee7178562f Move x86_64 Requirement into core
Closes Homebrew/homebrew#18886.
2013-04-02 13:17:24 -05:00
Jack Nagel
71f85300b4 Establish a convention for Requirement names
The name attribute of requirements is used when generating options for
the :optional and :recommended dependency tags.

Unless otherwise specified, the name attribute of a Requirement will be
populated by stripping any module prefixes from the beginning and
"Dependency" or "Requirement" from end of the class name and downcasing
the result.

Closes Homebrew/homebrew#17759.
2013-02-12 16:26:10 -06:00
Jack Nagel
3e9241312d Add :libltdl dep for libtool's libltdl
The :libtool dep is implicitly a build-time dep; :libltdl can be used
for software that uses the ltdl library at runtime.
2013-02-10 19:28:14 -06:00
Jack Nagel
803649bf04 Shrink DependencyCollector#parse_symbol_spec and add tests 2013-02-10 19:27:33 -06:00
Jack Nagel
2fed17f4d1 Ensure :cairo and :pixman resolve to standard formula deps
We do not use X11 to satisfy these deps for consistency reasons,
but we should continue to support the symbols for compatibility.
2013-02-02 00:09:28 -06:00
Jack Nagel
ade998696d Mark symbol-style autotools deps as build deps by default 2013-02-01 23:49:52 -06:00
Jack Nagel
f4b126cc14 Create proxy classes for "partial" X11 dependencies
When a formula's dependency tree contains more than one X11 dependency,
they are de-duplicated by comparing the min_version attribute. However,
this can result in broken dependency trees if one of the X11Dependency
objects was actually specified as e.g. `:libpng`.

In practice, this only matters when one or more of the dependencies has
additional metadata that makes it distinct from the rest, i.e. an
:optional or :recommended tag.

To combat this, make these special, "partial" X11 dependencies instances
of different classes so that they are not de-duped.

It will still be necessary, at the time when requirements are expanded
by the installer, to de-duplicate any remaining X11 dependencies after
applying the optional/recommended filters in order to avoid duplicated
modifications to the environment (as ENV.x11 is not idempotent).

c.f. Homebrew/homebrew#17369.
2013-01-31 15:39:26 -06:00
Jack Nagel
351cd89a71 Pass tag to class name style requirement declarations 2013-01-30 14:18:34 -06:00
Jack Nagel
26c0524f1a DependencyCollector: return created dep from #add 2013-01-28 10:35:14 -06:00
Jack Nagel
210401654b Allow specifying a name attribute for X11Dependency 2013-01-28 10:35:14 -06:00
Jack Nagel
adf90691f1 Split dependency classes into separate files 2013-01-26 20:30:05 -06:00