how to compile https support into Python2.0

Dustin Boswell boswell at caltech.edu
Thu Feb 15 18:47:07 EST 2001


I originally posted a question asking how to get Python to support
urls like https://secure-server.com so you could use urllib.urlopen()
transparently.

After a bunch of searching on the web, here's what I did (on Redhat 6.2)

to get the Python Distribution to compile correctly with SSL...

(If it doesn't work, or there's an easier/better way, please correct
me.)

OPENSSL
This is a package that you need to have installed before you
can build the Python source distribution (in the SSL way).

1) go to http://www.openssl.org/source/
 and download openssl-0.9.6.tar.gz
2) gunzip openssl-0.9.6.tar.gz
3) tar -xvf openssl-0.9.6.tar (make sure you are in the
directory you want to put the source in; this can be in
any temporary place, since the build will automatically
place it in the right spot later)
4) cd openssl-0.9.6
5) read the INSTALL file and...
6) ./config ; make ; make test ; make install
7) if that didn't work, I can't help you

This should have installed files into a /usr/local/ssl
directory (along with various others)


PYTHON
Here's where and how to build a Python interpreter..

1) Go to http://www.python.org/2.0/#download
   and download BeOpen-Python-2.0.tar.gz
2) gunzip BeOpen-Python-2.0.tar.gz
3) tar -xvf BeOpen-Python-2.0.tar ( same deal as step 3 above )
4) goto
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/python/dist/src/?cvsroot=python#dirlist

        and make sure you have fresh copies of:
        - Modules/socketmodule.c
        - Lib/urllib.py
        - Lib/httplib.py
        - (possilby others, although I didn't, and haven't (yet) run
        into problems
5) in Python-2.0/Modules/ do:
     cp Setup.in Setup
6) emacs (or, gulp, vi if you prefer) Setup
7) uncomment the four lines so that it looks like:
# Socket module compiled with SSL support; you must edit the SSL
variable:
SSL=/usr/local/ssl
_socket socketmodule.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

8) in the top directory ( Python-2.0/ ) do ...
        ./configure ; make ; make test (took a while) ; make install


Dustin Boswell
boswell at caltech.edu




More information about the Python-list mailing list