diff options
| author | Tim D. Smith | 2014-10-12 13:45:16 -0700 |
|---|---|---|
| committer | Tim D. Smith | 2014-10-16 20:57:24 -0700 |
| commit | 9a18242be5cb06abc043594dd3581d7b58f0081d (patch) | |
| tree | da63dbedda667a1e08e69bc0be541fc0b49e1d34 /Library/Formula | |
| parent | b94805621d356cdaba6b703d0fa70d8dc3ffcb16 (diff) | |
| download | homebrew-9a18242be5cb06abc043594dd3581d7b58f0081d.tar.bz2 | |
protobuf: complain if dateutil is too new
Closes #33124. Closes #33045. Fixes #32571.
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/protobuf.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Library/Formula/protobuf.rb b/Library/Formula/protobuf.rb index a3e531c1a..9ea2f7651 100644 --- a/Library/Formula/protobuf.rb +++ b/Library/Formula/protobuf.rb @@ -1,5 +1,39 @@ require 'formula' +class OldOrNoDateutilUnlessGoogleApputils < Requirement + # https://github.com/Homebrew/homebrew/issues/32571 + # https://code.google.com/p/google-apputils-python/issues/detail?id=6 + fatal true + + satisfy(:build_env => false) { + if can_import("dateutil") && !can_import("google.apputils") + dateutil_version < Version.new("2.0") + else + true + end + } + + def message; <<-EOS.undent + The protobuf Python bindings depend on the google-apputils Python library, + which requires a version of python-dateutil less than 2.0. + + You have python-dateutil version #{dateutil_version} installed in: + #{Pathname.new(`python -c "import dateutil; print(dateutil.__file__)"`.chomp).dirname} + + Please run: + pip uninstall python-dateutil && pip install "python-dateutil<2" + EOS + end + + def can_import pymodule + quiet_system "python", "-c", "import #{pymodule}" + end + + def dateutil_version + Version.new(`python -c "import dateutil; print(dateutil.__version__)"`.chomp) + end +end + class Protobuf < Formula homepage 'http://code.google.com/p/protobuf/' url 'https://protobuf.googlecode.com/svn/rc/protobuf-2.6.0.tar.bz2', :using => :curl @@ -16,6 +50,7 @@ class Protobuf < Formula option :cxx11 depends_on :python => :optional + depends_on OldOrNoDateutilUnlessGoogleApputils if build.with? "python" fails_with :llvm do build 2334 |
