Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 268887 | Differences between
and this patch

Collapse All | Expand All

(-)setup.py.orig (-41 / +58 lines)
Lines 333-341 Link Here
333
333
334
    def detect_modules(self):
334
    def detect_modules(self):
335
        global disable_ssl
335
        global disable_ssl
336
337
	# We must respect the user specified sysroot!
338
	sysroot=os.getenv('SYSROOT')
339
	if sysroot is None:
340
		sysroot=''
341
	
336
        # Ensure that /usr/local is always used
342
        # Ensure that /usr/local is always used
337
        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
343
        add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/local/lib')
338
        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
344
        add_dir_to_list(self.compiler.include_dirs, sysroot+'/usr/local/include')
339
345
340
        # Add paths specified in the environment variables LDFLAGS and
346
        # Add paths specified in the environment variables LDFLAGS and
341
        # CPPFLAGS for header and library files.
347
        # CPPFLAGS for header and library files.
Lines 371-382 Link Here
371
                    for directory in reversed(options.dirs):
377
                    for directory in reversed(options.dirs):
372
                        add_dir_to_list(dir_list, directory)
378
                        add_dir_to_list(dir_list, directory)
373
379
374
        if os.path.normpath(sys.prefix) != '/usr':
380
        if os.path.normpath(sys.prefix) != '/usr/local':
375
            add_dir_to_list(self.compiler.library_dirs,
381
            add_dir_to_list(self.compiler.library_dirs,
376
                            sysconfig.get_config_var("LIBDIR"))
382
                            sysconfig.get_config_var("LIBDIR"))
377
            add_dir_to_list(self.compiler.include_dirs,
383
            add_dir_to_list(self.compiler.include_dirs,
378
                            sysconfig.get_config_var("INCLUDEDIR"))
384
                            sysconfig.get_config_var("INCLUDEDIR"))
379
385
386
	# We should always look into sysroot/usr/include and consider
387
	# also the lib dirs there for searching for files
388
	add_dir_to_list(self.compiler.include_dirs, sysroot+'/usr/include')
389
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/lib')
390
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/lib64')
391
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/lib')
392
	add_dir_to_list(self.compiler.library_dirs, sysroot+'/usr/lib64')
393
380
        try:
394
        try:
381
            have_unicode = unicode
395
            have_unicode = unicode
382
        except NameError:
396
        except NameError:
Lines 385-395 Link Here
385
        # lib_dirs and inc_dirs are used to search for files;
399
        # lib_dirs and inc_dirs are used to search for files;
386
        # if a file is found in one of those directories, it can
400
        # if a file is found in one of those directories, it can
387
        # be assumed that no additional -I,-L directives are needed.
401
        # be assumed that no additional -I,-L directives are needed.
388
        lib_dirs = self.compiler.library_dirs + [
402
        lib_dirs = self.compiler.library_dirs
389
            '/lib64', '/usr/lib64',
403
        inc_dirs = self.compiler.include_dirs
390
            '/lib', '/usr/lib',
391
            ]
392
        inc_dirs = self.compiler.include_dirs + ['/usr/include']
393
        exts = []
404
        exts = []
394
        missing = []
405
        missing = []
395
406
Lines 608-618 Link Here
608
            elif self.compiler.find_library_file(lib_dirs, 'curses'):
619
            elif self.compiler.find_library_file(lib_dirs, 'curses'):
609
                readline_libs.append('curses')
620
                readline_libs.append('curses')
610
            elif self.compiler.find_library_file(lib_dirs +
621
            elif self.compiler.find_library_file(lib_dirs +
611
                                               ['/usr/@@GENTOO_LIBDIR@@/termcap'],
622
                                               [sysroot+'/usr/@@GENTOO_LIBDIR@@/termcap'],
612
                                               'termcap'):
623
                                               'termcap'):
613
                readline_libs.append('termcap')
624
                readline_libs.append('termcap')
614
            exts.append( Extension('readline', ['readline.c'],
625
            exts.append( Extension('readline', ['readline.c'],
615
                                   library_dirs=['/usr/@@GENTOO_LIBDIR@@/termcap'],
626
                                   library_dirs=[sysroot+'/usr/@@GENTOO_LIBDIR@@/termcap'],
616
                                   extra_link_args=readline_extra_link_args,
627
                                   extra_link_args=readline_extra_link_args,
617
                                   libraries=readline_libs) )
628
                                   libraries=readline_libs) )
618
        else:
629
        else:
Lines 637-656 Link Here
637
                               depends = ['socketmodule.h']) )
648
                               depends = ['socketmodule.h']) )
638
        # Detect SSL support for the socket module (via _ssl)
649
        # Detect SSL support for the socket module (via _ssl)
639
        search_for_ssl_incs_in = [
650
        search_for_ssl_incs_in = [
640
                              '/usr/local/ssl/include',
651
                              sysroot+'/usr/local/ssl/include',
641
                              '/usr/contrib/ssl/include/'
652
                              sysroot+'/usr/contrib/ssl/include/'
642
                             ]
653
                             ]
643
        ssl_incs = find_file('openssl/ssl.h', inc_dirs,
654
        ssl_incs = find_file('openssl/ssl.h', inc_dirs,
644
                             search_for_ssl_incs_in
655
                             search_for_ssl_incs_in
645
                             )
656
                             )
646
        if ssl_incs is not None and not disable_ssl:
657
        if ssl_incs is not None and not disable_ssl:
647
            krb5_h = find_file('krb5.h', inc_dirs,
658
            krb5_h = find_file('krb5.h', inc_dirs,
648
                               ['/usr/kerberos/include'])
659
                               [sysroot+'/usr/kerberos/include'])
649
            if krb5_h:
660
            if krb5_h:
650
                ssl_incs += krb5_h
661
                ssl_incs += krb5_h
651
        ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
662
        ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
652
                                     ['/usr/local/ssl/lib',
663
                                     [sysroot+'/usr/local/ssl/lib',
653
                                      '/usr/contrib/ssl/lib/'
664
                                      sysroot+'/usr/contrib/ssl/lib/'
654
                                     ] )
665
                                     ] )
655
666
656
        if (ssl_incs is not None and
667
        if (ssl_incs is not None and
Lines 753-758 Link Here
753
                    return False
764
                    return False
754
            return True
765
            return True
755
766
767
756
        def gen_db_minor_ver_nums(major):
768
        def gen_db_minor_ver_nums(major):
757
            if major == 4:
769
            if major == 4:
758
                for x in range(max_db_ver[1]+1):
770
                for x in range(max_db_ver[1]+1):
Lines 768-788 Link Here
768
        # construct a list of paths to look for the header file in on
780
        # construct a list of paths to look for the header file in on
769
        # top of the normal inc_dirs.
781
        # top of the normal inc_dirs.
770
        db_inc_paths = [
782
        db_inc_paths = [
771
            '/usr/include/db4',
783
            sysroot+'/usr/include/db4',
772
        ]
784
        ]
773
        # 4.x minor number specific paths
785
        # 4.x minor number specific paths
774
        for x in gen_db_minor_ver_nums(4):
786
        for x in gen_db_minor_ver_nums(4):
775
            db_inc_paths.append('/usr/include/db4%d' % x)
787
            db_inc_paths.append(sysroot+'/usr/include/db4%d' % x)
776
            db_inc_paths.append('/usr/include/db4.%d' % x)
788
            db_inc_paths.append(sysroot+'/usr/include/db4.%d' % x)
777
            db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x)
789
            db_inc_paths.append(sysroot+'/usr/local/BerkeleyDB.4.%d/include' % x)
778
            db_inc_paths.append('/usr/local/include/db4%d' % x)
790
            db_inc_paths.append(sysroot+'/usr/local/include/db4%d' % x)
779
            db_inc_paths.append('/pkg/db-4.%d/include' % x)
791
            db_inc_paths.append(sysroot+'/pkg/db-4.%d/include' % x)
780
            db_inc_paths.append('/opt/db-4.%d/include' % x)
792
            db_inc_paths.append(sysroot+'/opt/db-4.%d/include' % x)
781
            # MacPorts default (http://www.macports.org/)
793
            # MacPorts default (http://www.macports.org/)
782
            db_inc_paths.append('/opt/local/include/db4%d' % x)
794
            db_inc_paths.append('/opt/local/include/db4%d' % x)
783
        # 3.x minor number specific paths
795
        # 3.x minor number specific paths
784
        for x in gen_db_minor_ver_nums(3):
796
        for x in gen_db_minor_ver_nums(3):
785
            db_inc_paths.append('/usr/include/db3%d' % x)
797
            db_inc_paths.append('sysroot+/usr/include/db3%d' % x)
786
798
787
        # Add some common subdirectories for Sleepycat DB to the list,
799
        # Add some common subdirectories for Sleepycat DB to the list,
788
        # based on the standard include directories. This way DB3/4 gets
800
        # based on the standard include directories. This way DB3/4 gets
Lines 904-915 Link Here
904
        # We hunt for #define SQLITE_VERSION "n.n.n"
916
        # We hunt for #define SQLITE_VERSION "n.n.n"
905
        # We need to find >= sqlite version 3.0.8
917
        # We need to find >= sqlite version 3.0.8
906
        sqlite_incdir = sqlite_libdir = None
918
        sqlite_incdir = sqlite_libdir = None
907
        sqlite_inc_paths = [ '/usr/include',
919
        sqlite_inc_paths = [ sysroot+'/usr/include',
908
                             '/usr/include/sqlite',
920
                             sysroot+'/usr/include/sqlite',
909
                             '/usr/include/sqlite3',
921
                             sysroot+'/usr/include/sqlite3',
910
                             '/usr/local/include',
922
                             sysroot+'/usr/local/include',
911
                             '/usr/local/include/sqlite',
923
                             sysroot+'/usr/local/include/sqlite',
912
                             '/usr/local/include/sqlite3',
924
                             sysroot+'/usr/local/include/sqlite3',
913
                           ]
925
                           ]
914
        MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
926
        MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
915
        MIN_SQLITE_VERSION = ".".join([str(x)
927
        MIN_SQLITE_VERSION = ".".join([str(x)
Lines 1004-1010 Link Here
1004
        # we do not build this one.  Otherwise this build will pick up
1016
        # we do not build this one.  Otherwise this build will pick up
1005
        # the more recent berkeleydb's db.h file first in the include path
1017
        # the more recent berkeleydb's db.h file first in the include path
1006
        # when attempting to compile and it will fail.
1018
        # when attempting to compile and it will fail.
1007
        f = "/usr/include/db.h"
1019
        f = sysroot+"/usr/include/db.h"
1008
        if os.path.exists(f) and not db_incs:
1020
        if os.path.exists(f) and not db_incs:
1009
            data = open(f).read()
1021
            data = open(f).read()
1010
            m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
1022
            m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
Lines 1207-1213 Link Here
1207
        # More information on Expat can be found at www.libexpat.org.
1219
        # More information on Expat can be found at www.libexpat.org.
1208
        #
1220
        #
1209
        # Use system expat
1221
        # Use system expat
1210
        expatinc = '/usr/include'
1222
        expatinc = sysroot+'/usr/include'
1211
        define_macros = []
1223
        define_macros = []
1212
1224
1213
        exts.append(Extension('pyexpat',
1225
        exts.append(Extension('pyexpat',
Lines 1493-1499 Link Here
1493
        # For 8.4a2, the X11 headers are not included. Rather than include a
1505
        # For 8.4a2, the X11 headers are not included. Rather than include a
1494
        # complicated search, this is a hard-coded path. It could bail out
1506
        # complicated search, this is a hard-coded path. It could bail out
1495
        # if X11 libs are not found...
1507
        # if X11 libs are not found...
1496
        include_dirs.append('/usr/X11R6/include')
1508
        include_dirs.append(sysroot+'/usr/X11R6/include')
1497
        frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
1509
        frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
1498
1510
1499
        # All existing framework builds of Tcl/Tk don't support 64-bit
1511
        # All existing framework builds of Tcl/Tk don't support 64-bit
Lines 1528-1533 Link Here
1528
    def detect_tkinter(self, inc_dirs, lib_dirs):
1540
    def detect_tkinter(self, inc_dirs, lib_dirs):
1529
        # The _tkinter module.
1541
        # The _tkinter module.
1530
1542
1543
	# We must respect the user specified sysroot!
1544
	sysroot=os.getenv('SYSROOT')
1545
	if sysroot is None:
1546
		sysroot=''
1547
	
1531
        # Rather than complicate the code below, detecting and building
1548
        # Rather than complicate the code below, detecting and building
1532
        # AquaTk is a separate method. Only one Tkinter will be built on
1549
        # AquaTk is a separate method. Only one Tkinter will be built on
1533
        # Darwin - either AquaTk, if it is found, or X11 based Tk.
1550
        # Darwin - either AquaTk, if it is found, or X11 based Tk.
Lines 1582-1598 Link Here
1582
        if platform == 'sunos5':
1599
        if platform == 'sunos5':
1583
            include_dirs.append('/usr/openwin/include')
1600
            include_dirs.append('/usr/openwin/include')
1584
            added_lib_dirs.append('/usr/openwin/lib')
1601
            added_lib_dirs.append('/usr/openwin/lib')
1585
        elif os.path.exists('/usr/X11R6/include'):
1602
        elif os.path.exists(sysroot+'/usr/X11R6/include'):
1586
            include_dirs.append('/usr/X11R6/include')
1603
            include_dirs.append(sysroot+'/usr/X11R6/include')
1587
            added_lib_dirs.append('/usr/X11R6/lib64')
1604
            added_lib_dirs.append(sysroot+'/usr/X11R6/lib64')
1588
            added_lib_dirs.append('/usr/X11R6/lib')
1605
            added_lib_dirs.append(sysroot+'/usr/X11R6/lib')
1589
        elif os.path.exists('/usr/X11R5/include'):
1606
        elif os.path.exists(sysroot+'/usr/X11R5/include'):
1590
            include_dirs.append('/usr/X11R5/include')
1607
            include_dirs.append(sysroot+'/usr/X11R5/include')
1591
            added_lib_dirs.append('/usr/X11R5/lib')
1608
            added_lib_dirs.append(sysroot+'/usr/X11R5/lib')
1592
        else:
1609
        else:
1593
            # Assume default location for X11
1610
            # Assume default location for X11
1594
            include_dirs.append('/usr/X11/include')
1611
            include_dirs.append(sysroot+'/usr/X11/include')
1595
            added_lib_dirs.append('/usr/X11/lib')
1612
            added_lib_dirs.append(sysroot+'/usr/X11/lib')
1596
1613
1597
        # If Cygwin, then verify that X is installed before proceeding
1614
        # If Cygwin, then verify that X is installed before proceeding
1598
        if platform == 'cygwin':
1615
        if platform == 'cygwin':

Return to bug 268887