All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <lautrbach@redhat.com>
To: selinux@vger.kernel.org, James Carter <jwcart2@gmail.com>
Subject: Re: [RFC PATCH] Use `pip install` instead of `setup.py install`
Date: Tue, 29 Nov 2022 17:11:21 +0100	[thread overview]
Message-ID: <87fse14u6u.fsf@redhat.com> (raw)
In-Reply-To: <CAP+JOzTzBC2mW=9mH=T2SYNpk8cXD0-MMcJjKpUeeUs9nAy=ww@mail.gmail.com>

James Carter <jwcart2@gmail.com> writes:

> On Wed, Nov 23, 2022 at 11:04 AM James Carter <jwcart2@gmail.com> wrote:
>>
>> On Tue, Nov 22, 2022 at 11:15 AM Petr Lautrbach <lautrbach@redhat.com> wrote:
>> >
>> > Fixes:
>> >     /usr/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
>> >
>> > Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
>>
>> Acked-by: James Carter <jwcart2@gmail.com>
>>
>> > ---
>> >  README.md                | 4 +++-
>> >  libselinux/src/Makefile  | 2 +-
>> >  python/sepolicy/Makefile | 2 +-
>> >  3 files changed, 5 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/README.md b/README.md
>> > index 529b7e46c871..e11b0028f4ba 100644
>> > --- a/README.md
>> > +++ b/README.md
>> > @@ -62,6 +62,7 @@ dnf install \
>> >  # For Python and Ruby bindings
>> >  dnf install \
>> >      python3-devel \
>> > +    python3-pip \
>
> So I noticed that I get the following message when building:
>   Processing /home/jim/work/selinux/python/sepolicy
>     Preparing metadata (setup.py): started
>     Preparing metadata (setup.py): finished with status 'done'
>   Using legacy 'setup.py install' for sepolicy, since package 'wheel'
> is not installed.
>
> Installing python3-wheel gives the following instead:
>   Building wheels for collected packages: sepolicy
>     Building wheel for sepolicy (setup.py): started
>     Building wheel for sepolicy (setup.py): finished with status 'done'
>
> It is not a strict dependency, but maybe we should add python3-wheel.
> Unless, of course, there is some reason we don't want to be creating
> these python wheels.
>


I don't see any reason why we wouldn't use it. Below is the diff. From
what I know, .dist-info is the new and better format for metadata. Also,
the Fedora packaging guidelines suggest using .dist-info.

I'll send another patch with python3-wheel and python3-setuptools which
is necessary.


Thanks,

Petr


>
>> >      ruby-devel \
>> >      swig
>> >  ```
>> > @@ -92,6 +93,7 @@ apt-get install --no-install-recommends --no-install-suggests \
>> >  # For Python and Ruby bindings
>> >  apt-get install --no-install-recommends --no-install-suggests \
>> >      python3-dev \
>> > +    python3-pip \
>> >      ruby-dev \
>> >      swig
>> >  ```
>> > @@ -102,7 +104,7 @@ To build and install everything under a private directory, run:
>> >
>> >      make DESTDIR=~/obj install install-rubywrap install-pywrap
>> >
>> > -On Debian `PYTHON_SETUP_ARGS=--install-layout=deb` needs to be set when installing the python wrappers in order to create the correct python directory structure.
>> > +On Debian `PYTHON_SETUP_ARGS='--install-option "--install-layout=deb"'` needs to be set when installing the python wrappers in order to create the correct python directory structure.
>> >
>> >  To run tests with the built libraries and programs, several paths (relative to `$DESTDIR`) need to be added to variables `$LD_LIBRARY_PATH`, `$PATH` and `$PYTHONPATH`.
>> >  This can be done using [./scripts/env_use_destdir](./scripts/env_use_destdir):
>> > diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
>> > index dc2848322e4d..0f6396ababa4 100644
>> > --- a/libselinux/src/Makefile
>> > +++ b/libselinux/src/Makefile
>> > @@ -187,7 +187,7 @@ install: all
>> >         ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
>> >
>> >  install-pywrap: pywrap
>> > -       $(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS)
>> > +       $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) .
>> >         install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
>> >         ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
>> >
>> > diff --git a/python/sepolicy/Makefile b/python/sepolicy/Makefile
>> > index d983e409e5e6..57a2e55edbbf 100644
>> > --- a/python/sepolicy/Makefile
>> > +++ b/python/sepolicy/Makefile
>> > @@ -27,7 +27,7 @@ test:
>> >         @$(PYTHON) test_sepolicy.py -v
>> >
>> >  install:
>> > -       $(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS)
>> > +       $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) .
>> >         [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
>> >         install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
>> >         (cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
>> > --
>> > 2.38.1
>> >


  reply	other threads:[~2022-11-29 16:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 16:11 [RFC PATCH] Use `pip install` instead of `setup.py install` Petr Lautrbach
2022-11-23 16:04 ` James Carter
2022-11-28 15:07   ` James Carter
2022-11-29 16:11     ` Petr Lautrbach [this message]
2022-11-29 16:14       ` 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=87fse14u6u.fsf@redhat.com \
    --to=lautrbach@redhat.com \
    --cc=jwcart2@gmail.com \
    --cc=selinux@vger.kernel.org \
    /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.