示例#1
0
from __future__ import absolute_import, print_function

import time, os, sys
from . import test_pyximport


if 1:
    from distutils import sysconfig
    try:
        sysconfig.set_python_build()
    except AttributeError:
        pass
    import pyxbuild
    print(pyxbuild.distutils.sysconfig == sysconfig)


def test():
    tempdir = test_pyximport.make_tempdir()
    sys.path.append(tempdir)
    hello_file = os.path.join(tempdir, "hello.pyx")
    open(hello_file, "w").write("x = 1; print x; before = 'before'\n")
    import hello
    assert hello.x == 1

    time.sleep(1) # sleep to make sure that new "hello.pyx" has later
              # timestamp than object file.

    open(hello_file, "w").write("x = 2; print x; after = 'after'\n")
    reload(hello)
    assert hello.x == 2, "Reload should work on Python 2.3 but not 2.2"
    test_pyximport.remove_tempdir(tempdir)
示例#2
0
            library_dirs=added_lib_dirs,
        )
        self.extensions.append(ext)

        # XXX handle these, but how to detect?
        # *** Uncomment and edit for PIL (TkImaging) extension only:
        #       -DWITH_PIL -I../Extensions/Imaging/libImaging  tkImaging.c \
        # *** Uncomment and edit for TOGL extension only:
        #       -DWITH_TOGL togl.c \
        # *** Uncomment these for TOGL extension only:
        #       -lGL -lGLU -lXext -lXmu \


def main():
    setup(
        name='Python standard library',
        version='%d.%d' % sys.version_info[:2],
        cmdclass={'build_ext': PyBuildExt},
        # The struct module is defined here, because build_ext won't be
        # called unless there's at least one extension module defined.
        ext_modules=[Extension('struct', ['structmodule.c'])],

        # Scripts to install
        scripts=['Tools/scripts/pydoc'])


# --install-platlib
if __name__ == '__main__':
    sysconfig.set_python_build()
    main()
示例#3
0
# Autodetecting setup.py script for building the Python extensions
#
# Modified for BeOS build.  Donn Cave, March 27 2001.
__version__ = "special BeOS after 1.37"
import sys, os, getopt
from distutils import sysconfig
from distutils import text_file
from distutils.errors import *
from distutils.core import Extension, setup
from distutils.command.build_ext import build_ext
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = ['dbm', 'mmap', 'resource', 'nis']

def find_file(filename, std_dirs, paths):
    """Searches for the directory where a given file is located,
    and returns a possibly-empty list of additional directories, or None
    if the file couldn't be found at all.
    'filename' is the name of a file, such as readline.h or libcrypto.a.
    'std_dirs' is the list of standard system directories; if the
        file is found in one of them, no additional directives are needed.
    'paths' is a list of additional locations to check; if the file is
        found in one of them, the resulting list will contain the directory.
    """
    # Check the standard locations
    for dir in std_dirs:
        f = os.path.join(dir, filename)
        if os.path.exists(f): return []
    # Check the additional directories
    for dir in paths:
        f = os.path.join(dir, filename)
示例#4
0
# Autodetecting setup.py script for building the Python extensions
#
# Modified for BeOS build.  Donn Cave, March 27 2001.
__version__ = "special BeOS after 1.37"
import sys, os, getopt
from distutils import sysconfig
from distutils import text_file
from distutils.errors import *
from distutils.core import Extension, setup
from distutils.command.build_ext import build_ext
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = ['dbm', 'mmap', 'resource', 'nis']
def find_file(filename, std_dirs, paths):
    """Searches for the directory where a given file is located,
    and returns a possibly-empty list of additional directories, or None
    if the file couldn't be found at all.
    'filename' is the name of a file, such as readline.h or libcrypto.a.
    'std_dirs' is the list of standard system directories; if the
        file is found in one of them, no additional directives are needed.
    'paths' is a list of additional locations to check; if the file is
        found in one of them, the resulting list will contain the directory.
    """
    # Check the standard locations
    for dir in std_dirs:
        f = os.path.join(dir, filename)
        if os.path.exists(f): return []
    # Check the additional directories
    for dir in paths:
        f = os.path.join(dir, filename)
        if os.path.exists(f):