[Pythonmac-SIG] Another build question: ssl?

Russell E Owen owen@astro.washington.edu
Wed, 20 Nov 2002 08:53:39 -0800


>On Tuesday, Nov 19, 2002, at 23:20 Europe/Amsterdam, Russell E Owen wrote:
>
>>Anybody know how to build Python for MacOS X with socket.ssl 
>>support? Ideally I'd like to compile the framework build of Python 
>>2.2.2 under MacOS X 10.2. The default way of doing it (as 
>>documented in /Mac/OSX/README) works but doesn't seem to include 
>>ssl support. If that's not reasonable, then I am willing to go with 
>>the normal unix build instead.
>
>Ssl support is automatic is ssl is located in either /usr/local/ssl 
>or /usr/contrib/ssl. If it is elsewhere: edit setup.py in the main 
>python source folder, and look at the lines where ssl_incs and 
>ssl_libs are set and add the place where you've installed ssl.
>
>This should enable ssl support for both framework and static builds.

Further research (sorry I posted first before doing it) reveals that 
the libraries are where setup.py is looking for them:

setup.py contains:
         lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib']
         inc_dirs = self.compiler.include_dirs + ['/usr/include']
...
	ssl_incs = find_file('openssl/ssl.h', inc_dirs,...
         ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,...

and doing a search, I found these files on my disk:

/usr/include/openssl/ssl.h
/usr/lib/libssl.dylib

Any idea? I assume find_library_file should have found 
"libssl.dylib"? I'm pretty sure my build does not have ssl, based on:

% python
Python 2.2.2 (#2, Nov  8 2002, 10:18:03)
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  import socket
>>>  a = socket.socket()
>>>  b = socket.ssl()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'ssl'
>>>  dir(socket)  # and eliding things in all caps:
['SocketType', '__all__', '__builtins__', '__doc__', '__file__', 
'__name__', '_fileobject', '_socket', '_socketmethods', 
'_socketobject', 'error', 'fromfd', 'gaierror', 'getaddrinfo', 
'getfqdn', 'gethostbyaddr', 'gethostbyname', 'gethostbyname_ex', 
'gethostname', 'getnameinfo', 'getprotobyname', 'getservbyname', 
'herror', 'htonl', 'htons', 'inet_aton', 'inet_ntoa', 'ntohl', 
'ntohs', 'socket']
>>>