From 5039b23a2a5b44aa4c0e2a6a92dee91b7a8533c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Tue, 20 Aug 2019 20:39:15 +0200
Subject: [PATCH] debian: switch to Python 3 (#35492)

---
 debian/chrono.install                         |  1 -
 debian/control                                | 31 +++++++++----------
 debian/python-chrono.dirs                     |  1 -
 debian/python-chrono.install                  |  1 -
 ...python-chrono.docs => python3-chrono.docs} |  0
 debian/rules                                  |  9 ++++--
 debian/uwsgi.ini                              |  2 +-
 7 files changed, 22 insertions(+), 23 deletions(-)
 delete mode 100644 debian/python-chrono.dirs
 delete mode 100644 debian/python-chrono.install
 rename debian/{python-chrono.docs => python3-chrono.docs} (100%)

diff --git a/debian/chrono.install b/debian/chrono.install
index cb57e7b..b703f56 100644
--- a/debian/chrono.install
+++ b/debian/chrono.install
@@ -3,4 +3,3 @@ debian/chrono-manage      /usr/bin
 debian/settings.py        /etc/chrono
 debian/uwsgi.ini          /etc/chrono
 debian/debian_config.py   /usr/lib/chrono
-usr/bin/manage.py         /usr/lib/chrono
diff --git a/debian/control b/debian/control
index c52ceb5..e81f3b5 100644
--- a/debian/control
+++ b/debian/control
@@ -2,31 +2,30 @@ Source: chrono
 Maintainer: Frederic Peters <fpters@entrouvert.com>
 Section: python
 Priority: optional
-Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), python-django, debhelper (>= 9), dh-python, dh-systemd, ruby-sass
+Build-Depends: python3-setuptools, python3-all, python3-django, debhelper (>= 9), dh-python, dh-systemd, ruby-sass
 Standards-Version: 3.9.6
-X-Python-Version: >= 2.7
 
-Package: python-chrono
+Package: python3-chrono
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends},
-    python-django (>= 1:1.11),
-    python-gadjo,
-    python-requests
-Recommends: python-django-mellon
+Depends: ${misc:Depends}, ${python3:Depends},
+    python3-django (>= 1:1.11),
+    python3-gadjo,
+    python3-requests
+Recommends: python3-django-mellon
 Description: Agendas System (Python module)
 
 Package: chrono
 Architecture: all
 Depends: ${misc:Depends},
-    python-chrono (= ${binary:Version}),
-    python-hobo,
-    python-vobject,
-    python-django-tenant-schemas,
-    python-psycopg2,
-    python-django-mellon,
-    python-dateutil,
+    python3-chrono (= ${binary:Version}),
+    python3-hobo,
+    python3-vobject,
+    python3-django-tenant-schemas,
+    python3-psycopg2,
+    python3-django-mellon,
+    python3-dateutil,
     uwsgi,
-    uwsgi-plugin-python
+    uwsgi-plugin-python3
 Recommends: nginx
 Suggests: postgresql
 Description: Agendas System
diff --git a/debian/python-chrono.dirs b/debian/python-chrono.dirs
deleted file mode 100644
index 8850597..0000000
--- a/debian/python-chrono.dirs
+++ /dev/null
@@ -1 +0,0 @@
-/usr/lib/chrono
diff --git a/debian/python-chrono.install b/debian/python-chrono.install
deleted file mode 100644
index 5fda4d4..0000000
--- a/debian/python-chrono.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/python2*/*-packages
diff --git a/debian/python-chrono.docs b/debian/python3-chrono.docs
similarity index 100%
rename from debian/python-chrono.docs
rename to debian/python3-chrono.docs
diff --git a/debian/rules b/debian/rules
index 83aef84..878341c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,8 +1,11 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+export PYBUILD_NAME=chrono
 
 %:
-	dh $@ --with python2,systemd
+	dh $@ --with python3,systemd --buildsystem=pybuild
+
+override_dh_install:
+	dh_install
+	mv $(CURDIR)/debian/python3-chrono/usr/bin/manage.py $(CURDIR)/debian/chrono/usr/lib/chrono/manage.py
diff --git a/debian/uwsgi.ini b/debian/uwsgi.ini
index ecfb5d5..cb2d937 100644
--- a/debian/uwsgi.ini
+++ b/debian/uwsgi.ini
@@ -2,7 +2,7 @@
 auto-procname = true
 procname-prefix-spaced = chrono
 
-plugin = python
+plugin = python3
 module = chrono.wsgi:application
 
 http-socket = /run/chrono/chrono.sock
-- 
2.23.0

