Esempio n. 1
0
    def test_packages(self):
        bento_info = """\
Name: foo

Recurse:
    foo

Library:
    Packages: foo
"""
        sub_bento_info = """\
Library:
    Packages: bar
"""

        r_bar_section = InstalledSection.from_source_target_directories(
            "pythonfiles", "foo", "$_srcrootdir/..", "$sitedir", ["foo/__init__.py"]
        )
        r_foo_bar_section = InstalledSection.from_source_target_directories(
            "pythonfiles", "foo.bar", "$_srcrootdir/..", "$sitedir", ["foo/bar/__init__.py"]
        )
        r_sections = {"pythonfiles": {"foo": r_bar_section, "foo.bar": r_foo_bar_section}}
        self._test_installed_sections(
            {"bento.info": bento_info, op.join("foo", "bento.info"): sub_bento_info}, r_sections
        )
Esempio n. 2
0
    def test_packages(self):
        bento_info = """\
Name: foo

Recurse:
    foo

Library:
    Packages: foo
"""
        sub_bento_info = """\
Library:
    Packages: bar
"""

        r_bar_section = InstalledSection.from_source_target_directories(
            "pythonfiles", "foo", "$_srcrootdir/..", "$sitedir",
            ["foo/__init__.py"])
        r_foo_bar_section = InstalledSection.from_source_target_directories(
            "pythonfiles", "foo.bar", "$_srcrootdir/..", "$sitedir",
            ["foo/bar/__init__.py"])
        r_sections = {
            "pythonfiles": {
                "foo": r_bar_section,
                "foo.bar": r_foo_bar_section
            }
        }
        self._test_installed_sections(
            {
                "bento.info": bento_info,
                op.join("foo", "bento.info"): sub_bento_info
            }, r_sections)
Esempio n. 3
0
    def test_from_source_target(self):
        files = [("scripts/foo.py", "scripts/foo.py"),
                 ("scripts/bar.py", "scripts/bar.py")]
        r_section = InstalledSection("pythonfiles", "section1", "source", "target", files)

        files = ["scripts/foo.py", "scripts/bar.py"]
        section = InstalledSection.from_source_target_directories("pythonfiles",
                        "section1", "source", "target", files)

        self.assertEqual(r_section.files, section.files)
Esempio n. 4
0
    def test_from_source_target(self):
        files = [("scripts/foo.py", "scripts/foo.py"), ("scripts/bar.py", "scripts/bar.py")]
        r_section = InstalledSection("pythonfiles", "section1", "source", "target", files)

        files = ["scripts/foo.py", "scripts/bar.py"]
        section = InstalledSection.from_source_target_directories("pythonfiles", "section1", "source", "target", files)

        self.assertEqual(r_section.files, section.files)
Esempio n. 5
0
def create_simple_ipkg_args():
    files = ["scripts/foo.py", "scripts/bar.py"]
    section = InstalledSection.from_source_target_directories("pythonfiles",
                    "section1", "source", "$prefix/target", files)
    sections = {"pythonfiles": {"section1": section}}

    meta = ipkg_meta_from_pkg(SPHINX_META_PKG)
    return meta, sections
Esempio n. 6
0
File: build.py Progetto: dagss/Bento
def build_data_files(pkg):
    ret = {}
    # Get data files
    for name, data_section in pkg.data_files.items():
        data_section.files = data_section.resolve_glob()
        data_section.source_dir = os.path.join("$_srcrootdir", data_section.source_dir)
        ret[name] = InstalledSection.from_data_files(name, data_section)

    return ret
Esempio n. 7
0
def create_simple_ipkg_args(top_node):
    files = ["scripts/foo.py", "scripts/bar.py"]
    srcdir = "source"

    nodes = [top_node.make_node(os.path.join(srcdir, f)) for f in files]
    for n in nodes:
        n.parent.mkdir()
        n.write("")
    section = InstalledSection.from_source_target_directories("pythonfiles",
                    "section1", os.path.join("$_srcrootdir", srcdir), "$prefix/target", files)
    sections = {"pythonfiles": {"section1": section}}

    meta = ipkg_meta_from_pkg(SPHINX_META_PKG)
    return meta, sections, nodes
Esempio n. 8
0
    def test_extension(self):
        """Test sub_directory support for C extensions."""
        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    Extension: foo
        Sources: src/foo.c
"""

        r_section = InstalledSection.from_source_target_directories(
            "extensions", "foo", "$_srcrootdir/.", "$sitedir/", ["foo.so"])
        r_sections = {"extensions": {"foo": r_section}}
        self._test_installed_sections(bento_info, r_sections)
Esempio n. 9
0
    def test_module(self):
        """Test sub_directory support for python module."""
        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    Modules: foo
"""

        r_section = InstalledSection.from_source_target_directories(
            "pythonfiles", "foo", "$_srcrootdir/../lib", "$sitedir",
            ["foo.py"])
        r_sections = {"pythonfiles": {"foo": r_section}}
        self._test_installed_sections(bento_info, r_sections)
def create_simple_build_manifest_args(top_node):
    files = ["scripts/foo.py", "scripts/bar.py"]
    srcdir = "source"

    nodes = [top_node.make_node(os.path.join(srcdir, f)) for f in files]
    for n in nodes:
        n.parent.mkdir()
        n.write("")
    section = InstalledSection.from_source_target_directories(
        "pythonfiles", "section1", os.path.join("$_srcrootdir", srcdir),
        "$prefix/target", files)
    sections = {"pythonfiles": {"section1": section}}

    meta = build_manifest_meta_from_pkg(SPHINX_META_PKG)
    return meta, sections, nodes
Esempio n. 11
0
    def test_compiled_library(self):
        """Test sub_directory support for C compiled libraries."""
        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    CompiledLibrary: foo
        Sources: src/foo.c
"""

        r_section = InstalledSection.from_source_target_directories(
            "compiled_libraries", "foo", "$_srcrootdir/.", "$sitedir/",
            ["libfoo.a"])
        r_sections = {"compiled_libraries": {"foo": r_section}}
        self._test_installed_sections(bento_info, r_sections)
Esempio n. 12
0
    def test_packages(self):
        """Test sub_directory support for packages."""
        self.maxDiff = 1024

        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    Packages: foo
"""

        r_section = InstalledSection.from_source_target_directories(
            "pythonfiles", "foo", "$_srcrootdir/../lib", "$sitedir",
            ["foo/__init__.py"])
        r_sections = {"pythonfiles": {"foo": r_section}}
        self._test_installed_sections(bento_info, r_sections)
Esempio n. 13
0
    def test_module(self):
        """Test sub_directory support for python module."""
        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    Modules: foo
"""

        r_section = InstalledSection.from_source_target_directories("pythonfiles",
                                     "foo",
                                     "$_srcrootdir/../lib",
                                     "$sitedir",
                                     ["foo.py"])
        r_sections = {"pythonfiles":
                         {"foo": r_section}}
        self._test_installed_sections(bento_info, r_sections)
Esempio n. 14
0
    def test_compiled_library(self):
        """Test sub_directory support for C compiled libraries."""
        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    CompiledLibrary: foo
        Sources: src/foo.c
"""

        r_section = InstalledSection.from_source_target_directories("compiled_libraries",
                                     "foo",
                                     "$_srcrootdir/.",
                                     "$sitedir/",
                                     ["libfoo.a"])
        r_sections = {"compiled_libraries":
                         {"foo": r_section}}
        self._test_installed_sections(bento_info, r_sections)
Esempio n. 15
0
    def test_extension(self):
        bento_info = """\
Name: foo

Recurse: bar
"""

        sub_bento_info = """\
Library:
    Extension: foo
        Sources: src/foo.c
"""

        r_section = InstalledSection.from_source_target_directories(
            "extensions", "bar.foo", "$_srcrootdir/bar", "$sitedir/bar", ["foo.so"]
        )
        r_sections = {"extensions": {"bar.foo": r_section}}
        self._test_installed_sections(
            {"bento.info": bento_info, op.join("bar", "bento.info"): sub_bento_info}, r_sections
        )
Esempio n. 16
0
    def test_packages(self):
        """Test sub_directory support for packages."""
        self.maxDiff = 1024

        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    Packages: foo
"""

        r_section = InstalledSection.from_source_target_directories("pythonfiles",
                                     "foo",
                                     "$_srcrootdir/../lib",
                                     "$sitedir",
                                     ["foo/__init__.py"])
        r_sections = {"pythonfiles":
                         {"foo": r_section}}
        self._test_installed_sections(bento_info, r_sections)
Esempio n. 17
0
    def test_extension(self):
        """Test sub_directory support for C extensions."""
        bento_info = """\
Name: foo

Library:
    SubDirectory: lib
    Extension: foo
        Sources: src/foo.c
"""

        r_section = InstalledSection.from_source_target_directories("extensions",
                                     "foo",
                                     "$_srcrootdir/.",
                                     "$sitedir/",
                                     ["foo.so"])
        r_sections = {"extensions":
                        {"foo":
                            r_section}}
        self._test_installed_sections(bento_info, r_sections)
Esempio n. 18
0
    def test_extension(self):
        bento_info = """\
Name: foo

Recurse: bar
"""

        sub_bento_info = """\
Library:
    Extension: foo
        Sources: src/foo.c
"""

        r_section = InstalledSection.from_source_target_directories(
            "extensions", "bar.foo", "$_srcrootdir/bar", "$sitedir/bar",
            ["foo.so"])
        r_sections = {"extensions": {"bar.foo": r_section}}
        self._test_installed_sections(
            {
                "bento.info": bento_info,
                op.join("bar", "bento.info"): sub_bento_info
            }, r_sections)
Esempio n. 19
0
def _generic_iregistrer(category, name, nodes, from_node, target_dir):
    source_dir = os.path.join("$_srcrootdir", from_node.bldpath())
    files = [n.path_from(from_node) for n in nodes]
    return InstalledSection.from_source_target_directories(
        category, name, source_dir, target_dir, files)
Esempio n. 20
0
 def test_simple(self):
     files = [("scripts/foo.py", "scripts/foo"),
              ("scripts/bar.py", "scripts/bar.py")]
     InstalledSection("pythonfiles", "section1", "source", "target", files)
Esempio n. 21
0
def _generic_iregistrer(category, name, nodes, from_node, target_dir):
    source_dir = os.path.join("$_srcrootdir", from_node.bldpath())
    files = [n.path_from(from_node) for n in nodes]
    return InstalledSection.from_source_target_directories(
        category, name, source_dir, target_dir, files)