All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tree-wide: install python libraries on Debian with appropriate option
@ 2020-04-07 11:45 Christian Göttsche
  2020-04-07 13:38 ` Ondrej Mosnacek
  2020-05-01 13:46 ` [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian Christian Göttsche
  0 siblings, 2 replies; 8+ messages in thread
From: Christian Göttsche @ 2020-04-07 11:45 UTC (permalink / raw)
  To: selinux

On Debian the `distutils` module is patched, so `get_python_lib()` returns by default `/usr/lib/python3/dist-packages` (no minor version).

But `setuptools` affecting setup.py is not patched to create the library directory at `/usr/lib/python3/dist-packages` by default, rather than a command line argument `--install-layout deb` is added.

Add this option to `python setup.py install` invocation on Debian.

See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html section B.1.

Fixes: https://github.com/SELinuxProject/selinux/issues/187

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/src/Makefile  | 2 +-
 python/sepolicy/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 2d1c654e..3efbe3aa 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -173,7 +173,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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` `grep -qxF ID=debian /etc/os-release && echo --install-layout deb`
 	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 69f29fa9..54cd27ca 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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` `grep -qxF ID=debian /etc/os-release && echo --install-layout deb`
 	[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
 	install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
 	(cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] tree-wide: install python libraries on Debian with appropriate option
  2020-04-07 11:45 [PATCH] tree-wide: install python libraries on Debian with appropriate option Christian Göttsche
@ 2020-04-07 13:38 ` Ondrej Mosnacek
  2020-05-01 13:46 ` [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian Christian Göttsche
  1 sibling, 0 replies; 8+ messages in thread
From: Ondrej Mosnacek @ 2020-04-07 13:38 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: SElinux list

On Tue, Apr 7, 2020 at 1:45 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
> On Debian the `distutils` module is patched, so `get_python_lib()` returns by default `/usr/lib/python3/dist-packages` (no minor version).
>
> But `setuptools` affecting setup.py is not patched to create the library directory at `/usr/lib/python3/dist-packages` by default, rather than a command line argument `--install-layout deb` is added.
>
> Add this option to `python setup.py install` invocation on Debian.
>
> See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html section B.1.
>
> Fixes: https://github.com/SELinuxProject/selinux/issues/187
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> ---
>  libselinux/src/Makefile  | 2 +-
>  python/sepolicy/Makefile | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 2d1c654e..3efbe3aa 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -173,7 +173,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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` `grep -qxF ID=debian /etc/os-release && echo --install-layout deb`

Wouldn't it be cleaner to instead add something like
$(PYTHON_SETUP_ARGS) and build with 'make
PYTHON_SETUP_ARGS=--install-layout=deb ...' on Debian?

>         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 69f29fa9..54cd27ca 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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` `grep -qxF ID=debian /etc/os-release && echo --install-layout deb`
>         [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
>         install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
>         (cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
> --
> 2.26.0
>

--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian
  2020-04-07 11:45 [PATCH] tree-wide: install python libraries on Debian with appropriate option Christian Göttsche
  2020-04-07 13:38 ` Ondrej Mosnacek
@ 2020-05-01 13:46 ` Christian Göttsche
  2020-05-04 13:03   ` Petr Lautrbach
  2020-05-04 17:55   ` [PATCH v3] tree-wide: introduce PYTHON_SETUP_ARGS " Christian Göttsche
  1 sibling, 2 replies; 8+ messages in thread
From: Christian Göttsche @ 2020-05-01 13:46 UTC (permalink / raw)
  To: selinux

On Debian the `distutils` module is patched, so `get_python_lib()` returns by default `/usr/lib/python3/dist-packages` (no minor version).

But `setuptools` affecting setup.py is not patched to create the library directory at `/usr/lib/python3/dist-packages` by default, rather than a command line argument `--install-layout deb` is added.

Add PYTON_SETUP_ARGS as argument to affected setup.py calls and add a note in the global ReadMe.

See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html section B.1.

Fixes: https://github.com/SELinuxProject/selinux/issues/187
---
v2:
  Use env variable PYTON_SETUP_ARGS instead of internal detection logic

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

diff --git a/README.md b/README.md
index 974280f9..3c97a5a3 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,8 @@ To build and install everything under a private directory, run:
 
     make DESTDIR=~/obj install install-pywrap
 
+Note: On Debian `PYTON_SETUP_ARGS=--install-layout=deb` needs to be set in order to create the correct python directory structure.
+
 To install as the default system libraries and binaries
 (overwriting any previously installed ones - dangerous!),
 on x86_64, run:
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 73303c36..bccc852d 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -174,7 +174,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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTON_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 69f29fa9..4ad0d4dc 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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTON_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.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian
  2020-05-01 13:46 ` [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian Christian Göttsche
@ 2020-05-04 13:03   ` Petr Lautrbach
  2020-05-04 14:12     ` Ondrej Mosnacek
  2020-05-04 17:55   ` [PATCH v3] tree-wide: introduce PYTHON_SETUP_ARGS " Christian Göttsche
  1 sibling, 1 reply; 8+ messages in thread
From: Petr Lautrbach @ 2020-05-04 13:03 UTC (permalink / raw)
  To: Christian Göttsche; +Cc: selinux

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

On Fri, May 01, 2020 at 03:46:04PM +0200, Christian Göttsche wrote:
> On Debian the `distutils` module is patched, so `get_python_lib()` returns by default `/usr/lib/python3/dist-packages` (no minor version).
>

Could you wrap the commit message to 75 chars per line, please?

> But `setuptools` affecting setup.py is not patched to create the library directory at `/usr/lib/python3/dist-packages` by default, rather than a command line argument `--install-layout deb` is added.
> 
> Add PYTON_SETUP_ARGS as argument to affected setup.py calls and add a note in the global ReadMe.

Fix the file name - ReadMe -> README.md

>
> See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html section B.1.
> 
> Fixes: https://github.com/SELinuxProject/selinux/issues/187

Please provide Signed-off-by:

Also there's a conflicting patch which changes README.md as well -
https://patchwork.kernel.org/patch/11522349/ which I'm going to merge. Could you
please rebase this patch based on changes from the mentioned patch?

Other than the comments above, I like the patch. Thanks!


> ---
> v2:
>   Use env variable PYTON_SETUP_ARGS instead of internal detection logic
> 
>  README.md                | 2 ++
>  libselinux/src/Makefile  | 2 +-
>  python/sepolicy/Makefile | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/README.md b/README.md
> index 974280f9..3c97a5a3 100644
> --- a/README.md
> +++ b/README.md
> @@ -18,6 +18,8 @@ To build and install everything under a private directory, run:
>  
>      make DESTDIR=~/obj install install-pywrap
>  
> +Note: On Debian `PYTON_SETUP_ARGS=--install-layout=deb` needs to be set in order to create the correct python directory structure.
> +
>  To install as the default system libraries and binaries
>  (overwriting any previously installed ones - dangerous!),
>  on x86_64, run:
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 73303c36..bccc852d 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -174,7 +174,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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTON_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 69f29fa9..4ad0d4dc 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.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTON_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.26.2
> 

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian
  2020-05-04 13:03   ` Petr Lautrbach
@ 2020-05-04 14:12     ` Ondrej Mosnacek
  0 siblings, 0 replies; 8+ messages in thread
From: Ondrej Mosnacek @ 2020-05-04 14:12 UTC (permalink / raw)
  To: Petr Lautrbach; +Cc: Christian Göttsche, SElinux list

On Mon, May 4, 2020 at 3:03 PM Petr Lautrbach <plautrba@redhat.com> wrote:
> On Fri, May 01, 2020 at 03:46:04PM +0200, Christian Göttsche wrote:
> > On Debian the `distutils` module is patched, so `get_python_lib()` returns by default `/usr/lib/python3/dist-packages` (no minor version).
> >
>
> Could you wrap the commit message to 75 chars per line, please?
>
> > But `setuptools` affecting setup.py is not patched to create the library directory at `/usr/lib/python3/dist-packages` by default, rather than a command line argument `--install-layout deb` is added.
> >
> > Add PYTON_SETUP_ARGS as argument to affected setup.py calls and add a note in the global ReadMe.
>
> Fix the file name - ReadMe -> README.md
>
> >
> > See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html section B.1.
> >
> > Fixes: https://github.com/SELinuxProject/selinux/issues/187
>
> Please provide Signed-off-by:
>
> Also there's a conflicting patch which changes README.md as well -
> https://patchwork.kernel.org/patch/11522349/ which I'm going to merge. Could you
> please rebase this patch based on changes from the mentioned patch?
>
> Other than the comments above, I like the patch. Thanks!

Also, please fix the typo: s/PYTON/PYTHON/g (both in the commit
message and code/README). I only spotted it now after reading Petr's
reply :)

-- 
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3] tree-wide: introduce PYTHON_SETUP_ARGS to customize setup.py calls on Debian
  2020-05-01 13:46 ` [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian Christian Göttsche
  2020-05-04 13:03   ` Petr Lautrbach
@ 2020-05-04 17:55   ` Christian Göttsche
  2020-05-05  8:41     ` Petr Lautrbach
  1 sibling, 1 reply; 8+ messages in thread
From: Christian Göttsche @ 2020-05-04 17:55 UTC (permalink / raw)
  To: selinux

On Debian the `distutils` module is patched, so `get_python_lib()`
returns by default `/usr/lib/python3/dist-packages` (no minor version)

But `setuptools` affecting setup.py is not patched to create the library
directory at `/usr/lib/python3/dist-packages` by default, rather than a
command line argument `--install-layout deb` is added

Add PYTHON_SETUP_ARGS as argument to affected setup.py calls and add a
note in the global README.md

See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html
Section B.1

Fixes: https://github.com/SELinuxProject/selinux/issues/187

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v3:
  - Correctly spell python
  - wrap commit message

v2:
  Use env variable PYTON_SETUP_ARGS instead of internal detection logic

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

diff --git a/README.md b/README.md
index f3257ef5..9d64f0b5 100644
--- a/README.md
+++ b/README.md
@@ -95,6 +95,8 @@ 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.
+
 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 73303c36..190016e2 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -174,7 +174,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.py 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 69f29fa9..3361be4e 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.py 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.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] tree-wide: introduce PYTHON_SETUP_ARGS to customize setup.py calls on Debian
  2020-05-04 17:55   ` [PATCH v3] tree-wide: introduce PYTHON_SETUP_ARGS " Christian Göttsche
@ 2020-05-05  8:41     ` Petr Lautrbach
  2020-05-06 14:20       ` Petr Lautrbach
  0 siblings, 1 reply; 8+ messages in thread
From: Petr Lautrbach @ 2020-05-05  8:41 UTC (permalink / raw)
  To: selinux; +Cc: Christian Göttsche

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

On Mon, May 04, 2020 at 07:55:01PM +0200, Christian Göttsche wrote:
> On Debian the `distutils` module is patched, so `get_python_lib()`
> returns by default `/usr/lib/python3/dist-packages` (no minor version)
> 
> But `setuptools` affecting setup.py is not patched to create the library
> directory at `/usr/lib/python3/dist-packages` by default, rather than a
> command line argument `--install-layout deb` is added
> 
> Add PYTHON_SETUP_ARGS as argument to affected setup.py calls and add a
> note in the global README.md
> 
> See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html
> Section B.1
> 
> Fixes: https://github.com/SELinuxProject/selinux/issues/187
> 
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: Petr Lautrbach <plautrba@redhat.com>

Thanks!


> ---
> v3:
>   - Correctly spell python
>   - wrap commit message
> 
> v2:
>   Use env variable PYTON_SETUP_ARGS instead of internal detection logic
> 
>  README.md                | 2 ++
>  libselinux/src/Makefile  | 2 +-
>  python/sepolicy/Makefile | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/README.md b/README.md
> index f3257ef5..9d64f0b5 100644
> --- a/README.md
> +++ b/README.md
> @@ -95,6 +95,8 @@ 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.
> +
>  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 73303c36..190016e2 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -174,7 +174,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.py 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 69f29fa9..3361be4e 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.py 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.26.2
> 

-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] tree-wide: introduce PYTHON_SETUP_ARGS to customize setup.py calls on Debian
  2020-05-05  8:41     ` Petr Lautrbach
@ 2020-05-06 14:20       ` Petr Lautrbach
  0 siblings, 0 replies; 8+ messages in thread
From: Petr Lautrbach @ 2020-05-06 14:20 UTC (permalink / raw)
  To: selinux; +Cc: Christian Göttsche

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

On Tue, May 05, 2020 at 10:41:08AM +0200, Petr Lautrbach wrote:
> On Mon, May 04, 2020 at 07:55:01PM +0200, Christian Göttsche wrote:
> > On Debian the `distutils` module is patched, so `get_python_lib()`
> > returns by default `/usr/lib/python3/dist-packages` (no minor version)
> > 
> > But `setuptools` affecting setup.py is not patched to create the library
> > directory at `/usr/lib/python3/dist-packages` by default, rather than a
> > command line argument `--install-layout deb` is added
> > 
> > Add PYTHON_SETUP_ARGS as argument to affected setup.py calls and add a
> > note in the global README.md
> > 
> > See https://www.debian.org/doc/packaging-manuals/python-policy/packaging_tools.html
> > Section B.1
> > 
> > Fixes: https://github.com/SELinuxProject/selinux/issues/187
> > 
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> 
> Acked-by: Petr Lautrbach <plautrba@redhat.com>
> 
> Thanks!

Applied.

> 
> > ---
> > v3:
> >   - Correctly spell python
> >   - wrap commit message
> > 
> > v2:
> >   Use env variable PYTON_SETUP_ARGS instead of internal detection logic
> > 
> >  README.md                | 2 ++
> >  libselinux/src/Makefile  | 2 +-
> >  python/sepolicy/Makefile | 2 +-
> >  3 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/README.md b/README.md
> > index f3257ef5..9d64f0b5 100644
> > --- a/README.md
> > +++ b/README.md
> > @@ -95,6 +95,8 @@ 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.
> > +
> >  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 73303c36..190016e2 100644
> > --- a/libselinux/src/Makefile
> > +++ b/libselinux/src/Makefile
> > @@ -174,7 +174,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.py 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 69f29fa9..3361be4e 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.py 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.26.2
> > 
> 
> -- 
> ()  ascii ribbon campaign - against html e-mail 
> /\  www.asciiribbon.org   - against proprietary attachments



-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-06 14:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 11:45 [PATCH] tree-wide: install python libraries on Debian with appropriate option Christian Göttsche
2020-04-07 13:38 ` Ondrej Mosnacek
2020-05-01 13:46 ` [PATCH v2] tree-wide: introduce PYTON_SETUP_ARGS to customize setup.py calls on Debian Christian Göttsche
2020-05-04 13:03   ` Petr Lautrbach
2020-05-04 14:12     ` Ondrej Mosnacek
2020-05-04 17:55   ` [PATCH v3] tree-wide: introduce PYTHON_SETUP_ARGS " Christian Göttsche
2020-05-05  8:41     ` Petr Lautrbach
2020-05-06 14:20       ` Petr Lautrbach

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.