diff --git a/conanfile.py b/conanfile.py index 71c3f72..7966962 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,36 +1,59 @@ 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 KConfigConan(ConanFile): - name = "kconfig" - version = "5.50.0" - license = "GPLv2" - url = "https://api.kde.org/frameworks/kconfig/html/index.html" - description = "Persistent platform-independent application settings." + name = getMetaField('name') + version = getVersion() + license = getMetaField('license') + url = getMetaField('url') + description = getMetaField('description') settings = "os", "compiler", "build_type", "arch" requires = ( # CMakeLists.txt requires 5.49.0 "extra-cmake-modules/[>=5.50.0]@kde/testing", "qt/[>=5.11.3]@bincrafters/stable" # "qt-gui/5.8.0@qt/testing", # "qt-xml/5.8.0@qt/testing", ) 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 a57e936..57af388 100644 --- a/metainfo.yaml +++ b/metainfo.yaml @@ -1,23 +1,26 @@ maintainer: mdawson -description: Configuration system +name: kconfig +description: Persistent platform-independent application settings +license: GPLv2 +url: https://api.kde.org/frameworks/kconfig/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: KConfigCore cmake: "KF5::ConfigCore" - qmake: KConfigGui cmake: "KF5::ConfigGui" cmakename: KF5Config public_lib: true group: Frameworks subgroup: Tier 1