diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 11277b6b..d7771f97 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -23,6 +23,8 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version === Removed * The `api.` prefix for commands is no longer supported. + * Old style packages without `contents.toml` are no longer supported. The `xml_subdir` and + `include_subdir` entries in the package specification file are now ignored. == 0.8.7 (10 Sep 2023) diff --git a/asciidoxy/document.py b/asciidoxy/document.py index e1db2fce..fdf283b9 100644 --- a/asciidoxy/document.py +++ b/asciidoxy/document.py @@ -45,7 +45,6 @@ class Package: python_dir: Directory containing Python code to include in the documentation. This directory will be added to the Python path for documents in this package - scoped: True if this is a new-style, scoped package. copy_adoc_src_dir: True if the content of `adoc_src_dir` should be copied to the working directory. """ @@ -58,7 +57,6 @@ class Package: adoc_image_dir: Optional[Path] = None adoc_root_doc: Optional[Path] = None python_dir: Optional[Path] = None - scoped: bool = False copy_adoc_src_dir: bool = True def __init__(self, name: str): @@ -90,8 +88,6 @@ def load_from_toml(self, pkg_root: Path, data: Mapping[str, Any]) -> None: if python is not None: self.python_dir = path_from_toml(python, "dir", pkg_root) - self.scoped = True - class Document: """An AsciiDoc document being processed by AsciiDoxy. diff --git a/asciidoxy/generator/asciidoc.py b/asciidoxy/generator/asciidoc.py index 55b7c3a8..7ba73024 100644 --- a/asciidoxy/generator/asciidoc.py +++ b/asciidoxy/generator/asciidoc.py @@ -652,11 +652,6 @@ def _find_document(self, file_name: Optional[str], rel_file_name: Optional[Path] if package_name and file_name: rel_file_name = Path(file_name) - elif file_name and not self._context.document.package.scoped: - # and not package_name - # Deprecated support for old style packages - package_name, rel_file_name = self._context.package_manager.find_original_file( - (self._context.document.work_file.parent / file_name).resolve()) elif file_name: # and not package_name rel_file_name = self._context.document.resolve_relative_path(file_name) package_name = self._context.document.package.name diff --git a/asciidoxy/packaging/collect.py b/asciidoxy/packaging/collect.py index ac0bff3a..67c969d5 100644 --- a/asciidoxy/packaging/collect.py +++ b/asciidoxy/packaging/collect.py @@ -27,7 +27,6 @@ import shutil import tarfile import urllib -import warnings from abc import ABC, abstractmethod from pathlib import Path, PurePath from typing import Any, Dict, List, Mapping, Optional, Sequence, Type, TypeVar, Union @@ -91,14 +90,9 @@ class PackageSpec(ABC): Attributes: name: Name of the package. - xml_subdir: Subdirectory in the package containing XML descriptions of the API. - include_subdir: Subdirectory in the package containing files for inclusion. """ name: str - xml_subdir: Optional[str] = None - include_subdir: Optional[str] = None - def __init__(self, name: str, **kwargs): self.name = name @@ -131,11 +125,7 @@ def from_toml(cls: Type[PackageSpecT], name: str, raw_spec: Mapping[str, Any], Raises: SpecificationError: The specification in TOML is invalid. """ - get = cls._make_getter(name, raw_spec) - spec = cls(name, **init_args) - spec.xml_subdir = get("xml_subdir", optional=True) - spec.include_subdir = get("include_subdir", optional=True) return spec @staticmethod @@ -172,26 +162,8 @@ def _make_package(self, package_dir: Path) -> Package: self.name, "Packaged `contents.toml` specifies a " "non-existing adoc root document.") - elif self.xml_subdir or self.include_subdir: - warnings.warn( - "Packages without contents.toml are deprecated and will no longer be" - " supported from 0.9.0.", FutureWarning) - if self.xml_subdir: - xml_dir = package_dir / self.xml_subdir - if xml_dir.is_dir(): - logger.debug(f"{self.name} has XML subdirectory, considering doxygen type") - pkg.reference_type = "doxygen" - pkg.reference_dir = xml_dir - if self.include_subdir: - include_dir = package_dir / self.include_subdir - if include_dir.is_dir(): - logger.debug(f"{self.name} has include subdirectory") - pkg.adoc_src_dir = include_dir else: - raise InvalidPackageError( - self.name, "Package does not contain `contents.toml` and package" - " specification does not specify the XML or include" - " directory.") + raise InvalidPackageError(self.name, "Package does not contain `contents.toml`.") if pkg.reference_dir is None and pkg.adoc_src_dir is None: raise InvalidPackageError(self.name, "Package does not contain XML or include files.") diff --git a/asciidoxy/packaging/manager.py b/asciidoxy/packaging/manager.py index 71d03ec0..7af90d14 100644 --- a/asciidoxy/packaging/manager.py +++ b/asciidoxy/packaging/manager.py @@ -99,7 +99,6 @@ def set_input_files(self, pkg = Package(Package.INPUT_PACKAGE_NAME) pkg.adoc_src_dir = include_dir pkg.adoc_root_doc = in_file - pkg.scoped = True if image_dir is not None: pkg.adoc_image_dir = image_dir diff --git a/documentation/Makefile b/documentation/Makefile index 76603d73..d0644558 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -33,7 +33,10 @@ $(DOC_BUILD_DIR)/asciidoxy: $(DOC_BUILD_DIR) $(DOXYGEN_BUILD_DIR)/asciidoxy: $(DOXYGEN_BUILD_DIR) mkdir -p $(DOXYGEN_BUILD_DIR)/asciidoxy -$(DOXYGEN_BUILD_DIR)/asciidoxy/xml: $(DOXYGEN_BUILD_DIR)/asciidoxy +$(DOXYGEN_BUILD_DIR)/asciidoxy/contents.toml: contents.toml $(DOXYGEN_BUILD_DIR)/asciidoxy + cp $< $@ + +$(DOXYGEN_BUILD_DIR)/asciidoxy/xml: $(DOXYGEN_BUILD_DIR)/asciidoxy $(DOXYGEN_BUILD_DIR)/asciidoxy/contents.toml . $(BUILD_DIR)/doxygen-$(LATEST_DOXYGEN_VERSION)/activate_run.sh; doxygen $(CURDIR)/copy: $(ROOT_DIR)/CHANGELOG.adoc @@ -45,9 +48,12 @@ EXAMPLE_OUTPUTS := $(addprefix $(DOXYGEN_BUILD_DIR)/,$(addsuffix xml,$(EXAMPLE_D define EXAMPLE_template $(DOXYGEN_BUILD_DIR)/$(1): $(DOXYGEN_BUILD_DIR) - mkdir -p $(DOXYGEN_BUILD_DIR)/$(1) + mkdir -p $$@ + +$(DOXYGEN_BUILD_DIR)/$(1)/contents.toml: $(1)/contents.toml $(DOXYGEN_BUILD_DIR)/$(1) + cp $$< $$@ -$(DOXYGEN_BUILD_DIR)/$(1)xml: $(DOXYGEN_BUILD_DIR)/$(1) $(filter-out %.adoc,$(wildcard $(1)/*)) +$(DOXYGEN_BUILD_DIR)/$(1)xml: $(DOXYGEN_BUILD_DIR)/$(1) $(DOXYGEN_BUILD_DIR)/$(1)/contents.toml $(filter-out %.adoc,$(wildcard $(1)/*)) . $(BUILD_DIR)/doxygen-$(LATEST_DOXYGEN_VERSION)/activate_run.sh; cd $(1) && OUTPUT_DIR=$(DOXYGEN_BUILD_DIR)/$(1) doxygen endef diff --git a/documentation/asciidoxy.toml b/documentation/asciidoxy.toml index c00b2153..47c07264 100644 --- a/documentation/asciidoxy.toml +++ b/documentation/asciidoxy.toml @@ -16,8 +16,6 @@ [sources.local] type = "local" -xml_subdir = "xml" -include_subdir = "adoc" [packages] diff --git a/documentation/contents.toml b/documentation/contents.toml new file mode 100644 index 00000000..f9e87054 --- /dev/null +++ b/documentation/contents.toml @@ -0,0 +1,7 @@ +[package] +name = "asciidoxy" + +[reference] +type = "doxygen" +dir = "xml" + diff --git a/documentation/examples/cpp/contents.toml b/documentation/examples/cpp/contents.toml new file mode 100644 index 00000000..fdcf2e92 --- /dev/null +++ b/documentation/examples/cpp/contents.toml @@ -0,0 +1,6 @@ +[package] +name = "cppexamples" + +[reference] +type = "doxygen" +dir = "xml" diff --git a/documentation/examples/java/contents.toml b/documentation/examples/java/contents.toml new file mode 100644 index 00000000..c8d2cbba --- /dev/null +++ b/documentation/examples/java/contents.toml @@ -0,0 +1,6 @@ +[package] +name = "javaexamples" + +[reference] +type = "doxygen" +dir = "xml" diff --git a/documentation/examples/objc/contents.toml b/documentation/examples/objc/contents.toml new file mode 100644 index 00000000..f8e6b3e9 --- /dev/null +++ b/documentation/examples/objc/contents.toml @@ -0,0 +1,6 @@ +[package] +name = "objcexamples" + +[reference] +type = "doxygen" +dir = "xml" diff --git a/documentation/examples/python/contents.toml b/documentation/examples/python/contents.toml new file mode 100644 index 00000000..c18ef7b8 --- /dev/null +++ b/documentation/examples/python/contents.toml @@ -0,0 +1,6 @@ +[package] +name = "pythonexamples" + +[reference] +type = "doxygen" +dir = "xml" diff --git a/documentation/reference/packages.adoc b/documentation/reference/packages.adoc index 43e90aa6..74c6579d 100644 --- a/documentation/reference/packages.adoc +++ b/documentation/reference/packages.adoc @@ -63,16 +63,8 @@ types of packages the following key/value pairs are required: `type`:: The type of the package. -For old-style packages the following key/value pairs are required. For backwards compatibility they -can always be specified, even for new-style packages. But in case of new-style packages, they are -ignored. New-style packages use <<_package_content_files>> to specify the contents. - -`xml_subdir`:: Subdirectory in the root of the package in which all Doxygen XML files are stored. -`include_subdir`:: Subdirectory in the root of the package in which all other include files are -stored. - -Packages of type `local` refer to a local directory. They require the following additional key/value -pairs: +Packages of type `local` refer to a local directory. They require the following additional +key/value pairs: `package_dir`:: Absolute or relative path to the directory containing the package. @@ -82,8 +74,6 @@ Example: ---- [packages.local_package] type = "local" -xml_subdir = "xml" -include_subdir = "adoc" package_dir = "/path/to/my/package/" ---- @@ -132,8 +122,6 @@ Example: [packages.package1] type = "http" url_template = "https://example.com/{name}/{version}/{file_name}" -xml_subdir = "xml" -include_subdir = "adoc" version = "12.3.4" login = "asciidoxy" password_env = "ASCIIDOXY_PASSWORD" @@ -174,8 +162,6 @@ Example: [sources.remote_server] type = "http" url_template = "https://example.com/{name}/{version}/{file_name}" -xml_subdir = "xml" -include_subdir = "adoc" [packages] diff --git a/tests/data/adoc.tar.gz b/tests/data/adoc.tar.gz index 86312ad3..e1e8ce6f 100644 Binary files a/tests/data/adoc.tar.gz and b/tests/data/adoc.tar.gz differ diff --git a/tests/data/old_style_package.tar.gz b/tests/data/old_style_package.tar.gz new file mode 100644 index 00000000..f26342cc Binary files /dev/null and b/tests/data/old_style_package.tar.gz differ diff --git a/tests/data/xml.tar.gz b/tests/data/xml.tar.gz index b4f687a0..30891233 100644 Binary files a/tests/data/xml.tar.gz and b/tests/data/xml.tar.gz differ diff --git a/tests/unit/file_builder.py b/tests/unit/file_builder.py index 868c6e09..42f9aec7 100644 --- a/tests/unit/file_builder.py +++ b/tests/unit/file_builder.py @@ -84,7 +84,6 @@ def _add_package(self, package_name: str, default_file: Optional[str] = None): pkg.adoc_src_dir = self.packages_dir / package_name if default_file: pkg.adoc_root_doc = pkg.adoc_src_dir / default_file - pkg.scoped = True self.package_manager.packages[package_name] = pkg return pkg diff --git a/tests/unit/generator/test_generator.py b/tests/unit/generator/test_generator.py index 5a6a7fd9..dd04f2f1 100644 --- a/tests/unit/generator/test_generator.py +++ b/tests/unit/generator/test_generator.py @@ -642,21 +642,6 @@ def test_cross_document_ref__package_must_be_explicit(file_builder, tdb_single_a assert result == "" -def test_cross_document_ref__direct_access_to_other_package_for_old_style_packages( - file_builder, tdb_single_and_multipage, tdb_warnings_are_and_are_not_errors): - file_builder.add_input_file("input.adoc") - file_builder.add_package_file("package", "include.adoc") - file_builder.package_manager.input_package().scoped = False - - for api in file_builder.apis(): - result = api.cross_document_ref("include.adoc", link_text="bla") - if isinstance(api, GeneratingApi): - if tdb_single_and_multipage: - assert result == "<>" - else: - assert result == "<>" - - def test_cross_document_ref__with_link_text(file_builder, tdb_single_and_multipage): file_builder.add_input_file("input.adoc") file_builder.add_include_file("includes/other_file.adoc") @@ -996,27 +981,6 @@ def test_include__package_does_not_exist(file_builder, tdb_warnings_are_and_are_ assert api.include("the_right_file.adoc", package_name="package-b") == "" -def test_include__direct_access_to_other_package_for_old_style_packages(file_builder): - input_file = file_builder.add_input_file("input.adoc") - file_builder.add_package_file("package-a", "another_file.adoc") - file_builder.package_manager.input_package().scoped = False - - for api in file_builder.apis(): - result = api.include("another_file.adoc") - lines = result.splitlines() - assert len(lines) == 2 - - assert lines[0] == "[#top-another_file-top]" - - assert lines[1].startswith("include::") - assert lines[1].endswith("[leveloffset=+1]") - - file_name = input_file.work_dir / lines[1][9:-16] - assert file_name.is_file() - assert file_name.name == "another_file.adoc" - assert file_name.is_absolute() - - def test_include__with_leveloffset(file_builder): file_builder.add_input_file("input.adoc") file_builder.add_include_file("includes/another_file.adoc") diff --git a/tests/unit/packaging/test_collect.py b/tests/unit/packaging/test_collect.py index 092f27aa..72fabb57 100644 --- a/tests/unit/packaging/test_collect.py +++ b/tests/unit/packaging/test_collect.py @@ -53,10 +53,15 @@ async def package_file_response(request): return web.FileResponse(Path(__file__).parent.parent.parent / "data" / "package.tar.gz") -async def currupt_package_file_response(request): +async def corrupt_package_file_response(request): return web.FileResponse(Path(__file__).parent.parent.parent / "data" / "corrupt_package.tar.gz") +async def old_style_package_file_response(request): + return web.FileResponse( + Path(__file__).parent.parent.parent / "data" / "old_style_package.tar.gz") + + async def error404_response(request): return web.Response(status=404) @@ -67,7 +72,6 @@ async def text_response(request): def verify_default_package(pkg, tmp_path): assert pkg.name == "package" - assert pkg.scoped is True assert pkg.reference_type == "doxygen" assert pkg.reference_dir == tmp_path / "test" / "1.0.0" / "xml" @@ -107,8 +111,6 @@ async def test_http_package__contents_toml__spec_dirs_ignored(aiohttp_server, tm spec = HttpPackageSpec("test", "1.0.0", f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") spec.file_names = ["package"] - spec.xml_subdir = "thereisnoxmlhere" - spec.include_subdir = "adocissomewhereelse" packages = await collect([spec], tmp_path) @@ -116,98 +118,22 @@ async def test_http_package__contents_toml__spec_dirs_ignored(aiohttp_server, tm verify_default_package(packages[0], tmp_path) -async def test_http_package__old__xml_only(aiohttp_server, tmp_path): - server = await start_server(aiohttp_server, web.get("/test/1.0.0/xml", xml_file_response)) - - spec = HttpPackageSpec("test", "1.0.0", - f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.xml_subdir = "xml" - spec.file_names = ["xml"] - - with pytest.warns(FutureWarning): - packages = await collect([spec], tmp_path) - - assert len(packages) == 1 - pkg = packages[0] - assert pkg.name == "test" - assert pkg.scoped is False - assert pkg.reference_dir is not None - assert pkg.reference_type == "doxygen" - assert pkg.adoc_src_dir is None - - assert pkg.reference_dir.is_dir() - assert (pkg.reference_dir / "content.xml").is_file() - - assert (tmp_path / "test" / "1.0.0" / "xml").is_dir() - assert (tmp_path / "test" / "1.0.0" / "xml" / "content.xml").is_file() - - -async def test_http_package__old__include_only(aiohttp_server, tmp_path): - server = await start_server(aiohttp_server, web.get("/test/1.0.0/include", - include_file_response)) - - spec = HttpPackageSpec("test", "1.0.0", - f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.include_subdir = "adoc" - spec.file_names = ["include"] - - with pytest.warns(FutureWarning): - packages = await collect([spec], tmp_path) - - assert len(packages) == 1 - pkg = packages[0] - assert pkg.name == "test" - assert pkg.scoped is False - assert pkg.reference_dir is None - assert pkg.adoc_src_dir is not None - - assert pkg.adoc_src_dir.is_dir() - assert (pkg.adoc_src_dir / "content.adoc").is_file() - - assert (tmp_path / "test" / "1.0.0" / "adoc").is_dir() - assert (tmp_path / "test" / "1.0.0" / "adoc" / "content.adoc").is_file() - - -async def test_http_package__old__xml_and_include(aiohttp_server, tmp_path): - server = await start_server( - aiohttp_server, - web.get("/test/1.0.0/include", include_file_response), - web.get("/test/1.0.0/xml", xml_file_response), - ) +async def test_http_package__contents_toml__missing(aiohttp_server, tmp_path): + server = await start_server(aiohttp_server, + web.get("/test/1.0.0/package", old_style_package_file_response)) spec = HttpPackageSpec("test", "1.0.0", f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" - spec.file_names = ["include", "xml"] - - with pytest.warns(FutureWarning): - packages = await collect([spec], tmp_path) - - assert len(packages) == 1 - pkg = packages[0] - assert pkg.name == "test" - assert pkg.scoped is False - assert pkg.reference_dir is not None - assert pkg.reference_type == "doxygen" - assert pkg.adoc_src_dir is not None - - assert pkg.reference_dir.is_dir() - assert (pkg.reference_dir / "content.xml").is_file() - - assert (tmp_path / "test" / "1.0.0" / "xml").is_dir() - assert (tmp_path / "test" / "1.0.0" / "xml" / "content.xml").is_file() - - assert pkg.adoc_src_dir.is_dir() - assert (pkg.adoc_src_dir / "content.adoc").is_file() + spec.file_names = ["package"] - assert (tmp_path / "test" / "1.0.0" / "adoc").is_dir() - assert (tmp_path / "test" / "1.0.0" / "adoc" / "content.adoc").is_file() + with pytest.raises(InvalidPackageError): + await collect([spec], tmp_path) + assert not (tmp_path / "test" / "1.0.0").exists() async def test_http_package__contents_toml__corrupt(aiohttp_server, tmp_path): server = await start_server(aiohttp_server, - web.get("/test/1.0.0/package", currupt_package_file_response)) + web.get("/test/1.0.0/package", corrupt_package_file_response)) spec = HttpPackageSpec("test", "1.0.0", f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") @@ -383,40 +309,6 @@ async def package_file_response_with_auth(request): verify_default_package(packages[0], tmp_path) -async def test_http_package__old__subdirs_not_specified(aiohttp_server, tmp_path): - server = await start_server( - aiohttp_server, - web.get("/test/1.0.0/include", include_file_response), - web.get("/test/1.0.0/xml", xml_file_response), - ) - - spec = HttpPackageSpec("test", "1.0.0", - f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.file_names = ["include", "xml"] - - with pytest.raises(InvalidPackageError): - await collect([spec], tmp_path) - assert not (tmp_path / "test" / "1.0.0").exists() - - -async def test_http_package__old__subdirs_not_matched(aiohttp_server, tmp_path): - server = await start_server( - aiohttp_server, - web.get("/test/1.0.0/include", include_file_response), - web.get("/test/1.0.0/xml", xml_file_response), - ) - - spec = HttpPackageSpec("test", "1.0.0", - f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.xml_subdir = "doxygen" - spec.include_subdir = "include" - spec.file_names = ["include", "xml"] - - with pytest.raises(InvalidPackageError): - await collect([spec], tmp_path) - assert not (tmp_path / "test" / "1.0.0").exists() - - async def test_http_package_error404(aiohttp_server, tmp_path): server = await start_server(aiohttp_server, web.get("/test/1.0.0/error", error404_response)) @@ -445,8 +337,6 @@ async def test_http_package_name_interpolation_in_file_names(aiohttp_server, tmp spec = HttpPackageSpec("test", "1.0.0", f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" spec.file_names = ["{name}"] await collect([spec], tmp_path) @@ -460,8 +350,6 @@ async def test_http_package_version_interpolation_in_file_names(aiohttp_server, spec = HttpPackageSpec("test", "1.0.0", f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" spec.file_names = ["documentation-{version}"] await collect([spec], tmp_path) @@ -475,8 +363,6 @@ async def test_http_package_version_and_name_interpolation_in_file_names(aiohttp spec = HttpPackageSpec("test", "1.0.0", f"http://localhost:{server.port}/{{name}}/{{version}}/{{file_name}}") - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" spec.file_names = ["{name}-{version}"] await collect([spec], tmp_path) @@ -506,15 +392,12 @@ async def test_local_package__contents_toml(tmp_path): """) spec = LocalPackageSpec("test", input_dir) - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" packages = await collect([spec], output_dir) assert len(packages) == 1 pkg = packages[0] assert pkg.name == "package" - assert pkg.scoped is True assert pkg.reference_type == "doxygen" assert pkg.reference_dir == input_dir / "xml" @@ -522,107 +405,22 @@ async def test_local_package__contents_toml(tmp_path): assert pkg.adoc_image_dir == input_dir / "images" -async def test_local_package__old__xml_and_include(tmp_path): - output_dir = tmp_path / "output" - input_dir = tmp_path / "input" - - input_dir.mkdir(parents=True, exist_ok=True) - (input_dir / "xml").mkdir() - (input_dir / "adoc").mkdir() - - spec = LocalPackageSpec("test", input_dir) - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" - - packages = await collect([spec], output_dir) - assert len(packages) == 1 - - pkg = packages[0] - assert pkg.name == "test" - assert pkg.scoped is False - assert pkg.reference_dir is not None - assert pkg.reference_type == "doxygen" - assert pkg.adoc_src_dir is not None - - assert pkg.reference_dir == input_dir / "xml" - assert pkg.adoc_src_dir == input_dir / "adoc" - - -async def test_local_package__old__include_only(tmp_path): - output_dir = tmp_path / "output" - input_dir = tmp_path / "input" - - input_dir.mkdir(parents=True, exist_ok=True) - (input_dir / "adoc").mkdir() - - spec = LocalPackageSpec("test", input_dir) - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" - - packages = await collect([spec], output_dir) - assert len(packages) == 1 - - pkg = packages[0] - assert pkg.name == "test" - assert pkg.scoped is False - assert pkg.reference_dir is None - assert pkg.adoc_src_dir is not None - - assert pkg.adoc_src_dir == input_dir / "adoc" - - -async def test_local_package__old__xml_only(tmp_path): - output_dir = tmp_path / "output" - input_dir = tmp_path / "input" - - input_dir.mkdir(parents=True, exist_ok=True) - (input_dir / "xml").mkdir() - - spec = LocalPackageSpec("test", input_dir) - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" - - packages = await collect([spec], output_dir) - assert len(packages) == 1 - - pkg = packages[0] - assert pkg.name == "test" - assert pkg.scoped is False - assert pkg.reference_dir is not None - assert pkg.reference_type == "doxygen" - assert pkg.adoc_src_dir is None - - assert pkg.reference_dir == input_dir / "xml" - - -async def test_local_package__old__subdirs_not_matched(tmp_path): - output_dir = tmp_path / "output" - input_dir = tmp_path / "input" - - input_dir.mkdir(parents=True, exist_ok=True) - (input_dir / "doxygen").mkdir() - (input_dir / "include").mkdir() - - spec = LocalPackageSpec("test", input_dir) - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" - - with pytest.raises(InvalidPackageError): - await collect([spec], output_dir) - assert input_dir.exists() - - async def test_progress_report(tmp_path): output_dir = tmp_path / "output" input_dir = tmp_path / "input" input_dir.mkdir(parents=True, exist_ok=True) (input_dir / "xml").mkdir() + (input_dir / "contents.toml").write_text("""\ +[package] +name = "package" - spec = LocalPackageSpec("test", input_dir) - spec.xml_subdir = "xml" - spec.include_subdir = "adoc" +[reference] +type = "doxygen" +dir = "xml" +""") + spec = LocalPackageSpec("test", input_dir) progress_mock = ProgressMock() packages = await collect([spec, spec, spec], output_dir, progress=progress_mock) @@ -649,8 +447,6 @@ def test_specs_from_file__http_package(tmp_path): [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "xml.tar.gz" ] version = "1.0.0" @@ -662,8 +458,6 @@ def test_specs_from_file__http_package(tmp_path): spec = specs[0] assert spec.name == "test" assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir == "include" assert spec.url_template == "https://example.com/{version}" assert spec.file_names == ["xml.tar.gz"] assert spec.version == "1.0.0" @@ -676,8 +470,6 @@ def test_specs_from_file__http_package__with_version_file(tmp_path): [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "xml.tar.gz" ] """) @@ -695,8 +487,6 @@ def test_specs_from_file__http_package__with_version_file(tmp_path): spec = specs[0] assert spec.name == "test" assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir == "include" assert spec.url_template == "https://example.com/{version}" assert spec.file_names == ["xml.tar.gz"] assert spec.version == "1.5.8" @@ -709,8 +499,6 @@ def test_specs_from_file__http_package__with_version_file__spec_override(tmp_pat [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "xml.tar.gz" ] version = "15.2.1" @@ -729,8 +517,6 @@ def test_specs_from_file__http_package__with_version_file__spec_override(tmp_pat spec = specs[0] assert spec.name == "test" assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir == "include" assert spec.url_template == "https://example.com/{version}" assert spec.file_names == ["xml.tar.gz"] assert spec.version == "15.2.1" @@ -743,8 +529,6 @@ def test_specs_from_file__http_package__with_version_file__version_missing(tmp_p [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "xml.tar.gz" ] """) @@ -759,58 +543,6 @@ def test_specs_from_file__http_package__with_version_file__version_missing(tmp_p specs_from_file(spec_file, version_file) -def test_specs_from_file__http_package__no_xml_subdir(tmp_path): - spec_file = tmp_path / "spec.toml" - spec_file.write_text(""" -[packages] - -[packages.test] -type = "http" -include_subdir = "include" -url_template = "https://example.com/{version}" -file_names = [ "xml.tar.gz" ] -version = "1.0.0" -""") - - specs = specs_from_file(spec_file) - assert len(specs) == 1 - - spec = specs[0] - assert spec.name == "test" - assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir is None - assert spec.include_subdir == "include" - assert spec.url_template == "https://example.com/{version}" - assert spec.file_names == ["xml.tar.gz"] - assert spec.version == "1.0.0" - - -def test_specs_from_file__http_package__no_include_subdir(tmp_path): - spec_file = tmp_path / "spec.toml" - spec_file.write_text(""" -[packages] - -[packages.test] -type = "http" -xml_subdir = "xml" -url_template = "https://example.com/{version}" -file_names = [ "xml.tar.gz" ] -version = "1.0.0" -""") - - specs = specs_from_file(spec_file) - assert len(specs) == 1 - - spec = specs[0] - assert spec.name == "test" - assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir is None - assert spec.url_template == "https://example.com/{version}" - assert spec.file_names == ["xml.tar.gz"] - assert spec.version == "1.0.0" - - def test_specs_from_file__http_package__no_url_template(tmp_path): spec_file = tmp_path / "spec.toml" spec_file.write_text(""" @@ -818,8 +550,6 @@ def test_specs_from_file__http_package__no_url_template(tmp_path): [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" file_names = [ "xml.tar.gz" ] version = "1.0.0" """) @@ -835,8 +565,6 @@ def test_specs_from_file__http_package__no_file_names(tmp_path): [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" version = "1.0.0" """) @@ -852,8 +580,6 @@ def test_specs_from_file__http_package__invalid_file_names(tmp_path): [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = "xml.tar.gz" version = "1.0.0" @@ -870,8 +596,6 @@ def test_specs_from_file__http_package__no_version(tmp_path): [packages.test] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "xml.tar.gz" ] """) @@ -888,54 +612,6 @@ def test_specs_from_file__local_package(tmp_path): [packages.test] type = "local" -xml_subdir = "xml" -include_subdir = "include" -package_dir = "{package_dir}" -""") - - specs = specs_from_file(spec_file) - assert len(specs) == 1 - - spec = specs[0] - assert spec.name == "test" - assert isinstance(spec, LocalPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir == "include" - assert spec.package_dir == package_dir - - -def test_specs_from_file__local_package_no_xml_subdir(tmp_path): - spec_file = tmp_path / "spec.toml" - package_dir = tmp_path / "package" - spec_file.write_text(f""" -[packages] - -[packages.test] -type = "local" -include_subdir = "include" -package_dir = "{package_dir}" -""") - - specs = specs_from_file(spec_file) - assert len(specs) == 1 - - spec = specs[0] - assert spec.name == "test" - assert isinstance(spec, LocalPackageSpec) - assert spec.xml_subdir is None - assert spec.include_subdir == "include" - assert spec.package_dir == package_dir - - -def test_specs_from_file__local_package_no_include_subdir(tmp_path): - spec_file = tmp_path / "spec.toml" - package_dir = tmp_path / "package" - spec_file.write_text(f""" -[packages] - -[packages.test] -type = "local" -xml_subdir = "xml" package_dir = "{package_dir}" """) @@ -945,8 +621,6 @@ def test_specs_from_file__local_package_no_include_subdir(tmp_path): spec = specs[0] assert spec.name == "test" assert isinstance(spec, LocalPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir is None assert spec.package_dir == package_dir @@ -957,8 +631,6 @@ def test_specs_from_file__local_package_no_package_dir(tmp_path): [packages.test] type = "local" -xml_subdir = "xml" -include_subdir = "include" """) with pytest.raises(SpecificationError): @@ -972,8 +644,6 @@ def test_specs_from_file__no_type(tmp_path): [packages] [packages.test] -xml_subdir = "xml" -include_subdir = "include" file_names = [ "xml.tar.gz" ] url_template = "https://example.com/{{version}}" version = "1.0.0" @@ -991,8 +661,6 @@ def test_specs_from_file__source(tmp_path): [sources.http] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "xml.tar.gz" ] @@ -1010,8 +678,6 @@ def test_specs_from_file__source(tmp_path): spec = specs[0] assert spec.name == "test" assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir == "include" assert spec.url_template == "https://example.com/{version}" assert spec.file_names == ["xml.tar.gz"] assert spec.version == "1.0.0" @@ -1024,8 +690,6 @@ def test_specs_from_file__source__override_partial(tmp_path): [sources.http] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "xml.tar.gz" ] @@ -1034,8 +698,6 @@ def test_specs_from_file__source__override_partial(tmp_path): [packages.test] source = "http" -xml_subdir = "doxygen" -include_subdir = "adoc" version = "1.0.0" """) @@ -1045,8 +707,6 @@ def test_specs_from_file__source__override_partial(tmp_path): spec = specs[0] assert spec.name == "test" assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir == "doxygen" - assert spec.include_subdir == "adoc" assert spec.url_template == "https://example.com/{version}" assert spec.file_names == ["xml.tar.gz"] assert spec.version == "1.0.0" @@ -1076,8 +736,6 @@ def test_specs_from_file__name_and_version_interpolation(tmp_path): [sources.http] type = "http" -xml_subdir = "xml" -include_subdir = "include" url_template = "https://example.com/{version}" file_names = [ "{name}-{version}.tar.gz" ] @@ -1086,8 +744,6 @@ def test_specs_from_file__name_and_version_interpolation(tmp_path): [packages.test] source = "http" -xml_subdir = "xml" -include_subdir = "adoc" version = "1.0.0" """) @@ -1097,8 +753,6 @@ def test_specs_from_file__name_and_version_interpolation(tmp_path): spec = specs[0] assert spec.name == "test" assert isinstance(spec, HttpPackageSpec) - assert spec.xml_subdir == "xml" - assert spec.include_subdir == "adoc" assert spec.url_template == "https://example.com/{version}" assert spec.file_names == ["{name}-{version}.tar.gz"] assert spec.version == "1.0.0" diff --git a/tests/unit/packaging/test_manager.py b/tests/unit/packaging/test_manager.py index 68b115fd..8969d2cf 100644 --- a/tests/unit/packaging/test_manager.py +++ b/tests/unit/packaging/test_manager.py @@ -91,8 +91,6 @@ def create_package_spec(parent: Path, *names: str) -> Path: "sources": { "local": { "type": "local", - "xml_subdir": "xml", - "include_subdir": "adoc" } }, } diff --git a/tests/unit/test_document.py b/tests/unit/test_document.py index f5dab978..24b8e45f 100644 --- a/tests/unit/test_document.py +++ b/tests/unit/test_document.py @@ -43,7 +43,6 @@ def test_package__from_toml(tmp_path): pkg.load_from_toml(tmp_path, toml.loads(contents)) assert pkg.name == "package" - assert pkg.scoped is True assert pkg.reference_type == "doxygen" assert pkg.reference_dir == tmp_path / "xml" assert pkg.adoc_src_dir == tmp_path / "adoc" @@ -70,7 +69,6 @@ def test_package__from_toml__no_name(tmp_path): pkg.load_from_toml(tmp_path, toml.loads(contents)) assert pkg.name == "my-package" - assert pkg.scoped is True assert pkg.reference_type == "doxygen" assert pkg.reference_dir == tmp_path / "xml" assert pkg.adoc_src_dir == tmp_path / "adoc" @@ -93,7 +91,6 @@ def test_package__from_toml__no_reference(tmp_path): pkg.load_from_toml(tmp_path, toml.loads(contents)) assert pkg.name == "package" - assert pkg.scoped is True assert pkg.reference_type is None assert pkg.reference_dir is None assert pkg.adoc_src_dir == tmp_path / "adoc" @@ -115,7 +112,6 @@ def test_package__from_toml__no_asciidoc(tmp_path): pkg.load_from_toml(tmp_path, toml.loads(contents)) assert pkg.name == "package" - assert pkg.scoped is True assert pkg.reference_type == "doxygen" assert pkg.reference_dir == tmp_path / "xml" assert pkg.adoc_src_dir is None @@ -140,7 +136,6 @@ def test_package__from_toml__root_doc_no_src_dir(tmp_path): pkg.load_from_toml(tmp_path, toml.loads(contents)) assert pkg.name == "package" - assert pkg.scoped is True assert pkg.reference_type == "doxygen" assert pkg.reference_dir == tmp_path / "xml" assert pkg.adoc_src_dir is None @@ -167,7 +162,6 @@ def test_package__from_toml__no_python_code(tmp_path): pkg.load_from_toml(tmp_path, toml.loads(contents)) assert pkg.name == "package" - assert pkg.scoped is True assert pkg.reference_type == "doxygen" assert pkg.reference_dir == tmp_path / "xml" assert pkg.adoc_src_dir == tmp_path / "adoc"