Annotation of pkgsrc/lang/python36/patches/patch-setup.py, revision 1.2

1.2     ! jperkin     1: $NetBSD: patch-setup.py,v 1.1 2017/01/01 14:34:27 adam Exp $
1.1       adam        2: 
                      3: Disable modules, so they can be built as separate packages.
                      4: 
                      5: --- setup.py.orig      2016-12-23 02:21:22.000000000 +0000
                      6: +++ setup.py
                      7: @@ -8,6 +8,7 @@ import importlib.util
                      8:  import sysconfig
                      9:  
                     10:  from distutils import log
                     11: +from distutils import text_file
                     12:  from distutils.errors import *
                     13:  from distutils.core import Extension, setup
                     14:  from distutils.command.build_ext import build_ext
                     15: @@ -43,7 +44,8 @@ host_platform = get_platform()
                     16:  COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
                     17:  
                     18:  # This global variable is used to hold the list of modules to be disabled.
                     19: -disabled_module_list = []
1.2     ! jperkin    20: +disabled_module_list = ["_curses", "_curses_panel", "_elementtree",
1.1       adam       21: +"_sqlite3", "_tkinter", "_gdbm", "pyexpat", "readline", "spwd", "xxlimited"]
                     22:  
                     23:  def add_dir_to_list(dirlist, dir):
                     24:      """Add the directory 'dir' to the list 'dirlist' (after any relative
                     25: @@ -487,15 +489,15 @@ class PyBuildExt(build_ext):
                     26:              return ['m']
                     27:  
                     28:      def detect_modules(self):
                     29: -        # Ensure that /usr/local is always used, but the local build
                     30: -        # directories (i.e. '.' and 'Include') must be first.  See issue
                     31: -        # 10520.
                     32: -        if not cross_compiling:
                     33: -            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
                     34: -            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
                     35: -        # only change this for cross builds for 3.3, issues on Mageia
                     36: -        if cross_compiling:
                     37: -            self.add_gcc_paths()
                     38: +        # Add the buildlink directories for pkgsrc
                     39: +        if os.environ.get('BUILDLINK_DIR'):
                     40: +            dir = os.environ['BUILDLINK_DIR']
                     41: +            libdir = dir + '/lib'
                     42: +            incdir = dir + '/include'
                     43: +            if libdir not in self.compiler.library_dirs:
                     44: +                self.compiler.library_dirs.insert(0, libdir)
                     45: +            if incdir not in self.compiler.include_dirs:
                     46: +                self.compiler.include_dirs.insert(0, incdir)
                     47:          self.add_multiarch_paths()
                     48:  
                     49:          # Add paths specified in the environment variables LDFLAGS and
                     50: @@ -811,8 +813,7 @@ class PyBuildExt(build_ext):
                     51:                                 depends = ['socketmodule.h']) )
                     52:          # Detect SSL support for the socket module (via _ssl)
                     53:          search_for_ssl_incs_in = [
                     54: -                              '/usr/local/ssl/include',
                     55: -                              '/usr/contrib/ssl/include/'
                     56: +                              '@SSLBASE@/include'
                     57:                               ]
                     58:          ssl_incs = find_file('openssl/ssl.h', inc_dirs,
                     59:                               search_for_ssl_incs_in
                     60: @@ -823,9 +824,7 @@ class PyBuildExt(build_ext):
                     61:              if krb5_h:
                     62:                  ssl_incs += krb5_h
                     63:          ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
                     64: -                                     ['/usr/local/ssl/lib',
                     65: -                                      '/usr/contrib/ssl/lib/'
                     66: -                                     ] )
                     67: +                                     [] )
                     68:  
                     69:          if (ssl_incs is not None and
                     70:              ssl_libs is not None):
                     71: @@ -844,7 +843,7 @@ class PyBuildExt(build_ext):
                     72:  
                     73:          # look for the openssl version header on the compiler search path.
                     74:          opensslv_h = find_file('openssl/opensslv.h', [],
                     75: -                inc_dirs + search_for_ssl_incs_in)
                     76: +                search_for_ssl_incs_in + inc_dirs)
                     77:          if opensslv_h:
                     78:              name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
                     79:              if host_platform == 'darwin' and is_macosx_sdk_path(name):
                     80: @@ -1241,6 +1240,30 @@ class PyBuildExt(build_ext):
                     81:          dbm_order = ['gdbm']
                     82:          # The standard Unix dbm module:
                     83:          if host_platform not in ['cygwin']:
                     84: +
                     85: +            ## Top half based on find_file
                     86: +            def find_ndbm_h(dirs):
                     87: +                ret = None
                     88: +                if sys.platform == 'darwin':
                     89: +                    sysroot = macosx_sdk_root()
                     90: +                for dir in dirs:
                     91: +                    f = os.path.join(dir, 'ndbm.h')
                     92: +                    if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
                     93: +                        f = os.path.join(sysroot, dir[1:], 'ndbm.h')
                     94: +                    if not os.path.exists(f): continue
                     95: +
                     96: +                    ret = 'True'
                     97: +                    input = text_file.TextFile(f)
                     98: +                    while 1:
                     99: +                        line = input.readline()
                    100: +                        if not line: break
                    101: +                        if re.search('This file is part of GDBM', line):
                    102: +                            ret = None
                    103: +                            break
                    104: +                    input.close()
                    105: +                    break
                    106: +                return ret
                    107: +
                    108:              config_args = [arg.strip("'")
                    109:                             for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
                    110:              dbm_args = [arg for arg in config_args
                    111: @@ -1252,7 +1275,7 @@ class PyBuildExt(build_ext):
                    112:              dbmext = None
                    113:              for cand in dbm_order:
                    114:                  if cand == "ndbm":
                    115: -                    if find_file("ndbm.h", inc_dirs, []) is not None:
                    116: +                    if find_ndbm_h(inc_dirs) is not None:
                    117:                          # Some systems have -lndbm, others have -lgdbm_compat,
                    118:                          # others don't have either
                    119:                          if self.compiler.find_library_file(lib_dirs,
                    120: @@ -2058,10 +2081,7 @@ class PyBuildExt(build_ext):
                    121:              depends = ['_decimal/docstrings.h']
                    122:          else:
                    123:              srcdir = sysconfig.get_config_var('srcdir')
                    124: -            include_dirs = [os.path.abspath(os.path.join(srcdir,
                    125: -                                                         'Modules',
                    126: -                                                         '_decimal',
                    127: -                                                         'libmpdec'))]
                    128: +            include_dirs = ['Modules/_decimal/libmpdec']
                    129:              libraries = []
                    130:              sources = [
                    131:                '_decimal/_decimal.c',
                    132: @@ -2298,7 +2318,7 @@ def main():
                    133:            # If you change the scripts installed here, you also need to
                    134:            # check the PyBuildScripts command above, and change the links
                    135:            # created by the bininstall target in Makefile.pre.in
                    136: -          scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
                    137: +          scripts = ["Tools/scripts/pydoc3",
                    138:                       "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
                    139:          )
                    140:  

CVSweb <webmaster@jp.NetBSD.org>