Adding Python ssl support to Maya 2009 on Windows

The folks over at Insomniac Games were recently met with the challenge of getting Maya 2009 on Windows to be able to talk to their Shotgun server via Shotgun API. Through some trial and error, they solved the issue and seeing that it can be incredibly frustrating to try and find solutions like these on the internetz, they offered up the process to the Shotgun community to hopefully prevent others from hours lost clawing their eyes out trying to solve the issues.

The Problem

Maya 2009 ships with Python v2.5.1 which does not include the SSL module. SSL was added as a standard module to Python in version 2.6. Their Shotgun server runs over https (as most do). So attempts to connect to their Shotgun server using the Shotgun API would fail with the following error:

# Error: 'module' object has no attribute 'ssl'

The Solution

One solution was to open up http access to their server for the API only while leaving https connections for the user interaction in tact. But this isn't ideal and they didn't want to do that. So instead, we focused on trying to solve the problem by downloading, compiling, and installing the ssl module manually. On Windows this can be a tricky process.

The Process

As a general rule, I used the instructions here: http://malei39.blogspot.com/2010/02/install-ssl-module-for-pyhon-254.htmlThere was a long list of “gotchas” along the way. A lot of these, however, were the product of my unfamiliarity with both Linux and Python.

Build OpenSSL and libgw32c

  1. Download OpenSSL (http://gnuwin32.sourceforge.net/packages/openssl.htm) and libgw32c (http://gnuwin32.sourceforge.net/packages/libgw32c.htm) sources.
  2. Build openssl using the instructions found in openssl\0.9.8h\openssl-0.9.8g\INSTALL.W32.
    * Note that before running ‘nmake –f ms\ntdll.mak’ I had to run ‘vcvars’ from a command-line. This batch file setups up environment variables for the VS tools.
  3. Copy the libs and dlls to the appropriate folders.

Build Python SSL

  1. Download and install Python 2.5.4 (http://www.python.org/getit/releases/2.5.4/).
  2. Install MinGW (http://www.mingw.org/) full to get compilers. 
  3. Add the MinGW bin to your path.
  4. Point Python25 at the mingw32 compiler.
  5. Download and install Python SSL 1.15 (http://pypi.python.org/pypi/ssl).
  6. Before doing anything, edit <PYTHON>\lib\distutils\cygwincompiler.py and remove the ‘-mno-cygwin’ compiler flag.
  7. At this point, you should be able to go through the 3 steps in the “Let build it” section on the web page above:
  8. Go to directory you have extracted the source code
  9. To build the only, run command python setup.py build
  10. To build and install, run command python setup.py install
  11. To build the installer, run command python setup.py bdist_wininst

Install Python SSL

  1. Download and install Python setuptools 0.6c11. This is required so you can use easy_install on ssl.
  2. ‘easy_install ssl’. If things are configured correctly, this should install SSL to Python.

I ended up adding the ssl files to the shotgun_api3 distro so we could easily deploy it to users on the team.

댓글 0개

댓글을 남기려면 로그인하세요.