Hello,

On Mon, 15 Oct 2018 13:20:48 +0000 Georg Faerber <ge...@riseup.net> wrote:
> Package: nautilus-python
> Version: 1.2.2-1
> Control: block 910491 with -1
> 
> Hi all,
> 
> As discussed on IRC:
> 
> 11:39 < georg> Hi all, thanks for the upload of nautilus-python 1.2.2-1. It 
> still builds against python2, which currently blocks #910491, as that needs 
> python3
> 11:39 -zwiebelbot:#debian-gnome- Debian#910491: mat2: Please package the 
> Nautilus extension - https://bugs.debian.org/910491
> 11:39 < georg> Any plan to build against python3 as well?
> 11:39 < georg> or in addition to, and ship python3-nautilus?
> 12:41 < jbicha> georg: python-nautilus has a lot of reverse dependencies. 
> Someone would need to test which ones work with python3 and which don't
> 12:41 < jbicha> and the package would need to be split
> 12:42 < jbicha> and it looks like there is a single pkgconfig file so that's 
> "interesting"
> 12:42 < jbicha> anyway, I'm not working on it :)
> 12:58 < georg> jbicha: thanks a lot! should we track progress in a bug 
> against nautilus-python, or is it fine as is for the time being?
> 12:59 < jbicha> please open a bug
> 13:12 < georg> jbicha: sorry, I read "anyway, I'm working on it", that's why 
> I asked.. I'll open a bug report
> 13:13 < jbicha> yeah, no one's working on it. :(
> 13:14 < jbicha> I eventually fixed bug 907591 but it wasn't precise enough :|
> 13:15 < georg> wouldn't it be possible to introduce python3-nautilus (while 
> still shipping python-nautilus), and without checking all the rdepends
> 13:15 < georg> so, leaving the rdepends as is, and new packages could depend 
> on python3-nautilus
> 13:16 < jbicha> you still have the pkgconfig issue and you still probably 
> need to split the documentation out of python-nautilus
> 13:16 < jbicha> but feel free to open a merge request if you think you have 
> something that works
> 13:17 < jbicha> https://salsa.debian.org/gnome-team/nautilus-python
> 13:17 < georg> alright
I just spent some time to get the Python 3 bindings built in the
nautilus-python package. The attached patch - also submitted as merge
request[1] - changes debian/rules in a way that to separate binary
packages are built:

* python-nautilus contains the bindings compiled for Python 2
* python3-nautilus contains the bindings compiled for Python 3

I decided to make python-nautilus and python3-nautilus conflict against
each other. Both provide the same files, but compiled against different
Python versions. I don't see an easy way to get around this conflict. At
least Archlinux seems to do the same.

For that very same reason I also didn't go the usual path to split out
documentation into a separate python-nautilus-doc package. We're only
talking about ~68K of docs/examples anyway and I don't think that
they're worth having a separate package. Especially not since
python-nautilus and python3-nautilus cannot be installed in parallel for
now.

<begging mode>
If you consider this patch sane, would you consider doing an upload
rather soon? I'd love to get python3-nautilus into the archive in time
for Stretch. I'd also be fine with doing an NMU, if you don't mind.

To give a bit more context: python3-nautilus is the last piece missing
for mat2, the sucessor of mat (metadata anonymization toolkit), to
replace its predecessor. Since there's security implications, we (some
from the pkg-privacy team) would like to get full mat2 support into Stretch.

I know that this comes rather late, but I didn't find time earlier to
work on it.
</begging mode>

Cheers
 jonas

[1] https://salsa.debian.org/gnome-team/nautilus-python/merge_requests/1
[2] https://bbs.archlinux.org/viewtopic.php?id=242380
commit 3149951efdd4f76b065b5a89ccb7697435431d0e
Author: Jonas Meurer <jo...@freesources.org>
Date:   Fri Jan 25 11:47:38 2019 +0100

    Build nautilus bindings for python3 as well
    
    * Add new package python3-nautilus

diff --git a/debian/changelog b/debian/changelog
index c48262e..45fc29f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+nautilus-python (1.2.2-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Build nautilus bindings for python3. (Closes: #911082)
+
+ -- Jonas Meurer <jo...@freesources.org>  Fri, 25 Jan 2019 12:18:42 +0100
+
 nautilus-python (1.2.2-2) unstable; urgency=medium
 
   * Add -Wl,-O1 to our LDFLAGS
diff --git a/debian/control b/debian/control
index 2efae95..7910c77 100644
--- a/debian/control
+++ b/debian/control
@@ -13,6 +13,7 @@ Build-Depends: debhelper (>= 11),
                pkg-config,
                python-dev,
                python-gi-dev,
+               python3-dev,
                libnautilus-extension-dev (>= 3.0)
 Standards-Version: 4.3.0
 Vcs-Browser: https://salsa.debian.org/gnome-team/nautilus-python
@@ -25,6 +26,23 @@ Depends: ${shlibs:Depends},
          ${python:Depends},
          python-gi (>= 3.0),
          gir1.2-nautilus-3.0
-Description: Python binding for Nautilus components
+Conflicts: python3-nautilus
+Description: Python binding for Nautilus components (Python 2 version)
  Python binding for Nautilus, to allow Nautilus property page and menu item
  extensions to be written in Python.
+ .
+ This package contains the Python 2 version of the library.
+
+Package: python3-nautilus
+Architecture: any
+Depends: ${shlibs:Depends},
+         ${misc:Depends},
+         ${python3:Depends},
+         python3-gi (>= 3.0),
+         gir1.2-nautilus-3.0
+Conflicts: python-nautilus
+Description: Python binding for Nautilus components (Python 3 version)
+ Python binding for Nautilus, to allow Nautilus property page and menu item
+ extensions to be written in Python.
+ .
+ This package contains the Python 3 version of the library.
diff --git a/debian/control.in b/debian/control.in
index 666df67..2c99c55 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -9,6 +9,7 @@ Build-Depends: debhelper (>= 11),
                pkg-config,
                python-dev,
                python-gi-dev,
+               python3-dev,
                libnautilus-extension-dev (>= 3.0)
 Standards-Version: 4.3.0
 Vcs-Browser: https://salsa.debian.org/gnome-team/nautilus-python
@@ -21,6 +22,23 @@ Depends: ${shlibs:Depends},
          ${python:Depends},
          python-gi (>= 3.0),
          gir1.2-nautilus-3.0
-Description: Python binding for Nautilus components
+Conflicts: python3-nautilus
+Description: Python binding for Nautilus components (Python 2 version)
  Python binding for Nautilus, to allow Nautilus property page and menu item
  extensions to be written in Python.
+ .
+ This package contains the Python 2 version of the library.
+
+Package: python3-nautilus
+Architecture: any
+Depends: ${shlibs:Depends},
+         ${misc:Depends},
+         ${python3:Depends},
+         python3-gi (>= 3.0),
+         gir1.2-nautilus-3.0
+Conflicts: python-nautilus
+Description: Python binding for Nautilus components (Python 3 version)
+ Python binding for Nautilus, to allow Nautilus property page and menu item
+ extensions to be written in Python.
+ .
+ This package contains the Python 3 version of the library.
diff --git a/debian/dirs b/debian/python-nautilus.dirs
similarity index 100%
rename from debian/dirs
rename to debian/python-nautilus.dirs
diff --git a/debian/docs b/debian/python-nautilus.docs
similarity index 100%
rename from debian/docs
rename to debian/python-nautilus.docs
diff --git a/debian/lintian-overrides b/debian/python-nautilus.lintian-overrides
similarity index 100%
rename from debian/lintian-overrides
rename to debian/python-nautilus.lintian-overrides
diff --git a/debian/python3-nautilus.dirs b/debian/python3-nautilus.dirs
new file mode 100644
index 0000000..2383610
--- /dev/null
+++ b/debian/python3-nautilus.dirs
@@ -0,0 +1 @@
+usr/share/nautilus-python/extensions
diff --git a/debian/python3-nautilus.docs b/debian/python3-nautilus.docs
new file mode 100644
index 0000000..6f83607
--- /dev/null
+++ b/debian/python3-nautilus.docs
@@ -0,0 +1,3 @@
+AUTHORS
+NEWS
+README
diff --git a/debian/python3-nautilus.lintian-overrides b/debian/python3-nautilus.lintian-overrides
new file mode 100644
index 0000000..7b95d59
--- /dev/null
+++ b/debian/python3-nautilus.lintian-overrides
@@ -0,0 +1,2 @@
+# System-wide directory where extensions must be added
+python3-nautilus: package-contains-empty-directory usr/share/nautilus-python/extensions/
diff --git a/debian/rules b/debian/rules
index 4ef0ecb..e8ddfdf 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,7 +4,35 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,--as-needed
 
 %:
-	dh $@ --with gnome,python2
+	dh $@ --with gnome,python2,python3
+
+override_dh_auto_configure:
+	# configure for Python 2
+	PYTHON_VERSION="$(shell pyversions -vd)" PYTHON="$(shell pyversions -d)" \
+		dh_auto_configure --builddirectory=debian/python-nautilus-build
+	# configure for Python 3
+	PYTHON_VERSION="$(shell py3versions -vd)" PYTHON="$(shell py3versions -d)" \
+		dh_auto_configure --builddirectory=debian/python3-nautilus-build
+
+override_dh_auto_build:
+	# build for Python 2
+	PYTHON_VERSION="$(shell pyversions -vd)" PYTHON="$(shell pyversions -d)" \
+		dh_auto_build --builddirectory=debian/python-nautilus-build
+	# build for Python 3
+	PYTHON_VERSION="$(shell py3versions -vd)" PYTHON="$(shell py3versions -d)" \
+		dh_auto_build --builddirectory=debian/python3-nautilus-build
+
+override_dh_auto_install:
+	# install for Python 2
+	dh_auto_install --destdir="$(CURDIR)/debian/python-nautilus" --builddirectory=debian/python-nautilus-build
+	# install for Python 3
+	dh_auto_install --destdir="$(CURDIR)/debian/python3-nautilus" --builddirectory=debian/python3-nautilus-build
+
+override_dh_python2:
+	dh_python2 -p python-nautilus
+
+override_dh_python3:
+	dh_python3 -p python3-nautilus
 
 override_dh_gnome:
 	dh_gnome --no-gnome-versions
@@ -13,9 +41,11 @@ override_dh_install:
 	dh_install
 	rm -rf debian/python-nautilus/usr/share/doc/nautilus-python/
 	rm -f debian/python-nautilus/usr/lib/*/nautilus/extensions-3.0/*.la
+	rm -f debian/python3-nautilus/usr/lib/*/nautilus/extensions-3.0/*.la
 
 override_dh_installexamples:
-	dh_installexamples examples/*.py examples/README
+	dh_installexamples -A examples/*.py examples/README
 
 override_dh_makeshlibs:
 	dh_makeshlibs -ppython-nautilus --no-act
+	dh_makeshlibs -ppython3-nautilus --no-act

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to