Repository: conan-io/conan-center-index

Issue:
[request] kuliya/1.0.0
### Package Name/Version

kuliya/1.0.0

### Webpage

https://dzcode-io.github.io/kuliya/

### Source code

https://github.com/dzcode-io/kuliya/tree/main/c

### Description of the library/tool

Algeria's college hierarchy dataset as a C library


Discussion:

Resolving patch:
diff --git a/recipes/kuliya/all/conanfile.py b/recipes/kuliya/all/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/kuliya/all/conanfile.py
@@ -0,0 +1,40 @@
+from conan import ConanFile
+from conan.tools.files import copy, get, download
+from conan.tools.layout import basic_layout
+import os
+
+required_conan_version = ">=1.50.0"
+
+
+class JsmnConan(ConanFile):
+    name = "kuliya"
+    description = "Algeria's college hierarchy dataset as a C library."
+    license = "MIT"
+    topics = ("dataset", "api", "dz", "header-only")
+    homepage = "https://github.com/dzcode-io/kuliya"
+    url = "https://github.com/conan-io/conan-center-index"
+    package_type = "header-library"
+    settings = "os", "arch", "compiler", "build_type"
+    no_copy_source = True
+
+    def layout(self):
+        basic_layout(self, src_folder="src")
+
+    def package_id(self):
+        self.info.clear()
+
+    def source(self):
+        get(self, **self.conan_data["sources"][self.version]["release"], strip_root=True)
+        download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE")
+
+    def build(self):
+        pass
+
+    def package(self):
+        copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
+        copy(self, "kuliya.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include"))
+        copy(self, "data.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include"))
+
+    def package_info(self):
+        self.cpp_info.bindirs = []
+        self.cpp_info.libdirs = []


Test patch:
diff --git a/recipes/kuliya/all/test_package/CMakeLists.txt b/recipes/kuliya/all/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/kuliya/all/test_package/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.15)
+project(test_package LANGUAGES C)
+
+find_package(kuliya REQUIRED CONFIG)
+
+add_executable(${PROJECT_NAME} test_package.c)
+target_link_libraries(${PROJECT_NAME} PRIVATE kuliya::kuliya)
diff --git a/recipes/kuliya/all/test_package/conanfile.py b/recipes/kuliya/all/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/kuliya/all/test_package/conanfile.py
@@ -0,0 +1,26 @@
+from conan import ConanFile
+from conan.tools.build import can_run
+from conan.tools.cmake import CMake, cmake_layout
+import os
+
+
+class TestPackageConan(ConanFile):
+    settings = "os", "arch", "compiler", "build_type"
+    generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
+    test_type = "explicit"
+
+    def layout(self):
+        cmake_layout(self)
+
+    def requirements(self):
+        self.requires(self.tested_reference_str)
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        if can_run(self):
+            bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
+            self.run(bin_path, env="conanrun")
diff --git a/recipes/kuliya/all/test_package/test_package.c b/recipes/kuliya/all/test_package/test_package.c
new file mode 100644
--- /dev/null
+++ b/recipes/kuliya/all/test_package/test_package.c
@@ -0,0 +1,13 @@
+#undef NDEBUG
+
+#include <kuliya.h>
+#include <assert.h>
+#include <string.h>
+
+int main()
+{
+    kuliya_init();
+    kuliya_schema *res = get_node_by_path("umkb/fst");
+    assert(strcmp(res->name.en, "Faculty of Science and Technology") == 0);
+    kuliya_deinit();
+}