[Python-checkins] r81674 - in python/branches/release26-maint: Lib/distutils/unixccompiler.py setup.py

M.-A. Lemburg mal at egenix.com
Fri Jun 4 10:58:09 CEST 2010


ronald.oussoren wrote:
> Author: ronald.oussoren
> Date: Thu Jun  3 16:59:56 2010
> New Revision: 81674
> 
> Log:
> Merged revisions 81662 via svnmerge from 
> svn+ssh://pythondev@svn.python.org/python/trunk
> 
> ........
>   r81662 | ronald.oussoren | 2010-06-03 11:47:21 +0200 (Thu, 03 Jun 2010) | 9 lines
>   
>   Fix for issue #7724: ensure that distutils and python's own setup.py
>   honor the MacOSX SDK when one is specified.
>   
>   This is needed to be able to build using the 10.4u SDK while running
>   on OSX 10.6.
>   
>   This is a fixed version of the patch in r80963, I've tested this patch
>   on OSX and Linux.

Overall, I don't particularly like this patch. It adds way too
many special cases just for the MacOSX SDK setup. Isn't there
some more elegant way to update the search paths if an
SDK is present - one that doesn't require this long tail
of "if sys.platform == 'darwin':..." all over setup.py ?

BTW, this part still doesn't look right:

> @@ -647,24 +692,24 @@
>          openssl_ver = 0
>          openssl_ver_re = re.compile(
>              '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' )
> -        for ssl_inc_dir in inc_dirs + search_for_ssl_incs_in:
> -            name = os.path.join(ssl_inc_dir, 'openssl', 'opensslv.h')
> -            if os.path.isfile(name):
> -                try:
> -                    incfile = open(name, 'r')
> -                    for line in incfile:
> -                        m = openssl_ver_re.match(line)
> -                        if m:
> -                            openssl_ver = eval(m.group(1))
> -                            break
> -                except IOError:
> -                    pass
>  
> -            # first version found is what we'll use (as the compiler should)
> -            if openssl_ver:
> -                break
> +        # look for the openssl version header on the compiler search path.
> +        opensslv_h = find_file('openssl/opensslv.h', [],

You should use os.path.join() for this rather than a
verbatim '/'.

> +                inc_dirs + search_for_ssl_incs_in)
> +        if opensslv_h:
> +            name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
> +            if sys.platform == 'darwin' and is_macosx_sdk_path(name):
> +                name = os.path.join(macosx_sdk_root(), name[1:])
> +            try:
> +                incfile = open(name, 'r')
> +                for line in incfile:
> +                    m = openssl_ver_re.match(line)
> +                    if m:
> +                        openssl_ver = eval(m.group(1))
> +            except IOError, msg:
> +                print "IOError while reading opensshv.h:", msg
> +                pass

Note that the new code doesn't search all available opensslv.h
header files for a matching case. It only looks at the first
found and if that doesn't match, it fails.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 04 2010)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2010-07-19: EuroPython 2010, Birmingham, UK                44 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-checkins mailing list