Skip to content

Commit

Permalink
allow overriding python location during builds using .buckconfig or .…
Browse files Browse the repository at this point in the history
…buckconfig.local (only applies to Windows)
  • Loading branch information
titusfortner committed Jun 28, 2018
1 parent b605d9a commit 0aa8dd4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rake-tasks/buck.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'inifile'
require 'open3'
require 'rake-tasks/checks'

Expand Down Expand Up @@ -46,7 +47,15 @@ def self.download
org.apache.http.util.EntityUtils.consume(entity) unless entity.nil?

File.chmod(0755, out)
cmd = (windows?) ? ["python", out] : [out]

cmd = if windows?
buckconfigs = [IniFile.load('.buckconfig.local'), IniFile.load('.buckconfig')]
python_interpreter = buckconfigs.lazy.map { |c| c && c['parser']['python_interpreter'] }.find(&:itself)
[python_interpreter || "python", out]
else
[out]
end

sh cmd.join(" ") + " kill", :verbose => true
cmd
)
Expand Down

1 comment on commit 0aa8dd4

@titusfortner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shs96c here's the feature you requested. @p0deje helped me get inifile gem added into our custom jruby (thanks)

Please sign in to comment.