Browse Source

python: expose the BUILD_DEPRECATED constants as well.

Ugh, I thought I would never need them but then there are plugin
features depending on this and it's A MESS.
next
Vladimír Vondruš 3 years ago
parent
commit
c78cc3fd13
  1. 8
      doc/python/conf.py
  2. 1
      doc/python/corrade.rst
  3. 1
      doc/python/magnum.rst
  4. 4
      doc/python/pages/changelog.rst
  5. 7
      src/python/corrade/corrade.cpp
  6. 7
      src/python/magnum/magnum.cpp

8
doc/python/conf.py

@ -24,13 +24,14 @@ import magnum.trade
# So the doc see everything # So the doc see everything
# TODO: use just +=, m.css should reorder this on its own # TODO: use just +=, m.css should reorder this on its own
corrade.__all__ = ['containers', 'pluginmanager', 'BUILD_STATIC', 'BUILD_MULTITHREADED', 'TARGET_UNIX', 'TARGET_APPLE', 'TARGET_IOS', 'TARGET_IOS_SIMULATOR', 'TARGET_WINDOWS', 'TARGET_WINDOWS_RT', 'TARGET_EMSCRIPTEN', 'TARGET_ANDROID'] corrade.__all__ = ['containers', 'pluginmanager', 'BUILD_DEPRECATED', 'BUILD_STATIC', 'BUILD_MULTITHREADED', 'TARGET_UNIX', 'TARGET_APPLE', 'TARGET_IOS', 'TARGET_IOS_SIMULATOR', 'TARGET_WINDOWS', 'TARGET_WINDOWS_RT', 'TARGET_EMSCRIPTEN', 'TARGET_ANDROID']
magnum.__all__ = ['math', 'gl', 'meshtools', 'platform', 'primitives', 'shaders', 'scenegraph', 'text', 'trade', 'BUILD_STATIC', 'TARGET_GL', 'TARGET_GLES', 'TARGET_GLES2', 'TARGET_WEBGL', 'TARGET_EGL', 'TARGET_VK'] + magnum.__all__ magnum.__all__ = ['math', 'gl', 'meshtools', 'platform', 'primitives', 'shaders', 'scenegraph', 'text', 'trade', 'BUILD_DEPRECATED', 'BUILD_STATIC', 'TARGET_GL', 'TARGET_GLES', 'TARGET_GLES2', 'TARGET_WEBGL', 'TARGET_EGL', 'TARGET_VK'] + magnum.__all__
# hide values of the preprocessor defines to avoid confusion by assigning a # hide values of the preprocessor defines to avoid confusion by assigning a
# class without __repr__ to them # class without __repr__ to them
# TODO: more systematic solution directly in m.css # TODO: more systematic solution directly in m.css
class DoNotPrintValue: pass class DoNotPrintValue: pass
corrade.BUILD_DEPRECATED = DoNotPrintValue()
corrade.BUILD_STATIC = DoNotPrintValue() corrade.BUILD_STATIC = DoNotPrintValue()
corrade.BUILD_MULTITHREADED = DoNotPrintValue() corrade.BUILD_MULTITHREADED = DoNotPrintValue()
corrade.TARGET_UNIX = DoNotPrintValue() corrade.TARGET_UNIX = DoNotPrintValue()
@ -41,6 +42,7 @@ corrade.TARGET_WINDOWS = DoNotPrintValue()
corrade.TARGET_WINDOWS_RT = DoNotPrintValue() corrade.TARGET_WINDOWS_RT = DoNotPrintValue()
corrade.TARGET_EMSCRIPTEN = DoNotPrintValue() corrade.TARGET_EMSCRIPTEN = DoNotPrintValue()
corrade.TARGET_ANDROID = DoNotPrintValue() corrade.TARGET_ANDROID = DoNotPrintValue()
magnum.BUILD_DEPRECATED = DoNotPrintValue()
magnum.BUILD_STATIC = DoNotPrintValue() magnum.BUILD_STATIC = DoNotPrintValue()
magnum.TARGET_GL = DoNotPrintValue() magnum.TARGET_GL = DoNotPrintValue()
magnum.TARGET_GLES = DoNotPrintValue() magnum.TARGET_GLES = DoNotPrintValue()
@ -51,6 +53,7 @@ magnum.TARGET_VK = DoNotPrintValue()
# TODO ugh... can this be expressed directly in pybind? # TODO ugh... can this be expressed directly in pybind?
corrade.__annotations__ = { corrade.__annotations__ = {
'BUILD_DEPRECATED': bool,
'BUILD_STATIC': bool, 'BUILD_STATIC': bool,
'BUILD_MULTITHREADED': bool, 'BUILD_MULTITHREADED': bool,
'TARGET_UNIX': bool, 'TARGET_UNIX': bool,
@ -63,6 +66,7 @@ corrade.__annotations__ = {
'TARGET_ANDROID': bool 'TARGET_ANDROID': bool
} }
magnum.__annotations__ = { magnum.__annotations__ = {
'BUILD_DEPRECATED': bool,
'BUILD_STATIC': bool, 'BUILD_STATIC': bool,
'TARGET_GL': bool, 'TARGET_GL': bool,
'TARGET_GLES': bool, 'TARGET_GLES': bool,

1
doc/python/corrade.rst

@ -36,6 +36,7 @@
>>> from corrade import * >>> from corrade import *
.. py:module:: corrade .. py:module:: corrade
:data BUILD_DEPRECATED: Build with deprecated features enabled
:data BUILD_STATIC: Static library build :data BUILD_STATIC: Static library build
:data BUILD_MULTITHREADED: Multi-threaded build :data BUILD_MULTITHREADED: Multi-threaded build
:data TARGET_UNIX: Unix target :data TARGET_UNIX: Unix target

1
doc/python/magnum.rst

@ -29,6 +29,7 @@
>>> from magnum import * >>> from magnum import *
.. py:module:: magnum .. py:module:: magnum
:data BUILD_DEPRECATED: Build with deprecated features enabled
:data BUILD_STATIC: Static library build :data BUILD_STATIC: Static library build
:data TARGET_GL: OpenGL interoperability :data TARGET_GL: OpenGL interoperability
:data TARGET_GLES: OpenGL ES target :data TARGET_GLES: OpenGL ES target

4
doc/python/pages/changelog.rst

@ -35,6 +35,10 @@ Changelog
`Changes since 2020.06`_ `Changes since 2020.06`_
======================== ========================
- Exposed the :ref:`corrade.BUILD_DEPRECATED` and
:ref:`magnum.BUILD_DEPRECATED` constants, as some features may work
differently depending on these being enabled or not and it's useful to be
able to query this
- Exposed missing :ref:`Vector4` constructor from a :ref:`Vector3` and a - Exposed missing :ref:`Vector4` constructor from a :ref:`Vector3` and a
W component and :ref:`Vector3` from :ref:`Vector2` and a Z component W component and :ref:`Vector3` from :ref:`Vector2` and a Z component
- Renamed :py:`Matrix3.from()` / :py:`Matrix4.from()` to :ref:`Matrix3.from_()` - Renamed :py:`Matrix3.from()` / :py:`Matrix4.from()` to :ref:`Matrix3.from_()`

7
src/python/corrade/corrade.cpp

@ -39,6 +39,13 @@ namespace py = pybind11;
extern "C" PYBIND11_EXPORT PyObject* PyInit__corrade(); extern "C" PYBIND11_EXPORT PyObject* PyInit__corrade();
PYBIND11_MODULE(_corrade, m) { PYBIND11_MODULE(_corrade, m) {
m.doc() = "Root Corrade module"; m.doc() = "Root Corrade module";
m.attr("BUILD_DEPRECATED") =
#ifdef CORRADE_BUILD_DEPRECATED
true
#else
false
#endif
;
m.attr("BUILD_STATIC") = m.attr("BUILD_STATIC") =
#ifdef CORRADE_BUILD_STATIC #ifdef CORRADE_BUILD_STATIC
true true

7
src/python/magnum/magnum.cpp

@ -156,6 +156,13 @@ template<class T> void imageViewFromMutable(py::class_<T, PyImageViewHolder<T>>&
} }
void magnum(py::module_& m) { void magnum(py::module_& m) {
m.attr("BUILD_DEPRECATED") =
#ifdef MAGNUM_BUILD_DEPRECATED
true
#else
false
#endif
;
m.attr("BUILD_STATIC") = m.attr("BUILD_STATIC") =
#ifdef MAGNUM_BUILD_STATIC #ifdef MAGNUM_BUILD_STATIC
true true

Loading…
Cancel
Save