diff --git a/aqt/archives.py b/aqt/archives.py index 6061a268..2d6e9a8d 100644 --- a/aqt/archives.py +++ b/aqt/archives.py @@ -623,7 +623,7 @@ def __init__( ) def _arch_ext(self) -> str: - return "_src_doc_examples" + return "_" + QtRepoProperty.sde_ext(self.version) def _base_module_name(self) -> str: """ diff --git a/aqt/metadata.py b/aqt/metadata.py index 4e7eb87c..37831019 100644 --- a/aqt/metadata.py +++ b/aqt/metadata.py @@ -20,6 +20,7 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import itertools import operator +import os import posixpath import re import secrets as random @@ -275,7 +276,7 @@ def to_url(self) -> str: ) def to_folder(self, version: Version, qt_version_no_dots: str, extension: Optional[str] = None) -> str: - if version >= Version("6.8.0"): + if (version >= Version("6.8.0")) and not ((self.host == "all_os") and (self.target == "qt")): return "{category}{major}_{ver}/{category}{major}_{ver}{ext}".format( category=self.category, major=qt_version_no_dots[0], @@ -569,6 +570,16 @@ def known_extensions(version: Version) -> List[str]: return ["qtpdf", "qtwebengine"] return [] + @staticmethod + def sde_ext(version: Version) -> str: + if version >= Version("6.8.0"): + if os.linesep == "\r\n": + return "windows_line_endings_src" + else: + return "unix_line_endings_src" + else: + return "src_doc_examples" + class MetadataFactory: """Retrieve metadata of Qt variations, versions, and descriptions from Qt site.""" @@ -973,7 +984,9 @@ def fetch_modules_sde(self, cmd_type: str, version: Version) -> List[str]: "qt", ), "Internal misuse of fetch_modules_sde" qt_ver_str = self._get_qt_version_str(version) - modules_meta = self._fetch_module_metadata(self.archive_id.to_folder(version, qt_ver_str, "src_doc_examples")) + modules_meta = self._fetch_module_metadata( + self.archive_id.to_folder(version, qt_ver_str, QtRepoProperty.sde_ext(version)) + ) # pattern: Match all names "qt.qt5.12345.doc.(\w+) pattern = re.compile(r"^qt\.(qt" + str(version.major) + r"\.)?" + qt_ver_str + r"\." + cmd_type + r"\.(.+)$") @@ -993,7 +1006,11 @@ def fetch_archives_sde(self, cmd_type: str, version: Version) -> List[str]: return self.fetch_archives(version, cmd_type, [], is_sde=True) def fetch_archives(self, version: Version, arch: str, modules: List[str], is_sde: bool = False) -> List[str]: - extension = "src_doc_examples" if is_sde else QtRepoProperty.extension_for_arch(arch, version >= Version("6.0.0")) + extension = ( + QtRepoProperty.sde_ext(version) + if is_sde + else QtRepoProperty.extension_for_arch(arch, version >= Version("6.0.0")) + ) qt_version_str = self._get_qt_version_str(version) nonempty = MetadataFactory._has_nonempty_downloads