Tuesday, July 3, 2007

PyOpenSSL installation

although PyOpenSSL install file mentioned the windows modules installation, it assumed that Visual Studio 2003 has been installed. in reality, we do not have VS 2003 installed, sometime we also does not Cygwin installed, does it mean that we can not install pyOpenSSL? the answer is obvious No. It will take a while to find out the why, since there is not such answer on the web.
first step: get packages ( my python version is 2.5)
download pyOpenSSL-0.6
install windows OpenSSL, default folder is c:\OpenSSL
second step: build ( I found the following content is very useful for the issue (http://webcleaner.sourceforge.net/install.html)
Change to the directory where you installed the Win32OpenSSL software into (for example c:\OpenSSL). Now fix the library names for the mingw compiler: c:\OpenSSL> cd lib\MinGW && move ssleay32.a libssleay32.a && move ssleay32.def libssleay32.def
  • Extract pyOpenSSL-0.6.tar.gz and change into the generated directory (for example c:\pyOpenSSL-0.6). Open a text editor for setup.py and replace 'libeay32' with 'eay32'.

  • Then run: c:\pyOpenSSL-0.6> python setup.py build_ext -c mingw32 -I c:\OpenSSL\include -L c:\OpenSSL\lib\MinGW

  • last step: install ( if you do not skil-build, since -c mingw32 will not pass from install to build, the installation will failure regardless whether build success or not)
    C:\projects\Python\pyOpenSSL-0.6\pyOpenSSL-0.6>python setup.py build -c mingw32
    running build
    running build_py
    running build_ext
    C:\projects\Python\pyOpenSSL-0.6\pyOpenSSL-0.6>python setup.py install --skip-build
    running install
    running install_lib
    creating c:\python25\Lib\site-packages\OpenSSL
    copying build\lib.win32-2.5\OpenSSL\crypto.pyd -> c:\python25\Lib\site-packages\
    OpenSSL
    copying build\lib.win32-2.5\OpenSSL\rand.pyd -> c:\python25\Lib\site-packages\Op
    enSSL
    copying build\lib.win32-2.5\OpenSSL\SSL.pyd -> c:\python25\Lib\site-packages\Ope
    nSSL
    copying build\lib.win32-2.5\OpenSSL\tsafe.py -> c:\python25\Lib\site-packages\Op
    enSSL
    copying build\lib.win32-2.5\OpenSSL\version.py -> c:\python25\Lib\site-packages\
    OpenSSL
    copying build\lib.win32-2.5\OpenSSL\__init__.py -> c:\python25\Lib\site-packages
    \OpenSSL
    byte-compiling c:\python25\Lib\site-packages\OpenSSL\tsafe.py to tsafe.pyc
    byte-compiling c:\python25\Lib\site-packages\OpenSSL\version.py to version.pyc
    byte-compiling c:\python25\Lib\site-packages\OpenSSL\__init__.py to __init__.pyc
    running install_egg_info
    Writing c:\python25\Lib\site-packages\pyOpenSSL-0.6-py2.5.egg-info
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import OpenSSL
    >>>

    No comments: