Пример #1
0
    def process_setup_line(line, variant=None):
        d = parse_setup_line(line, variant)

        if not d:
            return

        extension = d["extension"]
        log("processing extension %s (variant %s)" % (extension, d["variant"]))

        objs = []

        for obj in sorted(d["posix_obj_paths"]):
            obj = pathlib.Path("build") / obj
            log("adding object file %s for extension %s" % (obj, extension))
            objs.append(str(obj))

            # Mark object file as used so we don't include it in the core
            # object files below. .remove() would be nicer, as we would catch
            # missing object files. But some sources (like math.c) are used by
            # multiple modules!
            modules_objs.discard(obj)

        links = []

        for framework in sorted(d["frameworks"]):
            log("adding framework %s for extension %s" %
                (framework, extension))
            links.append({"name": framework, "framework": True})

        for libname in sorted(d["links"]):
            log("adding library %s for extension %s" % (libname, extension))

            if libname in libraries:
                entry = {
                    "name": libname,
                    "path_static": "build/lib/lib%s.a" % libname
                }

                links.append(entry)
            else:
                links.append({"name": libname, "system": True})

        entry = {
            "in_core": False,
            "init_fn": "PyInit_%s" % extension,
            "links": links,
            "objs": objs,
            "variant": d["variant"],
        }

        if libressl:
            ignore_keys = {"openssl"}
        else:
            ignore_keys = {"libressl"}

        add_licenses_to_extension_entry(entry, ignore_keys=ignore_keys)

        bi["extensions"].setdefault(extension, []).append(entry)
Пример #2
0
    def process_setup_line(line, variant=None):
        d = parse_setup_line(line, variant)

        if not d:
            return

        extension = d['extension']
        log('processing extension %s (variant %s)' % (extension, d['variant']))

        objs = []

        for obj in sorted(d['posix_obj_paths']):
            obj = pathlib.Path('build') / obj
            log('adding object file %s for extension %s' % (obj, extension))
            objs.append(str(obj))

            # Mark object file as used so we don't include it in the core
            # object files below. .remove() would be nicer, as we would catch
            # missing object files. But some sources (like math.c) are used by
            # multiple modules!
            modules_objs.discard(obj)

        links = []

        for libname in sorted(d['links']):
            log('adding library %s for extension %s' % (libname, extension))

            if libname in libraries:
                entry = {
                    'name': libname,
                    'path_static': 'build/lib/lib%s.a' % libname,
                }

                links.append(entry)
            else:
                links.append({
                    'name': libname,
                    'system': True,
                })

        entry = {
            'in_core': False,
            'init_fn': 'PyInit_%s' % extension,
            'links': links,
            'objs': objs,
            'variant': d['variant'],
        }

        if libressl:
            ignore_keys = {'openssl'}
        else:
            ignore_keys = {'libressl'}

        add_licenses_to_extension_entry(entry, ignore_keys=ignore_keys)

        bi['extensions'].setdefault(extension, []).append(entry)
Пример #3
0
    def process_setup_line(line):
        d = parse_setup_line(line, variant=None)

        if not d:
            return

        extension = d['extension']
        log('processing extension %s' % extension)

        objs = []

        for obj in sorted(d['posix_obj_paths']):
            obj = pathlib.Path('build') / obj
            log('adding object file %s for extension %s' % (obj, extension))
            objs.append(str(obj))

            modules_objs.discard(obj)

        links = []

        for framework in sorted(d['frameworks']):
            log('adding framework %s for extension %s' %
                (framework, extension))

            links.append({
                'name': framework,
                'framework': True,
            })

        for libname in sorted(d['links']):
            log('adding library %s for extension %s' % (libname, extension))

            if libname in libraries:
                entry = {
                    'name': libname,
                    'path_static': 'build/lib/lib%s.a' % libname,
                }

                links.append(entry)
            else:
                links.append({
                    'name': libname,
                    'system': True,
                })

        entry = {
            'in_core': False,
            'init_fn': 'PyInit_%s' % extension,
            'links': links,
            'objs': objs,
            'variant': 'default',
        }

        add_licenses_to_extension_entry(entry)

        bi['extensions'][extension] = [entry]
Пример #4
0
    def process_setup_line(line, variant=None):
        d = parse_setup_line(line, variant)

        if not d:
            return

        extension = d["extension"]
        log("processing extension %s (variant %s)" % (extension, d["variant"]))

        objs = []

        for obj in sorted(d["posix_obj_paths"]):
            obj = pathlib.Path("build") / obj
            log("adding object file %s for extension %s" % (obj, extension))
            objs.append(str(obj))

            # Mark object file as used so we don't include it in the core
            # object files below. .remove() would be nicer, as we would catch
            # missing object files. But some sources (like math.c) are used by
            # multiple modules!
            modules_objs.discard(obj)

        links = []

        for framework in sorted(d["frameworks"]):
            log("adding framework %s for extension %s" %
                (framework, extension))
            links.append({"name": framework, "framework": True})

        for libname in sorted(d["links"]):
            log("adding library %s for extension %s" % (libname, extension))

            if libname in libraries:
                entry = {
                    "name": libname,
                    "path_static": "build/lib/lib%s.a" % libname
                }

                links.append(entry)
            else:
                links.append({"name": libname, "system": True})

        if platform == "macos":
            # For some reason, Python's build system adds libintl as a link
            # against libpythonX.Y/pythonX.Y instead of the _locale extension
            # despite the _location extension being the only user of its
            # symbols. We add libintl here to work around that.
            links.append({
                "name": "intl",
                "path_static": "build/lib/libintl.a"
            })

            # And symbols in our built libintl reference iconv symbols. So we
            # need to include that dependency as well.
            links.append({"name": "iconv", "system": True})

        entry = {
            "in_core": False,
            "init_fn": "PyInit_%s" % extension,
            "links": links,
            "objs": objs,
            "variant": d["variant"],
        }

        if libressl:
            ignore_keys = {"openssl"}
        else:
            ignore_keys = {"libressl"}

        add_licenses_to_extension_entry(entry, ignore_keys=ignore_keys)

        bi["extensions"].setdefault(extension, []).append(entry)