pypy / lib_pypy /

import os, sys
import tempfile

def compile_shared():
    """Compile '_testcapi.c' into an extension module, and import it
    thisdir = os.path.dirname(__file__)
    output_dir = tempfile.mkdtemp()

    from distutils.ccompiler import new_compiler
    from distutils import sysconfig

    compiler = new_compiler()
    compiler.output_dir = output_dir

    # Compile .c file
    include_dir = os.path.join(thisdir, '..', 'include')
    if sys.platform == 'win32':
        ccflags = []
        ccflags = ['-fPIC', '-Wimplicit-function-declaration']
    res = compiler.compile([os.path.join(thisdir, '_testcapimodule.c')],
    object_filename = res[0]

    # set link options
    output_filename = '_testcapi' + sysconfig.get_config_var('SO')
    if sys.platform == 'win32':
        # XXX libpypy-c.lib is currently not installed automatically
        library = os.path.join(thisdir, '..', 'include', 'libpypy-c')
        libraries = [library, 'oleaut32']
        extra_ldargs = ['/MANIFEST',  # needed for VC10
        libraries = []
        extra_ldargs = []

    # link the dynamic library

    # Now import the newly created library, it will replace our module in sys.modules
    import imp
    fp, filename, description = imp.find_module('_testcapi', path=[output_dir])
    imp.load_module('_testcapi', fp, filename, description)

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.