Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-26 Thread Timo Röhling

* Adrian Bunk  [2023-07-26 20:10]:

Is it really the package maintainer's responsibility to set this manually,
or should something (dh-python?) do that automatically?[1]

dh-python (more precisely, the pybuild build system for debhelper)
does it automatically. It can even be used with CMake:

export PYBUILD_SYSTEM=cmake

It does not always work (I have a package which builds
both a C++ libraries and Python modules but does weird
stuff that does not integrate well with pybuild), but if it does, it
will even take care to build for all available Python versions,
so you will get early warnings if a new Python release breaks your
package.

If you are not using pybuild, you can still be lucky because
dh_python3 will try to move packages from /usr/local to the correct
location. However, that does not work if dh_install is used to copy
Python modules from debian/tmp (e.g., python3-foo.install), because
dh_install runs earlier than dh_python3. AFAICT, that is what
typically breaks the package build.


Cheers
Timo

--
⢀⣴⠾⠻⢶⣦⠀   ╭╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling   │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄   ╰╯


signature.asc
Description: PGP signature


Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-26 Thread Adrian Bunk
On Sun, Jul 23, 2023 at 04:54:56PM +0200, Timo Röhling wrote:
> On Sun, 23 Jul 2023 15:59:19 +0200 Sebastiaan Couwenberg  
> wrote:
> > Control: tags -1 pending
> > 
> > On 7/23/23 15:26, Timo Röhling wrote:
> > > It is the package maintainer's responsibility to set
> > > DEB_PYTHON_INSTALL_LAYOUT=deb in d/rules, either implicitly through
> > > the use of pybuild, or explicitly with "export
> > > DEB_PYTHON_INSTALL_LAYOUT", as you already did in Salsa.
> > 
> > The advise for packages should be DEB_PYTHON_INSTALL_LAYOUT=deb_system
> > based on the python3 changelog as that's intended for package builds.
> You are right. "deb" also works, but "deb_system" is the canonical
> scheme name.

Is it really the package maintainer's responsibility to set this manually,
or should something (dh-python?) do that automatically?[1]

> Cheers
> Timo

cu
Adrian

[1] with cmake adding a Breaks against unfixed versions of something



Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-23 Thread Timo Röhling

On Sun, 23 Jul 2023 15:59:19 +0200 Sebastiaan Couwenberg  
wrote:

Control: tags -1 pending

On 7/23/23 15:26, Timo Röhling wrote:
> It is the package maintainer's responsibility to set
> DEB_PYTHON_INSTALL_LAYOUT=deb in d/rules, either implicitly through
> the use of pybuild, or explicitly with "export
> DEB_PYTHON_INSTALL_LAYOUT", as you already did in Salsa.

The advise for packages should be DEB_PYTHON_INSTALL_LAYOUT=deb_system 
based on the python3 changelog as that's intended for package builds.

You are right. "deb" also works, but "deb_system" is the canonical
scheme name.


Cheers
Timo


--
⢀⣴⠾⠻⢶⣦⠀   ╭╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling   │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄   ╰╯


signature.asc
Description: PGP signature


Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-23 Thread Sebastiaan Couwenberg

Control: tags -1 pending

On 7/23/23 15:26, Timo Röhling wrote:

It is the package maintainer's responsibility to set
DEB_PYTHON_INSTALL_LAYOUT=deb in d/rules, either implicitly through
the use of pybuild, or explicitly with "export
DEB_PYTHON_INSTALL_LAYOUT", as you already did in Salsa.


The advise for packages should be DEB_PYTHON_INSTALL_LAYOUT=deb_system 
based on the python3 changelog as that's intended for package builds.


Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1



Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-23 Thread Timo Röhling

Control: reassign -1 qgis 3.28.8+dfsg-1
Control: retitle -1 qgis: needs DEB_PYTHON_INSTALL_LAYOUT=deb to build


Hi Bas,

* Sebastiaan Couwenberg  [2023-07-21 17:17]:

Changes between bookworm and sid:

cmake 3.25.1:

``Python_SITELIB``
  Third-party platform independent installation directory.

  Information returned by

``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``
  or else ``sysconfig.get_path('purelib')``.
``Python_SITEARCH``
  Third-party platform dependent installation directory.

  Information returned by

``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``
  or else ``sysconfig.get_path('platlib')``.

cmake 3.27.0:

``Python_SITELIB``
  Third-party platform independent installation directory.

  Information returned by ``sysconfig.get_path('purelib')``.
``Python_SITEARCH``
  Third-party platform dependent installation directory.

  Information returned by ``sysconfig.get_path('platlib')``.

On bookworm distutils is still used which returns:

>>> distutils.sysconfig.get_python_lib(
plat_specific=False,
standard_lib=False,
)
'/usr/lib/python3/dist-packages'

On sid sysconfig is used which results:

>>> sysconfig.get_path('platlib')
'/usr/local/lib/python3.11/dist-packages'

To get the right path for the Debian python3 interpreter,
you need to add 'deb_system':

>>> sysconfig.get_path('platlib', 'deb_system')
'/usr/lib/python3/dist-packages'


After a bit of discussion in #d-python, I believe that
CMake actually behaves as intended now, and the previous behavior was
unintended.

The default use-case is a local user build, not a package build, and
the default SITELIB reflects that.

It is the package maintainer's responsibility to set
DEB_PYTHON_INSTALL_LAYOUT=deb in d/rules, either implicitly through
the use of pybuild, or explicitly with "export
DEB_PYTHON_INSTALL_LAYOUT", as you already did in Salsa.


Cheers
Timo

--
⢀⣴⠾⠻⢶⣦⠀   ╭╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling   │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄   ╰╯


signature.asc
Description: PGP signature


Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-21 Thread Brad King
On Fri, Jul 21, 2023 at 2:37 PM Brad King wrote:
> The behavior change came from this CMake merge request:
> * https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8538
> because the distutils variant is deprecated.

This is now under discussion in an upstream CMake issue:

* https://gitlab.kitware.com/cmake/cmake/-/issues/25113

Thanks,
-Brad



Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-21 Thread Brad King
On Fri, Jul 21, 2023 at 11:21 AM Sebastiaan Couwenberg wrote:
> On bookworm distutils is still used which returns:
...
> On sid sysconfig is used which results:

The behavior change came from this CMake merge request:

* https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8538

because the distutils variant is deprecated.

> To get the right path for the Debian python3 interpreter,
> you need to add 'deb_system':

With distutils a generic `plat_specific=True` option was enough
to get each platform's preferred behavior.  Does every client
of Python's sysconfig need to have a big dispatch block that
looks up the host platform and memorizes platform-specific
arguments?  A similar concern was raised here:

* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=998739#22

but never resolved.

As a side note, adding `DEB_PYTHON_INSTALL_LAYOUT=deb`
to the environment resolves this locally.

-Brad



Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-21 Thread Sebastiaan Couwenberg

Changes between bookworm and sid:

cmake 3.25.1:

 ``Python_SITELIB``
   Third-party platform independent installation directory.

   Information returned by

``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``
   or else ``sysconfig.get_path('purelib')``.
 ``Python_SITEARCH``
   Third-party platform dependent installation directory.

   Information returned by

``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``
   or else ``sysconfig.get_path('platlib')``.

cmake 3.27.0:

 ``Python_SITELIB``
   Third-party platform independent installation directory.

   Information returned by ``sysconfig.get_path('purelib')``.
 ``Python_SITEARCH``
   Third-party platform dependent installation directory.

   Information returned by ``sysconfig.get_path('platlib')``.

On bookworm distutils is still used which returns:

 >>> distutils.sysconfig.get_python_lib(
 plat_specific=False,
 standard_lib=False,
 )
 '/usr/lib/python3/dist-packages'

On sid sysconfig is used which results:

 >>> sysconfig.get_path('platlib')
 '/usr/local/lib/python3.11/dist-packages'

To get the right path for the Debian python3 interpreter,
you need to add 'deb_system':

 >>> sysconfig.get_path('platlib', 'deb_system')
 '/usr/lib/python3/dist-packages'

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1



Bug#1041633: cmake: FindPython.cmake returns /usr/local/lib/python3.11/dist-packages for Python_SITEARCH

2023-07-21 Thread Bas Couwenberg
Source: cmake
Version: 3.27.0-1
Severity: serious
Tags: upstream
Justification: makes the package in question unusable or mostly so

Dear Maintainer,

FindPython.cmake in 3.27 returns the wrong Python_SITEARCH path which breaks 
the qgis build:

 -- Python site-packages: /usr/local/lib/python3.11/dist-packages

This was:

 -- Python site-packages: /usr/lib/python3/dist-packages

Kind Regards,

Bas