Skip to contentSkip to conversation

Use `pip install` instead of `setup.py install`

RFC PATCH Superseded Petr Lautrbach 2 participants 5 messages Nov 22, 2022 – Nov 29, 2022 SELinux security module

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Use `pip install` instead of `setup.py install`

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.

---
 README.md                | 4 +++-
 libselinux/src/Makefile  | 2 +-
 python/sepolicy/Makefile | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
README.md +3 -1
index 529b7e46c871..e11b0028f4ba 100644
@@ -62,6 +62,7 @@ dnf install \
 # For Python and Ruby bindings
 dnf install \
     python3-devel \
+    python3-pip \
     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):
libselinux/src/Makefile +1 -1
index dc2848322e4d..0f6396ababa4 100644
@@ -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)
 
python/sepolicy/Makefile +1 -1
index d983e409e5e6..57a2e55edbbf 100644
@@ -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)
Signature · 1 line
2.38.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Petr Lautrbach

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.

Quoted 64 lines
---
 README.md                | 4 +++-
 libselinux/src/Makefile  | 2 +-
 python/sepolicy/Makefile | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
README.md +3 -1
index 529b7e46c871..e11b0028f4ba 100644
@@ -62,6 +62,7 @@ dnf install \
 # For Python and Ruby bindings
 dnf install \
     python3-devel \
+    python3-pip \
     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):
libselinux/src/Makefile +1 -1
index dc2848322e4d..0f6396ababa4 100644
@@ -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)
 
python/sepolicy/Makefile +1 -2
index d983e409e5e6..57a2e55edbbf 100644
@@ -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

#2 lore raw
Quoted 16 lines · James Carter
Quoted 5 lines · Petr Lautrbach

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.

Quoted 6 lines
---
 README.md                | 4 +++-
 libselinux/src/Makefile  | 2 +-
 python/sepolicy/Makefile | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
Quoted 9 lines

README.md dnf install \ · line 65

Quoted 9 lines
README.md +1 -0
index 529b7e46c871..e11b0028f4ba 100644
@@ -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.

Thanks,
Jim

Quoted 49 lines
Quoted 49 lines
README.md +2 -1
     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):
libselinux/src/Makefile +1 -1
index dc2848322e4d..0f6396ababa4 100644
@@ -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)
 
python/sepolicy/Makefile +1 -2
index d983e409e5e6..57a2e55edbbf 100644
@@ -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

#3 lore raw
Quoted 34 lines · James Carter
Quoted 16 lines · James Carter
Quoted 5 lines · Petr Lautrbach

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.

Quoted 6 lines
---
 README.md                | 4 +++-
 libselinux/src/Makefile  | 2 +-
 python/sepolicy/Makefile | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
Quoted 9 lines

README.md dnf install \ · line 65

Quoted 9 lines
README.md +1 -0
index 529b7e46c871..e11b0028f4ba 100644
@@ -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.

Quoted 9 lines

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

Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
README.md +2 -1
     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):
libselinux/src/Makefile +1 -1
index dc2848322e4d..0f6396ababa4 100644
@@ -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)
 
python/sepolicy/Makefile +1 -2
index d983e409e5e6..57a2e55edbbf 100644
@@ -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

#4 lore raw
Quoted 47 lines · Petr Lautrbach
Quoted 34 lines · James Carter
Quoted 16 lines · James Carter
Quoted 5 lines · Petr Lautrbach

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.

Quoted 6 lines
---
 README.md                | 4 +++-
 libselinux/src/Makefile  | 2 +-
 python/sepolicy/Makefile | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
Quoted 9 lines

README.md dnf install \ · line 65

Quoted 9 lines
README.md +1 -0
index 529b7e46c871..e11b0028f4ba 100644
@@ -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.

Quoted 9 lines

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.

Quoted 7 lines

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.

without python3-wheel vs with python3-wheel

@@ -152,12 +152,14 @@
./usr/lib64/python3.11
./usr/lib64/python3.11/site-packages ./usr/lib64/python3.11/site-packages/selinux
-./usr/lib64/python3.11/site-packages/selinux-3.4-py3.11.egg-info -./usr/lib64/python3.11/site-packages/selinux-3.4-py3.11.egg-info/dependency_links.txt -./usr/lib64/python3.11/site-packages/selinux-3.4-py3.11.egg-info/installed-files.txt -./usr/lib64/python3.11/site-packages/selinux-3.4-py3.11.egg-info/PKG-INFO -./usr/lib64/python3.11/site-packages/selinux-3.4-py3.11.egg-info/SOURCES.txt -./usr/lib64/python3.11/site-packages/selinux-3.4-py3.11.egg-info/top_level.txt +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info/direct_url.json +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info/INSTALLER +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info/METADATA +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info/RECORD +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info/REQUESTED +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info/top_level.txt +./usr/lib64/python3.11/site-packages/selinux-3.4.dist-info/WHEEL
./usr/lib64/python3.11/site-packages/selinux/audit2why.cpython-311-x86_64-linux-gnu.so ./usr/lib64/python3.11/site-packages/_selinux.cpython-311-x86_64-linux-gnu.so ./usr/lib64/python3.11/site-packages/selinux/__init__.py
@@ -202,12 +204,14 @@
./usr/lib/python3.11/site-packages/sepolgen/util.py ./usr/lib/python3.11/site-packages/sepolgen/yacc.py ./usr/lib/python3.11/site-packages/sepolicy
-./usr/lib/python3.11/site-packages/sepolicy-3.4-py3.11.egg-info -./usr/lib/python3.11/site-packages/sepolicy-3.4-py3.11.egg-info/dependency_links.txt -./usr/lib/python3.11/site-packages/sepolicy-3.4-py3.11.egg-info/installed-files.txt -./usr/lib/python3.11/site-packages/sepolicy-3.4-py3.11.egg-info/PKG-INFO -./usr/lib/python3.11/site-packages/sepolicy-3.4-py3.11.egg-info/SOURCES.txt -./usr/lib/python3.11/site-packages/sepolicy-3.4-py3.11.egg-info/top_level.txt +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info/direct_url.json +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info/INSTALLER +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info/METADATA +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info/RECORD +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info/REQUESTED +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info/top_level.txt +./usr/lib/python3.11/site-packages/sepolicy-3.4.dist-info/WHEEL
./usr/lib/python3.11/site-packages/sepolicy/booleans.py ./usr/lib/python3.11/site-packages/sepolicy/communicate.py ./usr/lib/python3.11/site-packages/sepolicy/generate.py

Quoted 56 lines

Thanks,

Petr

Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
README.md +2 -1
     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):
libselinux/src/Makefile +1 -1
index dc2848322e4d..0f6396ababa4 100644
@@ -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)
 
python/sepolicy/Makefile +1 -2
index d983e409e5e6..57a2e55edbbf 100644
@@ -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