Here is a patch implementing the proposed split.
>From 37a9eaf8b03aebd4eb6839280aee68cbd48d68b4 Mon Sep 17 00:00:00 2001
From: Ghislain Antony Vaillant <ghisv...@gmail.com>
Date: Tue, 14 Nov 2017 09:24:42 +0000
Subject: [PATCH] Ship the modules in separate binary packages

Gbp-Dch: Short
Thanks: Matthias Klose for reporting
Closes: #879196, #880958
---
 debian/control | 50 +++++++++++++++++++++++++++++++++++++++++++-------
 debian/rules   | 18 +++++-------------
 2 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/debian/control b/debian/control
index 21120f5..facb68c 100644
--- a/debian/control
+++ b/debian/control
@@ -1,5 +1,5 @@
 Source: yapf
-Section: python
+Section: utils
 Priority: optional
 Maintainer: Ana Custura <a...@netstat.org.uk>
 Build-Depends: debhelper (>=9),dh-python,python-all,python-setuptools,python3-all,python3-setuptools
@@ -12,20 +12,56 @@ Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/yapf.git
 
 Package: yapf
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}
+Depends: ${misc:Depends},
+         ${python:Depends},
+         python-yapf
 Description: Python code formatter for different styles (Python 2)
  Yapf is a tool that reformats code to the best formatting that conforms to the
  style guide. It is not only concerned with lint errors, but also with the
  styilistic appearance of Python code. The idea is also similar to the 'gofmt'
- tool for the Go programming language. This package installs the tool for Python
- 2.
+ tool for the Go programming language.
+ .
+ This package provides the command-line interface for Python 2.
+
+Package: python-yapf
+Architecture: all
+Section: python
+Depends: ${misc:Depends},
+         ${python:Depends}
+Breaks: yapf (<< 0.17.0-2)
+Replaces: yapf (<< 0.17.0-2)
+Description: public modules for yapf (Python 2)
+ Yapf is a tool that reformats code to the best formatting that conforms to the
+ style guide. It is not only concerned with lint errors, but also with the
+ styilistic appearance of Python code. The idea is also similar to the 'gofmt'
+ tool for the Go programming language.
+ .
+ This package provides the modules for Python 2.
 
 Package: yapf3
 Architecture: all
-Depends: ${python3:Depends}, ${misc:Depends}
+Depends: ${misc:Depends},
+         ${python3:Depends},
+         python3-yapf
 Description: Python code formatter for different styles (Python 3)
  Yapf is a tool that reformats code to the best formatting that conforms to the
  style guide. It is not only concerned with lint errors, but also with the
  styilistic appearance of Python code. The idea is also similar to the 'gofmt'
- tool for the Go programming language. This package installs the tool for Python
- 3.
+ tool for the Go programming language.
+ .
+ This package provides the command-line interface for Python 3.
+
+Package: python3-yapf
+Architecture: all
+Section: python
+Depends: ${misc:Depends},
+         ${python3:Depends}
+Breaks: yapf3 (<< 0.17.0-2)
+Replaces: yapf3 (<< 0.17.0-2)
+Description: public modules for yapf (Python 3)
+ Yapf is a tool that reformats code to the best formatting that conforms to the
+ style guide. It is not only concerned with lint errors, but also with the
+ styilistic appearance of Python code. The idea is also similar to the 'gofmt'
+ tool for the Go programming language.
+ .
+ This package provides the modules for Python 3.
diff --git a/debian/rules b/debian/rules
index 420e98a..675be8c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,22 +5,14 @@
 PYVERS=$(shell pyversions -sv)
 PY3VERS=$(shell py3versions -sv)
 export PYBUILD_NAME=yapf
+export PYBUILD_DESTDIR_python2=debian/python-${PYBUILD_NAME}
+export PYBUILD_DESTDIR_python3=debian/python3-${PYBUILD_NAME}
 
 %:
 	dh $@  --with python2,python3 --buildsystem=pybuild
 
 override_dh_auto_install:
 	dh_auto_install
-
-	set -e && for pyvers in $(PYVERS); do \
-                python$$pyvers setup.py install --install-layout=deb \
-                --root $(CURDIR)/debian/yapf; \
-                done
-
-	set -e && for pyvers in $(PY3VERS); do \
-                python$$pyvers setup.py install --install-layout=deb \
-                --root $(CURDIR)/debian/yapf3; \
-                done
-
-	mv $(CURDIR)/debian/yapf3/usr/bin/yapf $(CURDIR)/debian/yapf3/usr/bin/yapf3
-
+	dh_movefiles --package=yapf --sourcedir=$(PYBUILD_DESTDIR_python2) usr/bin
+	dh_movefiles --package=yapf3 --sourcedir=$(PYBUILD_DESTDIR_python3) usr/bin
+	(cd $(CURDIR)/debian/yapf3 && mv ./usr/bin/yapf ./usr/bin/yapf3)
-- 
2.14.1

Reply via email to