This PR fixes some build warnings I stumbled upon while testing the compatibility of Gamera with the upcoming Python 3.12 release.
Included fixes:
pkg_resources.parse_version is deprecated
../../../../../opt/hostedtoolcache/Python/3.12.0-alpha.7/x64/lib/python3.12/site-packages/pkg_resources/__init__.py:121
/opt/hostedtoolcache/Python/3.12.0-alpha.7/x64/lib/python3.12/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
The pkg_resources.parse_version calls have been removed completely, as docutils==0.4 and pygments==0.6 have been released in 2006. Additionally, support for lexing using SilverCity has been dropped as well, as the package had its last release in 2005: https://pypi.org/project/SilverCity/
There were multiple places where I got syntax warnings due to invalid escape sequences. This has been fixed by converting this strings to raw ones.
Comparison of integer expressions of different signedness
src/knncore/knncoremodule.cpp: In function ‘PyObject* knn_set_selections(PyObject*, PyObject*)’:
src/knncore/knncoremodule.cpp:1387:24: warning: comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
1387 | if (buffer.len != o->num_features * sizeof(int)) {
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/knncore/knncoremodule.cpp: In function ‘PyObject* knn_set_weights(PyObject*, PyObject*)’:
src/knncore/knncoremodule.cpp:1423:24: warning: comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
1423 | if (buffer.len != o->num_features * sizeof(double)) {
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There have been some length comparisons with non-matching data types, which has been corrected by applying the corresponding cast on the left-hand sides.
uint32 deprecation warnings from libtiff
/home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp: In function ‘Gamera::ImageInfo* Gamera::tiff_info(const char*)’:
/home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp:71:12: warning: ‘uint32’ is deprecated [-Wdeprecated-declarations]
71 | uint32 size;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/tiffio.h:31,
from /home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp:28,
from gamera/plugins/_tiff_support.cpp:7:
/usr/include/x86_64-linux-gnu/tiff.h:84:38: note: declared here
84 | typedef TIFF_MSC_DEPRECATED uint32_t uint32 TIFF_GCC_DEPRECATED;
| ^~~~~~
In file included from gamera/plugins/_tiff_support.cpp:7:
/home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp: In member function ‘void Gamera::{anonymous}::tiff_saver<short unsigned int>::operator()(const T&, TIFF*)’:
/home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp:259:15: warning: ‘uint32’ is deprecated [-Wdeprecated-declarations]
259 | uint32* data = (uint32 *)buf;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/tiffio.h:31,
from /home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp:28,
from gamera/plugins/_tiff_support.cpp:7:
/usr/include/x86_64-linux-gnu/tiff.h:84:38: note: declared here
84 | typedef TIFF_MSC_DEPRECATED uint32_t uint32 TIFF_GCC_DEPRECATED;
| ^~~~~~
In file included from gamera/plugins/_tiff_support.cpp:7:
/home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp:259:30: warning: ‘uint32’ is deprecated [-Wdeprecated-declarations]
259 | uint32* data = (uint32 *)buf;
| ^
In file included from /usr/include/x86_64-linux-gnu/tiffio.h:31,
from /home/runner/work/gamera-4/gamera-4/gamera/include/gamera/plugins/tiff_support.hpp:28,
from gamera/plugins/_tiff_support.cpp:7:
/usr/include/x86_64-linux-gnu/tiff.h:84:38: note: declared here
84 | typedef TIFF_MSC_DEPRECATED uint32_t uint32 TIFF_GCC_DEPRECATED;
| ^~~~~~
The multiprocessing.pool workaround for the build (instead of concurrent.futures) has been removed as it has been documented to be for some older Python 2.x releases only. As we are not supporting Python 2 any more, this is not required here.
setup.py install deprecation warning
/opt/hostedtoolcache/Python/3.12.0-alpha.7/x64/lib/python3.12/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
This PR fixes some build warnings I stumbled upon while testing the compatibility of Gamera with the upcoming Python 3.12 release.
Included fixes:
pkg_resources.parse_version
is deprecatedThe
pkg_resources.parse_version
calls have been removed completely, asdocutils==0.4
andpygments==0.6
have been released in 2006. Additionally, support for lexing usingSilverCity
has been dropped as well, as the package had its last release in 2005: https://pypi.org/project/SilverCity/Invalid escape sequences for regex expressions
There were multiple places where I got syntax warnings due to invalid escape sequences. This has been fixed by converting this strings to raw ones.
Comparison of integer expressions of different signedness
There have been some length comparisons with non-matching data types, which has been corrected by applying the corresponding cast on the left-hand sides.
uint32 deprecation warnings from libtiff
The corresponding sections have been replaced to use the
_t
type versions (standardized C99 types) as proposed in http://libtiff.maptools.org/v4.3.0.htmlDrop old multiprocessing.pool workaround
The
multiprocessing.pool
workaround for the build (instead ofconcurrent.futures
) has been removed as it has been documented to be for some older Python 2.x releases only. As we are not supporting Python 2 any more, this is not required here.setup.py install
deprecation warningStrangely enough, we have already been using
pip install .
beforehand. According to https://stackoverflow.com/questions/70970858/what-is-the-best-replacement-for-python-setup-py-install-when-cython-needs-to-be, apyproject.toml
file avoids this and thus has been implemented.