Dear maintainer,

I've prepared an NMU for battery-stats (versioned as 0.5.6-1.1). The diff
is attached to this message.

cu
Adrian
diff -Nru battery-stats-0.5.6/debian/changelog battery-stats-0.5.6/debian/changelog
--- battery-stats-0.5.6/debian/changelog	2016-11-17 12:51:51.000000000 +0200
+++ battery-stats-0.5.6/debian/changelog	2021-02-07 13:21:35.000000000 +0200
@@ -1,3 +1,11 @@
+battery-stats (0.5.6-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Apply patch from Birger Schacht switching to Python 3.
+    (Closes: #936187)
+
+ -- Adrian Bunk <[email protected]>  Sun, 07 Feb 2021 13:21:35 +0200
+
 battery-stats (0.5.6-1) unstable; urgency=medium
 
   * New upstream version 0.5.6.
diff -Nru battery-stats-0.5.6/debian/control battery-stats-0.5.6/debian/control
--- battery-stats-0.5.6/debian/control	2016-05-22 11:49:13.000000000 +0300
+++ battery-stats-0.5.6/debian/control	2021-02-07 13:21:27.000000000 +0200
@@ -5,26 +5,25 @@
 Build-Depends:
  debhelper (>= 9),
  cmake,
- python | python-all | python-dev | python-all-dev,
+ python3 | python3-all | python3-dev | python3-all-dev,
  dh-python,
  gnuplot-nox (>= 4) | gnuplot-qt,
- python-matplotlib,
+ python3-matplotlib,
  libtext-csv-perl,
  imagemagick
 Standards-Version: 3.9.8
 Homepage: https://github.com/petterreinholdtsen/battery-stats/
 Vcs-Browser: https://anonscm.debian.org/gitweb/?p=collab-maint/battery-stats.git
 Vcs-Git: https://anonscm.debian.org/git/collab-maint/battery-stats.git
-X-Python-Version: >= 2.5
 
 Package: battery-stats
 Architecture: linux-any
 Depends: ${shlibs:Depends}, ${misc:Depends},
  logrotate,
  gzip (>= 1.3.2)
-Recommends: ${python:Depends},
- python,
- python-matplotlib,
+Recommends: ${python3:Depends},
+ python3,
+ python3-matplotlib,
  libtext-csv-perl,
  gnuplot (>= 4.0.0)
 Description: collects statistics about charge of laptop batteries
diff -Nru battery-stats-0.5.6/debian/patches/0001-Update-to-python3.patch battery-stats-0.5.6/debian/patches/0001-Update-to-python3.patch
--- battery-stats-0.5.6/debian/patches/0001-Update-to-python3.patch	1970-01-01 02:00:00.000000000 +0200
+++ battery-stats-0.5.6/debian/patches/0001-Update-to-python3.patch	2021-02-07 13:21:27.000000000 +0200
@@ -0,0 +1,56 @@
+From c1de7d133a9796d1825d6cc49a53f20bdf42f87d Mon Sep 17 00:00:00 2001
+From: Birger Schacht <[email protected]>
+Date: Mon, 27 Apr 2020 14:55:22 +0200
+Subject: [PATCH] Update to python3
+
+---
+ src/battery-stats-generate | 6 +++---
+ src/battery-stats-graph    | 4 ++--
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/battery-stats-generate b/src/battery-stats-generate
+index 7eab7c5..573a88d 100755
+--- a/src/battery-stats-generate
++++ b/src/battery-stats-generate
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ 
+ import argparse
+ import itertools
+@@ -32,11 +32,11 @@ def generate(args):
+         print(','.join(fields))
+         # remove or add between 0 and 10% of the charge, half the time
+         energy_now += change_charge(args.discharge_prob,
+-                                    factor=random.randint(0, energy_full/args.discharge_rate))
++                                    factor=random.randint(0, int(energy_full/args.discharge_rate)))
+ 
+         # around one out of 3 changes to remove around 0.1% of charge
+         energy_full -= change_charge(args.damage_prob, mult = 0,
+-                                     factor=random.randint(0, energy_full/args.damage_rate))
++                                     factor=random.randint(0, int(energy_full/args.damage_rate)))
+         now += args.wait
+         if not i:
+             break
+diff --git a/src/battery-stats-graph b/src/battery-stats-graph
+index 2e651e4..8545048 100755
+--- a/src/battery-stats-graph
++++ b/src/battery-stats-graph
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ #
+ # This file is part of the battery-stats package.
+@@ -87,7 +87,7 @@ def parse_csv_builtin(fields =
+     except csv.Error as e:
+         logging.warning('CSV file is corrupt, skipping remaining entries: %s', e)
+     logging.debug('building data array')
+-    return np.array(data, dtype=zip(fields, 'f'*len(fields)))
++    return np.array(data, dtype=list(zip(fields, 'f'*len(fields))))
+ 
+ # the builtin CSV parser above is faster, we went from 8 to 2 seconds
+ # on our test data here there are probably other ways of making this
+-- 
+2.26.2
+
diff -Nru battery-stats-0.5.6/debian/patches/series battery-stats-0.5.6/debian/patches/series
--- battery-stats-0.5.6/debian/patches/series	1970-01-01 02:00:00.000000000 +0200
+++ battery-stats-0.5.6/debian/patches/series	2021-02-07 13:21:27.000000000 +0200
@@ -0,0 +1 @@
+0001-Update-to-python3.patch
diff -Nru battery-stats-0.5.6/debian/rules battery-stats-0.5.6/debian/rules
--- battery-stats-0.5.6/debian/rules	2016-03-22 10:45:13.000000000 +0200
+++ battery-stats-0.5.6/debian/rules	2021-02-07 13:21:27.000000000 +0200
@@ -1,4 +1,4 @@
 #!/usr/bin/make -f
 
 %:
-	dh $@ --with python2
+	dh $@ --with python3

Reply via email to