sysconfig is available since Python 3.2
Tested on nixpkgs and works as expected
### Rationale for this change
Support Python 3.12
### What changes are included in this PR?
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* GitHub Issue: #40566
Authored-by: Sandro <sandro.jaeckel@gmail.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
### Rationale for this change
We need to support Ubuntu 20.04 (CMake 3.16) or later, CentOS 7 (CMake 3.17) or later, and Debian GNU/Linux bullseye (CMake 3.18) or later.
So we can require CMake 3.16 or later.
### What changes are included in this PR?
Require CMake 3.16 or later.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
Yes.
* Closes: #34921
Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
ARROW-9171 and ARROW-17231 are also fixed.
Our CMake packages are broken. For example, `find_package(Parquet)`
doesn't work without specifying `CMAKE_MODULE_PATH`.
`find_package(${PACKAGE})` searches
`${PREFIX}/${PACKAGE}/${PACKAGE}Config.cmake` or
`${PREFIX}/${PACKAGE}/Find${PACKAGE}.cmake`. But our .cmake files are
always installed `${PREFIX}/arrow/`. So `find_package(Parquet)` can't find
`${PREFIX}/arrow/FindParquet.cmake` because "`/arrow/`" isn't
"`/${PACKAGE}`".
This change fixes this by installing `${PACKAGE}Config.cmake` to
`${PREFIX}/${PACKAGE}/` instead of `${PREFIX}/arrow/`.
This also removes all `Find${PACKAGE}.cmake`. We only provides
`${PACKAGE}Config.cmake`. Our `Find${PACKAGE}.cmake` can find `${PACKAGE}`
by CMake, pkg-config or manual .so/.h search. But we don't need to
support pkg-config nor manual .so/.h search. We can use
`${PACKAGE}Config.cmake` to support CMake package search. So this
removes all `Find${PACKAGE}.cmake`.
This also introduces namespace to our CMake targets. For example,
`arrow_shared` is exported as `Arrow::arrow_shared` and
`parquet_static` is exported as `Parquet::parquet_static`. But no
namespace targets such as `arrow_shared` and `parquet_static` are
still also exported for keeping backward compatibility. But this
requires CMake 3.18 or later for users because `add_library(ALIAS)`
for non-global `IMPORTED` library is available since CMake 3.18.
(`Plasma::plasma-store-server` target is also added for
`plasma-store-server` executable.)
FYI: We can resolve this problem by using `COMPONENTS` feature of
`find_package()`. For example, `find_package(Arrow COMPONENTS
Parquet)` is used instead of `find_package(Parquet)`. With
`COMPONENTS`, `${PACKAGE}` is always "Arrow". So we can still install
our .cmake files to `${PREFIX}/arrow/`. But this approach breaks
backward compatibility. So I choose `${PREFIX}/${PACKAGE}/*.cmake`
approach.
Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
- [x] bump cmake-format's version to the latest one
- [x] port `run-cmake-format.py` script to archery
- [x] support `archery lint --cmake-format` format checks without reformatting the files in-place
- [x] support `archery lint --cmake-format --fix` for actually reformat the files
- [x] reformat the cmake files
I assume we may need tune the options a little bit, so feel free to experiment with the values defined in `cmake-format.py` then re-run `archery-lint --cmake-format --fix`.
The `cmakelang` package also provides a `cmake-lint` command which we could experiment with in the future.
Closes#10571 from kszucs/update-cmake-format
Authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Use the new FindPython3 package if available.
Closes#6498 from pitrou/ARROW-7917-find-python3 and squashes the following commits:
f45b7f7db <Antoine Pitrou> Use distutils.sysconfig
dfc8201cf <Antoine Pitrou> Apply review comments
b3c01ebe1 <Antoine Pitrou> Ensure we use the first Python on PATH
7395f83af <Antoine Pitrou> ARROW-7917: Find Python 3 in CMake configuration
Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>