Add option to skip licenses download

CURA-12400
This is useful for development, because it can take a few minutes
This commit is contained in:
Erwan MATHIEU 2025-02-17 15:57:10 +01:00
parent eaeaa0d2b2
commit 18a37b2cc3

View File

@ -43,6 +43,7 @@ class CuraConan(ConanFile):
"cura_debug_mode": [True, False], # FIXME: Use profiles
"internal": [True, False],
"i18n_extract": [True, False],
"skip_licenses_download": [True, False],
}
default_options = {
"enterprise": False,
@ -52,6 +53,7 @@ class CuraConan(ConanFile):
"cura_debug_mode": False, # Not yet implemented
"internal": False,
"i18n_extract": False,
"skip_licenses_download": False,
}
def set_version(self):
@ -165,6 +167,7 @@ class CuraConan(ConanFile):
sources_url = url_data["url"]
dependency_description["sources_url"] = sources_url
if not self.options.skip_licenses_download:
# Download the sources to get the license file inside
self.output.info(f"Retrieving license for {package}")
response = requests.get(sources_url)
@ -266,7 +269,7 @@ class CuraConan(ConanFile):
if not check_source or is_repository_source:
dependency_description["sources_url"] = source_url
if is_repository_source:
if is_repository_source and not self.options.skip_licenses_download:
self.output.info(f"Retrieving license for {dependency.ref.name}")
dependency_description["license_full"] = self._get_license_from_repository(source_url, str(dependency.ref.version))
@ -278,18 +281,20 @@ class CuraConan(ConanFile):
sources_url = dependency_data["sources_url"]
version = dependency_data["version"]
self.output.info(f"Retrieving license for {dependency_name}")
license_file = dependency_data["license_file"] if "license_file" in dependency_data else None
license_full = self._get_license_from_repository(sources_url, version, license_file)
dependencies[dependency_name] = {
dependency_description = {
"summary": dependency_data["summary"],
"version": version,
"license": dependency_data["license"],
"license_full": license_full,
"sources_url": sources_url,
}
if not self.options.skip_licenses_download:
self.output.info(f"Retrieving license for {dependency_name}")
license_file = dependency_data["license_file"] if "license_file" in dependency_data else None
dependency_description["license_full"] = self._get_license_from_repository(sources_url, version, license_file)
dependencies[dependency_name] = dependency_description
def _dependencies_description(self):
dependencies = {}
@ -302,8 +307,8 @@ class CuraConan(ConanFile):
self._make_conan_dependency_description(dependency, dependencies)
if "extra_dependencies" in dependency.conan_data:
for dependency in dependency.conan_data["extra_dependencies"]:
self._make_extra_dependency_description(dependency, dependencies)
for dependency_name, dependency_data in dependency.conan_data["extra_dependencies"].items():
self._make_extra_dependency_description(dependency_name, dependency_data, dependencies)
if "extra_dependencies" in self.conan_data:
for dependency_name, dependency_data in self.conan_data["extra_dependencies"].items():