Commit Graph
198 Commits
Author SHA1 Message Date
David MacMahon f821514e93 Add HOMEBREW_NO_GITHUB_API env var.
This patch allows users to "opt out" of using the GitHub API altogether
by setting the HOMEBREW_NO_GITHUB_API environment variable. The
value of the environment variable does not matter (it can even be
empty!).

For Bash/ZSH: export HOMEBREW_NO_GITHUB_API=1

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-10-25 21:12:28 +01:00
Jack Nagel fce53bc1f5 Avoid comparing MacOS.version to floats 2013-10-22 20:47:37 -05:00
Jack Nagel 3cba7d44c6 Rename MacOS to OS::Mac 2013-10-18 12:56:51 -05:00
Adam Vandenberg e9d8fcd03e move paths to utils 2013-09-17 06:44:25 -07:00
Dan Hughes 54a6cffe8c Use system path for more tools, for Linux compat.
Closes #22196.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-08-30 13:02:19 -07:00
Amos Wenger 13c2776795 Use File::PATH_SEPARATOR globally instead of ':'
On Unix, the path separator is ':', whereas on Windows,
it is ';'. This is the first of a series of patch to bring
macbrew's and winbrew's codebases closer together.

The main places the magic constant ':' was being used were:
  - the $PATH environment variable
  - CMAKE-related environment variables
  - pkg-config related environment variables

Closes #21921.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-08-19 13:35:44 -05:00
Jack Nagel 8508bdf985 Allow specifying a custom PATH for which method
Closes #21794.
2013-08-10 19:01:50 -05:00
Jack Nagel 26503dacdf Always load net/https before referencing related constants
I put this require inside the method body, because eager-loading
net/https is slow compared to the rest of Homebrew, and utils.rb is
loaded for each `brew` invocation.

It's probably worth breaking up global.rb a bit, to reduce the amount of
code we are loading unnecessarily, but hopefully also to make inter-file
dependencies a bit more obvious.

Fixes #21617.
2013-08-02 18:25:17 -05:00
Jack Nagel 2366174d6f GitHub API access may result in SSL errors
Closes #21216.
2013-07-15 10:57:55 -05:00
Jack Nagel 7c68757e99 Move inreplace off of Object
Closes #21163.
2013-07-12 16:23:06 -05:00
Jack Nagel 39520822cc Respect $VISUAL when picking an editor 2013-07-09 20:12:53 -05:00
Jack Nagel 62848dca6e Give advice when GitHub API requests fail
Refs #21023.
2013-07-05 11:14:52 -05:00
Jack Nagel 08c3fb0ed2 Better behavior for failed connections in brew search
Fixes #20868.
2013-07-01 17:00:08 -05:00
Jack Nagel be38b92d68 Don't use 'obj == nil' 2013-06-26 18:47:00 -05:00
Jack Nagel 79a69b9b46 Extract constant in GitHub module 2013-06-22 22:47:00 -05:00
Jack Nagel 49e06a4669 Extract method in Github module 2013-06-22 22:46:49 -05:00
Jack Nagel 93376954f5 Remove trailing whitespace 2013-06-22 22:46:39 -05:00
Jack Nagel 163067512b Add Utils::JSON to wrap the JSON implementation 2013-06-22 21:34:02 -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 7ce40f75c5 Use implicit begin 2013-05-22 19:58:11 -05:00
Jack Nagel 1f59c45b9d Hoist requires out of methods 2013-05-22 19:53:05 -05:00
Daniel Lee Harple 88d5a5a632 Remove unnecessary rescue-all exception handling
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-05-22 19:53:05 -05:00
Daniel Lee Harple c2f9c5dff7 Added support for a GitHub Personal API Access token
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-05-22 19:53:05 -05:00
Daniel Lee Harple a113ebbfee Check GitHub API rate limit instead of silently failing
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-05-22 19:53:04 -05:00
Daniel Lee Harple 46941be352 Pass a User-Agent when fetching data from the GitHub API
See <http://developer.github.com/v3/#user-agent-required>.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-05-22 19:53:01 -05:00
Jack Nagel d29488ea60 onoe and opoo print to stderr
This may result in some undesired output for things that suppress
stdout, but we'll fix those as we go.

Fixes #18650.
2013-03-31 15:20:12 -05:00
Jack Nagel 6c51a4b455 DRY ohai truncation 2013-03-31 15:18:38 -05:00
Jack Nagel ddbb98413c Turn double modifier into a single conditional 2013-03-21 17:20:57 -05:00
Jack Nagel 9714f5a210 utils: remove obsolete comment 2013-03-21 17:12:56 -05:00
Mike McQuaid bf0a97b79c Add with_system_path to run using system PATHs.
Needed for Linux compatibility.
2013-03-11 18:26:25 +00:00
Jack Nagel 4d341f2115 Don't shadow outer local variables 2013-02-18 12:13:36 -06:00
Samuel John 21617a761b Give a fresh 🍺 after hard work of brew install
- Name of the brewed formula in "Summary" heading.
- At the beginning of the summary line a 🍺  is given out
  (but only on Lion or above). This acts as a nice
  visual marker for the end of a brew-ing process.
- When brewing a dependency, the name is highlighted in green.
- `oh1` is bold, too (like ohai).

Closes #16020.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-11 11:16:11 +00:00
Jack Nagel 82a2fdcd33 Respect BROWSER environment variable 2012-12-27 23:41:44 -06:00
Misty De Meo e935cb12c1 utils: replace shell which with native code
Originally written for tigerbrew, but useful enough for core.
Replaces the shelled-out which in utils.rb with a native-ruby
equivalent, which is moderately faster.

Closes #16659.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-12-27 19:37:21 -04:00
Max Howell 09f83c6273 Only show the troubleshooting link
This has to be a last resort right? If all we show is that link (plus preceding un-deletable output) and they don't click it then maybe we should just close the ticket and hope they'll use MacPorts instead.
2012-10-31 11:28:29 -04:00
Jack Nagel 1c6caaff83 Fix conditional
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-27 16:21:39 -05:00
Max Howell 1fc68c62d8 Clean up and improve build-error output and logs
All logs are now stored from each command executed in Formula.install.

Error output is truncated to five lines in an attempt to not overwhelm the user and to encourage users to read the error output and report the bug properly. Maybe we can get that figure up from 70% to 90%.
2012-09-25 11:31:56 -04:00
Max Howell b1dc03861e Much better CTRL-C handling
Let's not show weird error messages when user interrupts during various stages of brew initialization.

Tested by doing `for x in $(brew search); do brew install $x; done` and pressing CTRL-C at random short intervals.
2012-08-29 12:41:35 -04:00
Dean Smith d2ecfb9e51 Invoke non interactive shell from brew edit
Fixes #12779. Closes #12784.

utils.rb invokes bash as a non interactive shell to run the editor
when you run brew edit.

Non-interactive shells are not intended to capture user input and for running scripts. Whilst the invocation of the editor is a script the actual editor is intended for accept user input so this is an issue with brew and not emacs.

This causes issues with emacs which has different behaviors when not running under an interactive shell.

Signed-off-by: Max Howell <mxcl@me.com>
2012-07-30 13:23:19 -04:00
Charlie Sharpsteen a30f427ae2 quiet_system: Dump to /dev/null instead of closing
Some programs fail where they would otherwise succeed if stdout or stderr is
closed. For example, using mpicc from the mpich2 formula:

    quiet_system 'mpicc', '--version'

Fails with:

    LLVM ERROR: IO failure on output stream.

While

    system 'mpicc', '--version'

Succeeds.

Closes #13253.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-07-09 09:21:33 -08:00
Adam Vandenberg 0c1fa22a9f Extract MacOS module to separate file 2012-06-27 12:09:57 -07:00
Adam Vandenberg aa228d502a Refactor MacOS.
* call `xcode-select` once and cache the result
* reuse functions where appropriate
2012-06-27 12:08:14 -07:00
Adam Vandenberg c54cfa5cb2 remove confusing comments 2012-06-27 11:55:42 -07:00
samueljohn 9c82fc29cd Fix #13012 properly and don't set the SDK if CLT
Undoing parts of the hot fix 78b9e8548e.

The only thing missing was to check for `system "/usr/bin/xcrun -find make 1>/dev/null 2>&1"`
and then it's safe to call locate.

This commit restores the original functionality but without the risk for recursion
and improves the logic of `MacOS.locate`. See below.

To important changes in this commit:

- For Xcode _and_ CLT: don't add the SDK and leave things as before.
So if `MacOS.clt_installed?`, then no `SDKROOT` and `-L` and `-I`
directories are set in `ENV.macosxsdk`.

- Improved the logic for `MacOS.locate` for Xcode-only situations
by assuring that the xcode-select path is correct. This is done
by checking that `bin/make` exists and is executable. Otherwise it
was possible to set xcode-select to an empty dir.
This check is done in `MacOS.sdk_path` too.
We are now able to use Xcode wherever it is and can work even, if
xcode-select is set to invalid values. (Remember some users don't
have sudo access and that is needed to fix xcode-select).

Some minor whitespace fixes.
Minor backtick fix in doctor.rb's printout.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-06-27 11:50:43 -07:00
Misty De Meo 1af6c60cf8 MacOS.sdk_path: silence stderr from xcode-select 2012-06-25 16:48:06 -05:00
Misty De Meo c2373edff2 MacOS.sdk_path: use strip instead of chomp.chomp 2012-06-25 16:00:07 -05:00
Misty De Meo 523641bbf1 MacOS.sdk_path: make sure xcode-select is sane
According to a user on IRC with a brand-new Mac, xcode-select is preconfigured
to /Developer out of the box even though that doesn't exist on modern Xcode.
So we shouldn't trust that it makes any sense.
2012-06-25 15:52:40 -05:00
Misty De Meo 35156ff761 MacOS.sdk_path: chomp harder!
There were two newlines being returned by the command being called in sdk_path,
not just one.
2012-06-25 15:47:45 -05:00
Misty De Meo 78b9e8548e Hotfix for stack overflow
Under certain circumstances, MacOS.locate and MacOS.dev_tools_path would call
each other recursively. This was limited to systems with Xcode minus the CLT.
See #13012.
2012-06-25 15:13:35 -05:00
Misty De Meo 6f646e6eca StandardCompilers: add Xcode 4.3.3 2012-06-25 09:42:05 -05:00