D15070: Bindings: Query the install directory from python

Stefan BrĂ¼ns noreply at phabricator.kde.org
Sat Sep 1 01:15:10 BST 2018


bruns added a comment.


  In D15070#318493 <https://phabricator.kde.org/D15070#318493>, @bcooksley wrote:
  
  > We could, however that would not help people installing it as a regular user, rather than as root.
  >  If I run this right now, as an unprivileged user, I get the following path returned:
  >
  >   >>> sysconfig.get_python_lib( plat_specific=True,standard_lib=False )
  >    '/usr/lib/python2.7/dist-packages'
  
  
  `cmake -DGPB_PYTHON2_SITEARCH=/foo/bar/` ...
  `cmake -DGPB_PYTHON2_SITEARCH=~/.local/lib/python2.7/site-packages/` ...
  `cmake -DGPB_PYTHON2_SITEARCH=~/kf5-python-test1234/` ...
  
  > This will break installation for those doing development installations.
  > 
  > If instead the code were to take CMAKE_INSTALL_PREFIX into account (which it should) then we get a valid result:
  > 
  >   >>> sysconfig.get_python_lib( plat_specific=True,standard_lib=False, prefix="/some/path" )
  
  Prefix is part of the python installation. If you local python installation is in /usr/local/lib, prefix is that, same if you use e.g. /opt/mypython/ for your python installation.
  
  > Note: i'm aware of ~/.local/ and virtualenv's, however those not working on Python bindings may just prefer to set PYTHONPATH much like they already set PATH - especially if they have multiple installations they switch between (different Frameworks versions for instance).
  >  '/some/path/lib/python2.7/site-packages'```
  
  if your python is installed below `/some/path`, prefix should be `/some/path` already.
  
  > Note that it's up to the user to set PYTHONPATH properly if they're installing outside the usual directories searched by Python.
  
  And why isn't it up to the user to set GPB_PYTHON2_SITEARCH when installing out of the usual directories?

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D15070

To: bruns, #frameworks
Cc: bcooksley, kde-frameworks-devel, kde-buildsystem, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-buildsystem/attachments/20180901/205c27dd/attachment-0001.html>


More information about the Kde-buildsystem mailing list