Exemple #1
0
    def test_simple_no_cython(self):
        bento_info = """\
Library:
    Extension: foo
        Sources: foo1.c, foo2.c
"""
        bentos = {"bento.info": bento_info}
        create_fake_package_from_bento_infos(self.run_node, bentos)

        pkg = PackageDescription.from_string(bento_info)
        self.assertFalse(has_cython_code(pkg))
Exemple #2
0
    def test_simple_no_cython(self):
        bento_info = """\
Library:
    Extension: foo
        Sources: foo1.c, foo2.c
"""
        bentos = {"bento.info": bento_info}
        create_fake_package_from_bento_infos(self.run_node, bentos)

        pkg = PackageDescription.from_string(bento_info)
        self.assertFalse(has_cython_code(pkg))
Exemple #3
0
    def test_sub_package(self):
        bento_info = """\
Recurse: foo

Library:
    Extension: foo
        Sources: foo1.c
"""
        bento_sub1_info = """
Library:
    Extension: bar
        Sources: bar.pyx
"""
        bentos = {"bento.info": bento_info, op.join("foo", "bento.info"): bento_sub1_info}
        create_fake_package_from_bento_infos(self.run_node, bentos)

        pkg = PackageDescription.from_string(bento_info)
        self.assertTrue(has_cython_code(pkg))
Exemple #4
0
    def test_sub_package(self):
        bento_info = """\
Recurse: foo

Library:
    Extension: foo
        Sources: foo1.c
"""
        bento_sub1_info = """
Library:
    Extension: bar
        Sources: bar.pyx
"""
        bentos = {"bento.info": bento_info, op.join("foo", "bento.info"): bento_sub1_info}
        create_fake_package_from_bento_infos(self.run_node, bentos)

        pkg = PackageDescription.from_string(bento_info)
        self.assertTrue(has_cython_code(pkg))
Exemple #5
0
    def configure(self):
        o, a = self.get_parsed_arguments()
        if o.use_distutils_flags:
            Options.options.use_distutils_flags = True
        else:
            Options.options.use_distutils_flags = False

        pkg = self.pkg
        # FIXME: this is wrong (not taking into account sub packages)
        needs_compiler = has_compiled_code(pkg)
        needs_cython = has_cython_code(pkg)

        conf = self.waf_context
        if needs_compiler:
            conf.load("compiler_c")
            conf.env["PYTHON"] = [sys.executable]
            conf.load("custom_python", tooldir=[WAF_TOOLDIR])
            conf.check_python_version((2,4,2))
            conf.check_python_headers()

        if needs_cython:
            # FIXME: how to make sure the tool loaded successfully ?
            conf.load("cython", tooldir=[WAF_TOOLDIR])