Module: RubyPython::Python

Extended by:
FFI::Library
Defined in:
lib/rubypython/python.rb,
lib/rubypython/python.rb

Overview

This module provides access to the Python C API functions via the Ruby ffi gem. Documentation for these functions may be found [here](docs.python.org/c-api/). Likewise the FFI gem documentation may be found [here](rdoc.info/projects/ffi/ffi).

Defined Under Namespace

Classes: DummyStruct, PyMethodDef, PyObjectStruct

Constant Summary collapse

PYTHON_EXE =
RubyPython.options[:python_exe] || 'python'
PYTHON_VERSION =

This much we can assume works without anything special at all.

Open3.popen3("#{PYTHON_EXE} --version") { |i,o,e| e.read }.chomp.split[1].to_f
PYTHON_NAME =
"python#{PYTHON_VERSION}"
LIB_NAME =
"#{FFI::Platform::LIBPREFIX}#{PYTHON_NAME}"
LIB_EXT =
FFI::Platform::LIBSUFFIX
PYTHON_SYS_PREFIX =
%x{#{PYTHON_NAME} -c "import sys; print(sys.prefix)"}.chomp
METH_VARARGS =

Function Constants

1