diff options
Diffstat (limited to 'Formula')
-rw-r--r-- | Formula/autodock-vina.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Formula/autodock-vina.rb b/Formula/autodock-vina.rb index 078b16c..4725e94 100644 --- a/Formula/autodock-vina.rb +++ b/Formula/autodock-vina.rb @@ -5,9 +5,23 @@ class AutodockVina < Formula sha256 "38aec306bff0e47522ca8f581095ace9303ae98f6a64031495a9ff1e4b2ff712" license "Apache-2.0" + option "with-python-bindings", "Build with python bindings" + depends_on "swig" => :build depends_on "boost" + depends_on "numpy" => :optional if build.with? "python-bindings" + depends_on "python" => :optional if build.with? "python-bindings" + depends_on "python-setuptools" => :optional if build.with? "python-bindings" + depends_on "python@3.11" => :optional if build.with? "python-bindings" + depends_on "python@3.12" => :optional if build.with? "python-bindings" + + def pythons + deps.map(&:to_formula) + .select { |f| f.name.start_with?("python@") } + .sort_by(&:version) + end + def install if OS.mac? cd "build/mac/release" do @@ -34,6 +48,21 @@ class AutodockVina < Formula bin.install "vina_split" end end + + if build.with? "python-bindings" + cd "build/python" do + inreplace "setup.py" do |s| + s.gsub! "self.boost_include_dir, self.boost_library_dir = locate_boost()", "self.boost_include_dir, \ + self.boost_library_dir = \"#{HOMEBREW_PREFIX}/include\", \"#{HOMEBREW_PREFIX}/lib\"" + s.gsub! "/usr/local/include", "#{HOMEBREW_PREFIX}/include" + end + pythons.each do |python| + python3 = python.opt_libexec/"bin/python" + ENV.append "CFLAGS", "-DBOOST_TIMER_ENABLE_DEPRECATED" + system python3, "-m", "pip", "install", *std_pip_args(build_isolation: true), "." + end + end + end end test do |