Method: Autoproj::Python.rewrite_python_shims

Defined in:
lib/autoproj/python.rb

.rewrite_python_shims(python_executable, prefix_dir) ⇒ Object



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/autoproj/python.rb', line 181

def self.rewrite_python_shims(python_executable, prefix_dir)
    shim_path = File.join(prefix_dir, "bin")
    unless File.exist?(shim_path)
        FileUtils.mkdir_p shim_path
        Autoproj.warn "Autoproj::Python.rewrite_python_shims: creating "\
                      "#{shim_path} - "\
                      "are you operating on a valid autoproj workspace?"
    end

    python_path = File.join(shim_path, "python")
    File.open(python_path, "w") do |io|
        io.puts "#! /bin/sh"
        io.puts "exec #{python_executable} \"$@\""
    end
    FileUtils.chmod 0o755, python_path
    python_path
end