mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Apply suggested review changes
CURA-12400
This commit is contained in:
parent
575458c1dd
commit
6efbcb4ff6
5 changed files with 35 additions and 33 deletions
56
conanfile.py
56
conanfile.py
|
@ -17,7 +17,7 @@ from conan.tools.env import VirtualRunEnv, Environment, VirtualBuildEnv
|
|||
from conan.tools.scm import Version
|
||||
from conan.errors import ConanInvalidConfiguration, ConanException
|
||||
|
||||
required_conan_version = ">=2.7.0"
|
||||
required_conan_version = ">=2.7.0" # When changing the version, also change the one in conandata.yml/extra_dependencies
|
||||
|
||||
|
||||
class CuraConan(ConanFile):
|
||||
|
@ -148,26 +148,7 @@ class CuraConan(ConanFile):
|
|||
# That will not work for ALL open-source projects, but should already get a large majority of them
|
||||
return (url.startswith("https://github.com/") or url.startswith("https://gitlab.com/")) and "conan-center-index" not in url
|
||||
|
||||
def _make_pip_dependency_description(self, package, version, dependencies):
|
||||
url = ["https://pypi.org/pypi", package]
|
||||
if version is not None:
|
||||
url.append(version)
|
||||
url.append("json")
|
||||
|
||||
data = requests.get("/".join(url)).json()
|
||||
|
||||
dependency_description = {
|
||||
"summary": data["info"]["summary"],
|
||||
"version": data["info"]["version"],
|
||||
"license": data["info"]["license"]
|
||||
}
|
||||
|
||||
for url_data in data["urls"]:
|
||||
if url_data["packagetype"] == "sdist":
|
||||
sources_url = url_data["url"]
|
||||
dependency_description["sources_url"] = sources_url
|
||||
|
||||
if not self.options.skip_licenses_download:
|
||||
def _retrieve_pip_license(self, package, sources_url, dependency_description):
|
||||
# Download the sources to get the license file inside
|
||||
self.output.info(f"Retrieving license for {package}")
|
||||
response = requests.get(sources_url)
|
||||
|
@ -189,6 +170,28 @@ class CuraConan(ConanFile):
|
|||
with open(license_file_path, 'r') as file:
|
||||
dependency_description["license_full"] = file.read()
|
||||
|
||||
def _make_pip_dependency_description(self, package, version, dependencies):
|
||||
url = ["https://pypi.org/pypi", package]
|
||||
if version is not None:
|
||||
url.append(version)
|
||||
url.append("json")
|
||||
|
||||
data = requests.get("/".join(url)).json()
|
||||
|
||||
dependency_description = {
|
||||
"summary": data["info"]["summary"],
|
||||
"version": data["info"]["version"],
|
||||
"license": data["info"]["license"]
|
||||
}
|
||||
|
||||
for url_data in data["urls"]:
|
||||
if url_data["packagetype"] == "sdist":
|
||||
sources_url = url_data["url"]
|
||||
dependency_description["sources_url"] = sources_url
|
||||
|
||||
if not self.options.skip_licenses_download:
|
||||
self._retrieve_pip_license(package, sources_url, dependency_description)
|
||||
|
||||
for source_url, check_source in [("source", False),
|
||||
("Source", False),
|
||||
("Source Code", False),
|
||||
|
@ -200,6 +203,7 @@ class CuraConan(ConanFile):
|
|||
url = data["info"]["project_urls"][source_url]
|
||||
if check_source and not self._is_repository_url(url):
|
||||
# That will not work for ALL open-source projects, but should already get a large majority of them
|
||||
self.output.warning(f"Source URL for {package} ({url}) doesn't seem to be a supported repository")
|
||||
continue
|
||||
dependency_description["sources_url"] = url
|
||||
break
|
||||
|
@ -299,11 +303,6 @@ class CuraConan(ConanFile):
|
|||
def _dependencies_description(self):
|
||||
dependencies = {}
|
||||
|
||||
pip_requirements_summary = os.path.abspath(Path(self.generators_folder, "pip_requirements_summary.yml") )
|
||||
with open(pip_requirements_summary, 'r') as file:
|
||||
for package_name, package_version in yaml.safe_load(file).items():
|
||||
self._make_pip_dependency_description(package_name, package_version, dependencies)
|
||||
|
||||
for dependency in [self] + list(self.dependencies.values()):
|
||||
self._make_conan_dependency_description(dependency, dependencies)
|
||||
|
||||
|
@ -311,6 +310,11 @@ class CuraConan(ConanFile):
|
|||
for dependency_name, dependency_data in dependency.conan_data["extra_dependencies"].items():
|
||||
self._make_extra_dependency_description(dependency_name, dependency_data, dependencies)
|
||||
|
||||
pip_requirements_summary = os.path.abspath(Path(self.generators_folder, "pip_requirements_summary.yml") )
|
||||
with open(pip_requirements_summary, 'r') as file:
|
||||
for package_name, package_version in yaml.safe_load(file).items():
|
||||
self._make_pip_dependency_description(package_name, package_version, dependencies)
|
||||
|
||||
return dependencies
|
||||
|
||||
def _generate_cura_version(self, location):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2025 Ultimaker B.V.
|
||||
# Copyright (c) 2025 UltiMaker
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from typing import List
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2025 Ultimaker B.V.
|
||||
# Copyright (c) 2025 UltiMaker
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from PyQt6.QtCore import QObject, pyqtProperty, pyqtEnum
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 UltiMaker
|
||||
// Copyright (c) 2025 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.4
|
||||
|
@ -116,9 +116,7 @@ UM.Dialog
|
|||
{
|
||||
id: componentLicenseDialog
|
||||
|
||||
LicenseDialog
|
||||
{
|
||||
}
|
||||
LicenseDialog { }
|
||||
}
|
||||
|
||||
onLinkActivated:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 UltiMaker
|
||||
// Copyright (c) 2025 UltiMaker
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue