lib/rubypython/interpreter.rb in rubypython-0.6.2 vs lib/rubypython/interpreter.rb in rubypython-0.6.3

- old
+ new

@@ -38,10 +38,18 @@ # run. def initialize(options = {}) @python_exe = options[:python_exe] # Windows: 'C:\\Python27\python.exe' # Mac OS X: '/usr/bin/ + + # The default interpreter might be python3 on some systems + rc, majorversion = runpy "import sys; print(sys.version_info[0])" + if majorversion == "3" + warn "The python interpreter is python 3, switching to python2" + @python_exe = "python2" + end + rc, @python = runpy "import sys; print sys.executable" if rc.exitstatus.nonzero? raise RubyPython::InvalidInterpreter, "An invalid interpreter was specified." end rc, @version = runpy "import sys; print '%d.%d' % sys.version_info[:2]" @@ -56,12 +64,13 @@ else @version_name = "#{basename}#{flat_version}" end else basename = File.basename(@python) - if basename =~ /#{@version}/ @version_name = basename + elsif basename.end_with?("2") + @version_name = "#{basename[0..-2]}#{@version}" else @version_name = "#{basename}#{@version}" end end