Annotation of pkgsrc/lang/python37/patches/patch-setup.py, revision 1.1

1.1     ! adam        1: $NetBSD$
        !             2: 
        !             3: Disable certain modules, so they can be built as separate packages.
        !             4: Do not look for ncursesw.
        !             5: Assume panel_library is correct; this is a fix for ncurses' gnupanel
        !             6:   which will get transformed to panel in buildlink.
        !             7: Also look for uuid/uuid.h.
        !             8: 
        !             9: --- setup.py.orig      2018-05-02 07:41:45.000000000 +0000
        !            10: +++ setup.py
        !            11: @@ -8,6 +8,7 @@ import importlib.util
        !            12:  import sysconfig
        !            13:  
        !            14:  from distutils import log
        !            15: +from distutils import text_file
        !            16:  from distutils.errors import *
        !            17:  from distutils.core import Extension, setup
        !            18:  from distutils.command.build_ext import build_ext
        !            19: @@ -43,7 +44,7 @@ host_platform = get_platform()
        !            20:  COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
        !            21:  
        !            22:  # This global variable is used to hold the list of modules to be disabled.
        !            23: -disabled_module_list = []
        !            24: +disabled_module_list = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
        !            25:  
        !            26:  def add_dir_to_list(dirlist, dir):
        !            27:      """Add the directory 'dir' to the list 'dirlist' (after any relative
        !            28: @@ -537,15 +538,15 @@ class PyBuildExt(build_ext):
        !            29:              os.unlink(tmpfile)
        !            30:  
        !            31:      def detect_modules(self):
        !            32: -        # Ensure that /usr/local is always used, but the local build
        !            33: -        # directories (i.e. '.' and 'Include') must be first.  See issue
        !            34: -        # 10520.
        !            35: -        if not cross_compiling:
        !            36: -            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
        !            37: -            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
        !            38: -        # only change this for cross builds for 3.3, issues on Mageia
        !            39: -        if cross_compiling:
        !            40: -            self.add_gcc_paths()
        !            41: +        # Add the buildlink directories for pkgsrc
        !            42: +        if os.environ.get('BUILDLINK_DIR'):
        !            43: +            dir = os.environ['BUILDLINK_DIR']
        !            44: +            libdir = dir + '/lib'
        !            45: +            incdir = dir + '/include'
        !            46: +            if libdir not in self.compiler.library_dirs:
        !            47: +                self.compiler.library_dirs.insert(0, libdir)
        !            48: +            if incdir not in self.compiler.include_dirs:
        !            49: +                self.compiler.include_dirs.insert(0, incdir)
        !            50:          self.add_multiarch_paths()
        !            51:  
        !            52:          # Add paths specified in the environment variables LDFLAGS and
        !            53: @@ -814,8 +815,6 @@ class PyBuildExt(build_ext):
        !            54:          # use the same library for the readline and curses modules.
        !            55:          if 'curses' in readline_termcap_library:
        !            56:              curses_library = readline_termcap_library
        !            57: -        elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
        !            58: -            curses_library = 'ncursesw'
        !            59:          elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
        !            60:              curses_library = 'ncurses'
        !            61:          elif self.compiler.find_library_file(lib_dirs, 'curses'):
        !            62: @@ -1245,6 +1244,30 @@ class PyBuildExt(build_ext):
        !            63:          dbm_order = ['gdbm']
        !            64:          # The standard Unix dbm module:
        !            65:          if host_platform not in ['cygwin']:
        !            66: +
        !            67: +            ## Top half based on find_file
        !            68: +            def find_ndbm_h(dirs):
        !            69: +                ret = None
        !            70: +                if sys.platform == 'darwin':
        !            71: +                    sysroot = macosx_sdk_root()
        !            72: +                for dir in dirs:
        !            73: +                    f = os.path.join(dir, 'ndbm.h')
        !            74: +                    if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
        !            75: +                        f = os.path.join(sysroot, dir[1:], 'ndbm.h')
        !            76: +                    if not os.path.exists(f): continue
        !            77: +
        !            78: +                    ret = 'True'
        !            79: +                    input = text_file.TextFile(f)
        !            80: +                    while 1:
        !            81: +                        line = input.readline()
        !            82: +                        if not line: break
        !            83: +                        if re.search('This file is part of GDBM', line):
        !            84: +                            ret = None
        !            85: +                            break
        !            86: +                    input.close()
        !            87: +                    break
        !            88: +                return ret
        !            89: +
        !            90:              config_args = [arg.strip("'")
        !            91:                             for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
        !            92:              dbm_args = [arg for arg in config_args
        !            93: @@ -1256,7 +1279,7 @@ class PyBuildExt(build_ext):
        !            94:              dbmext = None
        !            95:              for cand in dbm_order:
        !            96:                  if cand == "ndbm":
        !            97: -                    if find_file("ndbm.h", inc_dirs, []) is not None:
        !            98: +                    if find_ndbm_h(inc_dirs) is not None:
        !            99:                          # Some systems have -lndbm, others have -lgdbm_compat,
        !           100:                          # others don't have either
        !           101:                          if self.compiler.find_library_file(lib_dirs,
        !           102: @@ -1388,8 +1411,7 @@ class PyBuildExt(build_ext):
        !           103:              missing.append('_curses')
        !           104:  
        !           105:          # If the curses module is enabled, check for the panel module
        !           106: -        if (module_enabled(exts, '_curses') and
        !           107: -            self.compiler.find_library_file(lib_dirs, panel_library)):
        !           108: +        if (module_enabled(exts, '_curses')):
        !           109:              exts.append( Extension('_curses_panel', ['_curses_panel.c'],
        !           110:                                     include_dirs=curses_includes,
        !           111:                                     define_macros=curses_defines,
        !           112: @@ -1630,6 +1652,8 @@ class PyBuildExt(build_ext):
        !           113:  
        !           114:          # Build the _uuid module if possible
        !           115:          uuid_incs = find_file("uuid.h", inc_dirs, ["/usr/include/uuid"])
        !           116: +        if uuid_incs is None:
        !           117: +            uuid_incs = find_file("uuid/uuid.h", inc_dirs, [])
        !           118:          if uuid_incs is not None:
        !           119:              if self.compiler.find_library_file(lib_dirs, 'uuid'):
        !           120:                  uuid_libs = ['uuid']
        !           121: @@ -2019,10 +2043,7 @@ class PyBuildExt(build_ext):
        !           122:              depends = ['_decimal/docstrings.h']
        !           123:          else:
        !           124:              srcdir = sysconfig.get_config_var('srcdir')
        !           125: -            include_dirs = [os.path.abspath(os.path.join(srcdir,
        !           126: -                                                         'Modules',
        !           127: -                                                         '_decimal',
        !           128: -                                                         'libmpdec'))]
        !           129: +            include_dirs = ['Modules/_decimal/libmpdec']
        !           130:              libraries = ['m']
        !           131:              sources = [
        !           132:                '_decimal/_decimal.c',
        !           133: @@ -2358,7 +2379,7 @@ def main():
        !           134:            # If you change the scripts installed here, you also need to
        !           135:            # check the PyBuildScripts command above, and change the links
        !           136:            # created by the bininstall target in Makefile.pre.in
        !           137: -          scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
        !           138: +          scripts = ["Tools/scripts/pydoc3",
        !           139:                       "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
        !           140:          )
        !           141:  

CVSweb <webmaster@jp.NetBSD.org>