Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qxlsx: add v1.4.9, transitive_headers=True, drop oldest version #25406

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions recipes/qxlsx/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
sources:
"1.4.9":
url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.9.zip"
sha256: "2582c8929163c267658ed65b5b1d3e2edff34c2dd53a6e34ea5f4d3e3f7359cd"
"1.4.5":
url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.5.zip"
sha256: "eadcad2718335673f86fe20fd91e822e6c1e3624483be9d79cf79254e5426067"
"1.4.4":
url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.4.zip"
sha256: "3efbd6f63a1ffd521c535dce7b5a5a7e9ebd23db51e6ae8e3e2eb89796e57675"
patches:
"1.4.9":
- patch_file: "patches/1.4.9/0001-fix-qstring-error.patch"
patch_description: "Fix a QString compilation error"
patch_type: "backport"

Check warning on line 15 in recipes/qxlsx/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 15)
patch_source: "https://github.com/QtExcel/QXlsx/commit/11bafef83286e79a95f17773926b62253ba53cab"
18 changes: 13 additions & 5 deletions recipes/qxlsx/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import copy, get, rmdir
from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir
from conan.tools.scm import Version
from conan.tools.microsoft import is_msvc
from conan.errors import ConanInvalidConfiguration
Expand All @@ -12,7 +12,7 @@

class QXlsxConan(ConanFile):
name = "qxlsx"
description = "Excel file(*.xlsx) reader/writer library using Qt 5 or 6."
description = "Excel file (*.xlsx) reader/writer library using Qt 5 or 6."
license = "MIT"
topics = ("excel", "xlsx")
homepage = "https://github.com/QtExcel/QXlsx"
Expand All @@ -32,6 +32,9 @@ class QXlsxConan(ConanFile):
def _qt_version(self):
return str(Version(self.dependencies["qt"].ref.version).major)

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand All @@ -46,7 +49,10 @@ def layout(self):
def requirements(self):
# INFO: QXlsx/xlsxdocument.h includes QtGlobal
# INFO: transitive libs: undefined reference to symbol '_ZN10QArrayData10deallocateEPS_mm@@Qt_5'
self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True)
if Version(self.version) >= "1.4.9":
self.requires("qt/[>=6.7 <7]", transitive_headers=True, transitive_libs=True)
else:
self.requires("qt/[~5.15]", transitive_headers=True, transitive_libs=True)

def validate(self):
if not self.dependencies["qt"].options.gui:
Expand All @@ -72,12 +78,13 @@ def generate(self):
tc.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, "QXlsx"))
cmake.build()

def package(self):
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
Expand All @@ -87,7 +94,8 @@ def package_info(self):
self.cpp_info.set_property("cmake_file_name", cmake_name)
self.cpp_info.set_property("cmake_target_name", "QXlsx::QXlsx")
self.cpp_info.libs = [cmake_name]
self.cpp_info.includedirs = ["include", os.path.join("include", "QXlsx")]
includedir = f"QXlsxQt{self._qt_version}" if Version(self.version) >= "1.4.6" else "QXlsx"
self.cpp_info.includedirs = ["include", os.path.join("include", includedir)]
self.cpp_info.requires = ["qt::qtCore", "qt::qtGui"]

# TODO: to remove in conan v2 once cmake_find_package* generators removed
Expand Down
22 changes: 22 additions & 0 deletions recipes/qxlsx/all/patches/1.4.9/0001-fix-qstring-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
A fix for https://github.com/QtExcel/QXlsx/issues/349 based on
https://github.com/QtExcel/QXlsx/commit/11bafef83286e79a95f17773926b62253ba53cab
--- a/QXlsx/source/xlsxworkbook.cpp
+++ b/QXlsx/source/xlsxworkbook.cpp
@@ -607,7 +607,7 @@

AbstractSheet *sheet = addSheet(name, sheetId, type);
sheet->setSheetState(state);
- if (relationship.target.startsWith("/")) {
+ if (relationship.target.startsWith(u'/')) {
QString fullPath = QDir::cleanPath(relationship.target.mid(1));

sheet->setFilePath(fullPath);
@@ -618,7 +618,7 @@
// QLatin1String("/") + relationship.target);
const auto parts = splitPath(strFilePath);
QString fullPath =
- QDir::cleanPath(parts.first() + QLatin1String("/") + relationship.target);
+ QDir::cleanPath(parts.first() + u'/' + relationship.target);

sheet->setFilePath(fullPath);
}
1 change: 1 addition & 0 deletions recipes/qxlsx/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(test_package LANGUAGES CXX)

find_package(QXlsx QUIET CONFIG)
find_package(QXlsxQt5 QUIET CONFIG)
find_package(QXlsxQt6 QUIET CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE QXlsx::QXlsx)
Expand Down
10 changes: 3 additions & 7 deletions recipes/qxlsx/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.cmake import CMake, cmake_layout
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "VirtualRunEnv"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
Expand All @@ -15,16 +15,12 @@ def requirements(self):
def layout(self):
cmake_layout(self)

def generate(self):
tc = CMakeToolchain(self)
tc.generate()

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")
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
2 changes: 2 additions & 0 deletions recipes/qxlsx/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.4.9":
folder: "all"
"1.4.5":
folder: "all"
"1.4.4":
Expand Down
Loading