Skip to content

Commit

Permalink
Release 3.1.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
nyibbang committed Apr 17, 2024
2 parents ea58ec4 + d2c4bbc commit a0ed208
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 58 deletions.
2 changes: 0 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ build-wheel:
tags:
- docker
image: python:3.8
variables:
LIBQI_REPOSITORY_URL: "https://gitlab-ci-token:$CI_JOB_TOKEN@$CI_SERVER_HOST/qi/libqi"
script:
- curl -sSL https://get.docker.com/ | sh
- pip install cibuildwheel==2.14.1
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ if(BUILD_TESTING)
include(GoogleTest)

find_package(qimodule REQUIRED)
qi_create_module(moduletest NO_INSTALL)
qi_add_module(moduletest)
target_sources(
moduletest
PRIVATE
Expand Down
13 changes: 6 additions & 7 deletions ci/cibuildwheel_linux_before_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@ pip install 'conan>=2' 'cmake>=3.23' ninja
yum install -y perl-IPC-Cmd perl-Digest-SHA

# Install Conan configuration.
conan profile detect
conan config install "$PACKAGE/ci/conan"

# Clone and export libqi to Conan cache.
QI_VERSION=$(sed -nE '/^\s*requires\s*=/,/^\s*]/{ s/\s*"qi\/([^"]+)".*/\1/p }' "$PACKAGE/conanfile.py")

GIT_SSL_NO_VERIFY=true \
git clone --depth=1 \
--branch "qi-framework-v${QI_VERSION}" \
"$LIBQI_REPOSITORY_URL" \
git clone \
--branch master \
https://github.com/aldebaran/libqi.git \
/work/libqi
conan export /work/libqi --version="${QI_VERSION}"
conan export /work/libqi

# Install dependencies of libqi-python from Conan, including libqi.
#
# Build everything from sources, so that we do not reuse precompiled binaries.
# This is because the GLIBC from the manylinux images are often older than the
# ones that were used to build the precompiled binaries, which means the binaries
# cannot by executed.
conan install "$PACKAGE" --build="*"
conan install "$PACKAGE" --build="*" --profile:all default --profile:all cppstd17
2 changes: 0 additions & 2 deletions ci/conan/global.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
core:default_profile=default
core:default_build_profile=default
tools.build:skip_test=true
tools.cmake.cmaketoolchain:generator=Ninja
# Only use the build_type as a variable for the build folder name, so
Expand Down
2 changes: 2 additions & 0 deletions ci/conan/profiles/cppstd17
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
compiler.cppstd=gnu17
8 changes: 0 additions & 8 deletions ci/conan/profiles/default

This file was deleted.

13 changes: 7 additions & 6 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@
"system",
]


class QiPythonConan(ConanFile):
requires = [
"boost/[~1.78]",
"pybind11/[^2.9]",
"qi/4.0.2",
"boost/[~1.83]",
"pybind11/[^2.11]",
"qi/[~4]",
]

test_requires = [
Expand All @@ -77,9 +78,9 @@ class QiPythonConan(ConanFile):
# Disable every components of Boost unless we actively use them.
default_options.update(
{
f"boost/*:without_{_name}": False
if _name in USED_BOOST_COMPONENTS
else True
f"boost/*:without_{_name}": (
False if _name in USED_BOOST_COMPONENTS else True
)
for _name in BOOST_COMPONENTS
}
)
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "scikit_build_core.build"
[project]
name = "qi"
description = "LibQi Python bindings"
version = "3.1.4"
version = "3.1.5"
readme = "README.rst"
requires-python = ">=3.7"
license = { "file" = "COPYING" }
Expand Down Expand Up @@ -60,10 +60,7 @@ BUILD_TESTING = "OFF"
build = "cp*manylinux*x86_64"
build-frontend = "build"

environment-pass = ["LIBQI_REPOSITORY_URL"]

[tool.cibuildwheel.linux]
manylinux-x86_64-image = "manylinux2014"
before-all = ["ci/cibuildwheel_linux_before_all.sh {package}"]

[tool.cibuildwheel.linux.config-settings]
Expand Down
36 changes: 11 additions & 25 deletions src/pytypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,20 +595,13 @@ class ListInterface : public ObjectInterfaceBase<Storage, qi::ListTypeInterface>

using DefaultImpl = DefaultTypeImplMethods<Iterator, TypeByPointerPOD<Iterator>>;

void* initializeStorage(void* ptr = nullptr) override
{
return DefaultImpl::initializeStorage(ptr);
}

void* initializeStorage(void* ptr = nullptr) override { return DefaultImpl::initializeStorage(ptr); }
void* clone(void* storage) override { return DefaultImpl::clone(storage); }
void destroy(void* storage) override
{
destroyDisownedReferences(storage);
return DefaultImpl::destroy(storage);
}
void destroy(void* storage) override { return DefaultImpl::destroy(storage); }
const TypeInfo& info() override { return DefaultImpl::info(); }
void* ptrFromStorage(void** s) override { return DefaultImpl::ptrFromStorage(s); }
bool less(void* a, void* b) override { return DefaultImpl::less(a, b); }

Iterator* asIterPtr(void** storage) { return static_cast<Iterator*>(ptrFromStorage(storage)); }
Iterator& asIter(void** storage) { return *asIterPtr(storage); }
};
Expand Down Expand Up @@ -680,34 +673,27 @@ class DictInterface: public ObjectInterfaceBase<Storage, qi::MapTypeInterface>
std::advance(it, index);
const auto key = ::py::reinterpret_borrow<::py::object>(it->first);
const auto element = ::py::reinterpret_borrow<::py::object>(it->second);
const auto keyElementPair = std::make_pair(key, element);
auto ref = AnyReference::from(keyElementPair).clone();
auto keyRef = AnyReference::from(key);
auto elementRef = AnyReference::from(element);
auto pairRef = makeGenericTuple({keyRef, elementRef});
// Store the disowned reference with the list as a context instead of the
// iterator because the reference might outlive the iterator.
storeDisownedReference(dictStorage, ref);
return ref;
storeDisownedReference(dictStorage, pairRef);
return pairRef;
}

void next(void** storage) override { ++asIter(storage).second; }
bool equals(void* s1, void* s2) override { return asIter(&s1) == asIter(&s2); }

using DefaultImpl = DefaultTypeImplMethods<Iterator, TypeByPointerPOD<Iterator>>;

void* initializeStorage(void* ptr = nullptr) override
{
return DefaultImpl::initializeStorage(ptr);
}

void* initializeStorage(void* ptr = nullptr) override { return DefaultImpl::initializeStorage(ptr); }
void* clone(void* storage) override { return DefaultImpl::clone(storage); }
void destroy(void* storage) override
{
destroyDisownedReferences(storage);
return DefaultImpl::destroy(storage);
}

void destroy(void* storage) override { return DefaultImpl::destroy(storage); }
const TypeInfo& info() override { return DefaultImpl::info(); }
void* ptrFromStorage(void** s) override { return DefaultImpl::ptrFromStorage(s); }
bool less(void* a, void* b) override { return DefaultImpl::less(a, b); }

Iterator* asIterPtr(void** storage) { return static_cast<Iterator*>(ptrFromStorage(storage)); }
Iterator& asIter(void** storage) { return *asIterPtr(storage); }
};
Expand Down
26 changes: 23 additions & 3 deletions tests/test_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,20 +387,40 @@ TEST_F(TypePassing, Recursive)
}
}

TEST_F(TypePassing, ReverseList)
{
exec(
"class TestService:\n"
" def func(self, list):\n"
// Test the iterator interface.
" for value in list:\n"
" assert(isinstance(value, str))\n"
" assert(list == ['hello', 'world'])\n"
);
registerService();
const std::vector<const char*> list {"hello", "world"};
getService().call<void>("func", list);
}


TEST_F(TypePassing, ReverseDict)
{
exec(
"class TestService:\n"
" def func(self, dict):\n"
" return dict == {'one' : 1, 'two' : 2, 'three' : 3}\n"
// Test the iterator interface.
" for key, value in dict.items():\n"
" assert(isinstance(key, str))\n"
" assert(isinstance(value, int))\n"
" assert(dict == {'one' : 1, 'two' : 2, 'three' : 3})\n"
);
registerService();
const std::map<std::string, int> expected {
const std::map<std::string, int> dict {
{"one", 1},
{"two", 2},
{"three", 3},
};
EXPECT_TRUE(getService().call<bool>("func", expected));
getService().call<void>("func", dict);
}

TEST_F(TypePassing, LogLevel)
Expand Down

0 comments on commit a0ed208

Please sign in to comment.