Files
odfstudio/pyuno/Library_pyuno.mk
T
Neil Roberts 346e0f8891 tdf#171122 pyuno: Handle service constructors
This makes it so that services can be imported in Python with code like
this:

from com.sun.star.resource import StringResourceWithLocation

And then an instance of the service can be constructed using any of its
constructors as a class method like this:

res = StringResourceWithLocation.create(ctx, root_url, True, locale,
                                        dlg, '', None)

This has the advantage that the number of arguments can be checked
properly and a more useful error message can be reported if they are not
correct. Because pyuno knows what types the arguments are supposed to
be, it can also do a better job of coercing them to the right ones. For
example in the example above it is possible to pass None for an
interface argument even though that normally represents the void type.

This idea evolved out of the discussion for tdf#169229.

Change-Id: I9b542178f1c101d58dcbbd241d4ecbc9fe38bc2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199104
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2026-03-04 13:52:55 +01:00

53 lines
1.3 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,pyuno))
$(eval $(call gb_Library_set_include,pyuno,\
-I$(SRCDIR)/pyuno/source/loader \
-I$(SRCDIR)/pyuno/inc \
$$(INCLUDE) \
))
$(eval $(call gb_Library_add_defs,pyuno,\
-DLO_DLLIMPLEMENTATION_PYUNO \
))
$(eval $(call gb_Library_use_api,pyuno,\
udkapi \
))
$(eval $(call gb_Library_use_libraries,pyuno,\
cppu \
cppuhelper \
sal \
salhelper \
))
$(eval $(call gb_Library_use_externals,pyuno,\
python \
))
$(eval $(call gb_Library_add_exception_objects,pyuno,\
pyuno/source/module/pyuno_runtime \
pyuno/source/module/pyuno \
pyuno/source/module/pyuno_struct \
pyuno/source/module/pyuno_callable \
pyuno/source/module/pyuno_module \
pyuno/source/module/pyuno_type \
pyuno/source/module/pyuno_util \
pyuno/source/module/pyuno_except \
pyuno/source/module/pyuno_adapter \
pyuno/source/module/pyuno_gc \
pyuno/source/module/pyuno_iterator \
pyuno/source/module/pyuno_service_constructor \
))
# vim:set noet sw=4 ts=4: