Permalink
Browse files

Adding basic support for the Windows install of Python.

  • Loading branch information...
bendoerr committed Aug 21, 2011
1 parent 9643df6 commit 1349aea1c6faa459c4be8474e4a7e878f08459c2
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/rubypython/pythonexec.rb
@@ -71,6 +71,19 @@ def find_python_lib
locations << File.join(path, "#{base}.dll") # Windows
locations << File.join(path, "#{base}.a") # Non-DLL
end
+
+ if FFI::Platform.windows?
+ # Do this after trying to add alternative extensions,
+ # since windows install has a python27.a and can cause
+ # troble. FFI fails at guessing pythons directory and libs.
+ # Find the windows lib by looking in the libs directory
+ # where the python exe is located.
+ path = File.dirname(@python)
+ # Windows Python doesn't like ' with inner " so we have to switch it around.
+ winversion = %x(#{@python} -c "import sys; print '%d%d' % sys.version_info[:2]").chomp
+ locations << File.join(path, "python#{winversion}.dll")
+ locations << File.join(path, "libs", "python#{winversion}.dll")
+ end
# Remove redundant locations
locations.uniq!

0 comments on commit 1349aea

Please sign in to comment.