diff --git a/conanfile.py b/conanfile.py index 1285298..984ad81 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,37 +1,61 @@ from conans import ConanFile, CMake +import yaml +import re +import os.path + + +def getVersion(): + if(os.path.exists("CMakeLists.txt")): + regx = re.compile(r"^set\(.*VERSION\s(\"|')[0-9.]+(\"|')\)") + with open("CMakeLists.txt") as f: + for line in f: + if regx.match(line): + version = re.search("\"[0-9\.]+\"", line) + version = version.group().replace("\"", "") + return version + return None + + +def getMetaField(field): + if(os.path.exists("metainfo.yaml")): + with open("metainfo.yaml") as f: + metainfo = yaml.load(f.read()) + return metainfo[field] + return None class KCoreAddonsConan(ConanFile): - name = "kcoreaddons" - version = "5.50.0" - license = "GPLv2" - url = "https://api.kde.org/frameworks/kcoreaddons/html/index.html" - description = "Qt addon library with a collection of non-GUI utilities" + name = getMetaField('name') + version = getVersion() + license = getMetaField('license') + url = getMetaField('url') + description = getMetaField('description') settings = "os", "compiler", "build_type", "arch" requires = ( - "extra-cmake-modules/5.50.0@kde/testing", # CMakeLists.txt requires 5.49.0 + # CMakeLists.txt requires 5.49.0 + "extra-cmake-modules/[>=5.60.0]@kde/testing", - "Qt/5.11.1@bincrafters/stable" + "qt/[>=5.11.1]@bincrafters/stable" # "qt-core/5.8.0@qt/testing", # fam/latest@foo/bar, # inotify/latest@foo/bar, ) generators = "cmake" scm = { "type": "git", "url": "auto", "revision": "auto" - } + } def build(self): cmake = CMake(self) cmake.configure() cmake.build() cmake.install() def package_info(self): self.cpp_info.resdirs = ["share"] diff --git a/metainfo.yaml b/metainfo.yaml index 0c0d33f..d6ebc01 100644 --- a/metainfo.yaml +++ b/metainfo.yaml @@ -1,21 +1,24 @@ maintainer: mpyne -description: Addons to QtCore +name: kcoreaddons +description: Qt addon library with a collection of non-GUI utilities +license: GPLv2 +url: https://api.kde.org/frameworks/kcoreaddons/html/index.html tier: 1 type: functional platforms: - name: Linux - name: FreeBSD - name: Windows - name: MacOSX - name: Android portingAid: false deprecated: false release: true libraries: - qmake: KCoreAddons cmake: "KF5::CoreAddons" cmakename: KF5CoreAddons public_lib: true group: Frameworks subgroup: Tier 1 diff --git a/test_package/main.cpp b/test_package/main.cpp index 3e84db0..5e661fe 100644 --- a/test_package/main.cpp +++ b/test_package/main.cpp @@ -1,20 +1,22 @@ #include #include #include #include -static const QString TESTVALUE="5.50.0"; +static const QString TESTVALUE = "5.61.0"; -int main() { +int main() +{ QString readValue = KCoreAddons::versionString(); - if (readValue == TESTVALUE) { + if (readValue == TESTVALUE) + { std::cout << "Test OK" << std::endl; return 0; } std::cout << "Test FAILED" << std::endl; return 1; }