diff options
author | Iikka Eklund <iikka.eklund@qt.io> | 2021-08-11 13:40:31 +0300 |
---|---|---|
committer | Iikka Eklund <iikka.eklund@qt.io> | 2021-12-27 06:21:47 +0000 |
commit | f9164011ed06c7ea25f19f761f6cd817ce66120f (patch) | |
tree | 16fe5a446d1f6dc11296c3c499d7aad7e3fb4eed | |
parent | fc932c7942fa0bf170601a04e6bc245d91f3298e (diff) | |
download | qtsvg-f9164011ed06c7ea25f19f761f6cd817ce66120f.tar.gz |
Conan: Inherit recipe class from QtLeafModule for common functionality
The qt-conan-common package implements a base class for Qt leaf
module recipes. The build steps in leaf modules are mostly identical
so it makes sense to put those in the base class.
Dependencies are read by the base class from the 'dependencies.yaml'
which is the same file the CI system uses.
Change-Id: Ib5cc5ab4c5b387a5ca1ee2587c9e785c151cde34
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 0c69831f3544a5737bceb97ac6162eb55443069c)
Reviewed-by: Simo Fält <simo.falt@qt.io>
-rw-r--r-- | conanfile.py | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/conanfile.py b/conanfile.py index 6871403..fb74cde 100644 --- a/conanfile.py +++ b/conanfile.py @@ -27,65 +27,34 @@ ############################################################################# from conans import ConanFile -import os import re -from functools import lru_cache from pathlib import Path -@lru_cache(maxsize=8) def _parse_qt_version_by_key(key: str) -> str: - with open(Path(Path(__file__).parent.resolve() / ".cmake.conf")) as f: - ret = [m.group(1) for m in [re.search(r"{0} .*\"(.*)\"".format(key), f.read())] if m] - return ret.pop() if ret else "" + with open(Path(__file__).parent.resolve() / ".cmake.conf") as f: + m = re.search(fr'{key} .*"(.*)"', f.read()) + return m.group(1) if m else "" def _get_qt_minor_version() -> str: - return _parse_qt_version_by_key('QT_REPO_MODULE_VERSION')[0:3] + return ".".join(_parse_qt_version_by_key("QT_REPO_MODULE_VERSION").split(".")[:2]) class QtSvg(ConanFile): name = "qtsvg" - license = "LGPL-3.0-only, Commercial Qt License Agreement" + license = "LGPL-3.0, GPL-2.0+, Commercial Qt License Agreement" author = "The Qt Company <https://www.qt.io/contact-us>" - url = "https://code.qt.io/cgit/qt/qtsvg.git/" + url = "https://code.qt.io/cgit/qt/qtsvg.git" description = ( "Scalable Vector Graphics (SVG) is an XML-based language for describing " "two-dimensional vector graphics. Qt provides classes for rendering and " "displaying SVG drawings in widgets and on other paint devices." ) - topics = ("qt", "qt6", "qtsvg", "svg") + topics = "qt", "qt6", "qtsvg", "svg" settings = "os", "compiler", "arch", "build_type" - exports = ".cmake.conf" # for referencing the version number and prerelease tag + # for referencing the version number and prerelease tag and dependencies info + exports = ".cmake.conf", "dependencies.yaml" exports_sources = "*", "!conan*.*" - # use commit ID as the RREV (recipe revision) if this is exported from .git repository - revision_mode = "scm" if Path(Path(__file__).parent.resolve() / ".git").exists() else "hash" python_requires = f"qt-conan-common/{_get_qt_minor_version()}@qt/everywhere" - - def set_version(self): - _ver = _parse_qt_version_by_key("QT_REPO_MODULE_VERSION") - _prerelease = _parse_qt_version_by_key("QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT") - self.version = _ver + "-" + _prerelease if _prerelease else _ver - - def requirements(self): - _version = _parse_qt_version_by_key("QT_REPO_MODULE_VERSION") - # will match latest prerelase of final major.minor.patch - self.requires(f"qtbase/[<={_version}, include_prerelease=True]@{self.user}/{self.channel}") - - def build(self): - self.python_requires["qt-conan-common"].module.build_leaf_qt_module(self) - - def package(self): - cmd = ["cmake", "--install", "."] - self.run(" ".join(cmd)) - - def package_info(self): - self.python_requires["qt-conan-common"].module.package_info(self) - - def package_id(self): - self.info.requires.package_revision_mode() - - def deploy(self): - self.copy("*") # copy from current package - if not os.environ.get("QT_CONAN_INSTALL_SKIP_DEPS"): - self.copy_deps("*") # copy from dependencies + python_requires_extend = "qt-conan-common.QtLeafModule" |