All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: Nicolas Iooss <nicolas.iooss@m4x.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>, selinux <selinux@tycho.nsa.gov>
Subject: Re: [PATCH 1/1] libselinux, libsemanage: Replace PYSITEDIR with PYTHONLIBDIR
Date: Fri, 9 Mar 2018 13:25:56 +0100	[thread overview]
Message-ID: <20180309122556.GA3849@workstation> (raw)
In-Reply-To: <CAJfZ7==qgVM0KwHdSJ2z7E4iifTx-CPjT3ikFfX4iorG6vOAXw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2795 bytes --]

On Thu, Mar 08, 2018 at 10:19:26PM +0100, Nicolas Iooss wrote:
> On Thu, Mar 8, 2018 at 8:34 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> > On 03/06/2018 04:19 PM, Stephen Smalley wrote:
> >> On 03/05/2018 05:16 PM, Nicolas Iooss wrote:
> >>> libselinux and libsemanage Makefiles invoke site.getsitepackages() in
> >>> order to get the path to the directory /usr/lib/pythonX.Y/site-packages
> >>> that matches the Python interpreter chosen with $(PYTHON). This method
> >>> is incompatible with Python virtual environments, as described in
> >>> https://github.com/pypa/virtualenv/issues/355#issuecomment-10250452 .
> >>> This issue has been opened for more than 5 years.
> >>>
> >>> On the contrary python/semanage/ and python/sepolgen/ Makefiles use
> >>> distutils.sysconfig.get_python_lib() in order to get the site-packages
> >>> path into a variable named PYTHONLIBDIR. This way of computing
> >>> PYTHONLIBDIR is compatible with virtual environments and gives the same
> >>> result as PYSITEDIR.
> >>>
> >>> As PYTHONLIBDIR works in more cases than PYSITEDIR, make libselinux and
> >>> libsemanage Makefiles use it.
> >>
> >> On Fedora x86_64, this changes the install location from /usr/lib64 to /usr/lib.
> >
> > That said I agree we ought to be consistent, and it does seem that we are not currently.
> > I'm just not sure what the best fix is in this case and the impact on distro packagers.
> 
> Good point. I have read
> https://marc.info/?l=selinux&m=151670320132614&w=2 too quickly (and
> missed "given that there's only pure python modules"). This message
> suggests that doing using get_python_lib(plat_specific=1) would keep
> /usr/lib64 on Fedora (unfortunately I only have access to Debian,
> Ubuntu and Arch Linux systems right now so I am not able to test).

On Fedora Rawhide:

>>> get_python_lib()
'/usr/lib/python3.6/site-packages'
>>> get_python_lib(plat_specific=1)
'/usr/lib64/python3.6/site-packages'
>>> get_python_lib(prefix='/usr/local')
'/usr/local/lib/python3.6/site-packages'
>>> get_python_lib(prefix='/usr/local', plat_specific=1)
'/usr/local/lib64/python3.6/site-packages'


> And
> to be consistent, I suggest naming the variable differently from
> PYTHONLIBDIR. For example:
> 
> PYTHONPLATLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig
> import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))")
> 
> ... or PYPLATLIBDIR if PYTHONPLATLIBDIR is too long. Or we also can
> keep the name PYSITEDIR while changing its definition, in order to
> minimize the impact. What would be acceptable?
>

Given that libselinux and libsemanage provides only extension SWIG generated
modules I'd just set plat_specific=1 and use PYTHONLIBDIR in this case.


> Cheers,
> Nicolas
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-03-09 12:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05 22:16 [PATCH 1/1] libselinux, libsemanage: Replace PYSITEDIR with PYTHONLIBDIR Nicolas Iooss
2018-03-06 21:19 ` Stephen Smalley
2018-03-08 19:34   ` Stephen Smalley
2018-03-08 21:19     ` Nicolas Iooss
2018-03-09 12:25       ` Petr Lautrbach [this message]
2018-03-09 13:55         ` Stephen Smalley
2018-03-09 14:39           ` Petr Lautrbach
2018-03-09 21:02             ` Petr Lautrbach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180309122556.GA3849@workstation \
    --to=plautrba@redhat.com \
    --cc=nicolas.iooss@m4x.org \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.