Bug#884343: Please switch to python3

2018-03-14 Thread Julian Wollrath
Hi,

sorry, I missed one python2 -> python3 in the debian/rules so the *.py
files did not end up in python3-gnucash. This is fixed in the attached
version of the patch.

Best regards,
Julian

-- 
 ()  ascii ribbon campaign - against html e-mail 
 /\- against proprietary attachments
>From fa851c23e1ea0b26ea7fbc9e04b6bf231a7c575c Mon Sep 17 00:00:00 2001
From: Julian Wollrath 
Date: Wed, 14 Mar 2018 10:39:58 +0100
Subject: [PATCH] Switch to Python3 (Closes: #884343)

---
 debian/control |   8 +-
 debian/patches/fix_building_with_python3.diff  | 707 +
 debian/patches/series  |   1 +
 debian/python-gnucash.examples |   1 -
 ...hon-gnucash.install => python3-gnucash.install} |   0
 ...gnucash.pyinstall => python3-gnucash.pyinstall} |   0
 debian/rules   |   5 +-
 8 files changed, 720 insertions(+), 9 deletions(-)
 create mode 100644 debian/patches/fix_building_with_python3.diff
 delete mode 100644 debian/python-gnucash.examples
 rename debian/{python-gnucash.install => python3-gnucash.install} (100%)
 rename debian/{python-gnucash.pyinstall => python3-gnucash.pyinstall} (100%)

diff --git a/debian/control b/debian/control
index a64f0413..663574f9 100644
--- a/debian/control
+++ b/debian/control
@@ -25,8 +25,8 @@ Build-Depends: debhelper (>= 11~), pkg-config, dh-python
 ,libwebkit2gtk-4.0-dev
 ,libxml2-dev
 ,libxslt1-dev
-,python
-,python-dev
+,python3
+,python3-dev
 ,texinfo
 ,xsltproc
 ,zlib1g-dev
@@ -83,10 +83,10 @@ Description: common files for the financial-accounting software Gnucash
  not be installed directly, but is pulled in automatically by the dependencies
  of the Gnucash package.
 
-Package: python-gnucash
+Package: python3-gnucash
 Section: python
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-gtk2
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}
 Description: Gnucash interface for Python
  Gnucash provides accounting functions suitable for use by small businesses and
  individuals. It can track finances in multiple accounts, keeping running and
diff --git a/debian/patches/fix_building_with_python3.diff b/debian/patches/fix_building_with_python3.diff
new file mode 100644
index ..a5774b0f
--- /dev/null
+++ b/debian/patches/fix_building_with_python3.diff
@@ -0,0 +1,707 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 370a6d15f..c85bcf23c 100644
+--- a/CMakeLists.txt
 b/CMakeLists.txt
+@@ -459,7 +459,7 @@ ENDIF (WITH_SQL)
+ # 
+ 
+ IF (WITH_PYTHON)
+-  FIND_PACKAGE(PythonInterp)
++  FIND_PACKAGE(PythonInterp 3)
+   IF (NOT PYTHONINTERP_FOUND)
+ MESSAGE(SEND_ERROR "Python support enabled, but Python interpreter not found.")
+   ENDIF()
+@@ -468,14 +468,14 @@ IF (WITH_PYTHON)
+ MESSAGE(SEND_ERROR "Found python version ${PYTHON_VERSION_STRING}, but it's too old. Need python >= 2.4.0")
+   ENDIF()
+ 
+-  FIND_PACKAGE(PythonLibs)
++  FIND_PACKAGE(PythonLibs 3)
+   IF (NOT PYTHONLIBS_FOUND)
+ MESSAGE(SEND_ERROR "Python support enabled, but Python libraries not found.")
+   ENDIF()
+ 
+   # Determine where to install the python libraries.
+   EXECUTE_PROCESS(
+-COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print sysconfig.get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}', plat_specific=True)"
++COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}', plat_specific=True))"
+ RESULT_VARIABLE PYTHON_SYSCONFIG_RESULT
+ OUTPUT_VARIABLE PYTHON_SYSCONFIG_OUTPUT
+ ERROR_VARIABLE PYTHON_SYSCONFIG_ERROR
+diff --git a/bindings/python/__init__.py b/bindings/python/__init__.py
+index 3627eac47..1c874734e 100644
+--- a/bindings/python/__init__.py
 b/bindings/python/__init__.py
+@@ -3,7 +3,7 @@
+ # >>> from gnucash import thingy
+ # instead of
+ # >>> from gnucash.gnucash_core import thingy
+-from gnucash_core import *
++from gnucash.gnucash_core import *
+ ##  @file
+ #   @brief helper file for the importing of gnucash
+ #   @author Mark Jenkins, ParIT Worker Co-operative 
+diff --git a/bindings/python/function_class.py b/bindings/python/function_class.py
+index f628667a4..db159ff83 100644
+--- a/bindings/python/function_class.py
 b/bindings/python/function_class.py
+@@ -1,5 +1,5 @@
+ # function_class.py -- Library for making python classes from a set
+-#  of functions. 
++#  of functions.
+ #
+ # Copyright (C) 2008 ParIT Worker Co-operative 
+ # This program is free software; you can redistribute it and/or
+@@ -53,7 +53,7 @@ class ClassFromFunctions(object):
+ # already exist with the same __instance value, or equivalent __instance
+ # 

Bug#884343: Please switch to python3

2018-03-14 Thread Julian Wollrath
tags 884343 patch
thank you

Hi,

attached is a patch against the package version 2.7.6-1 which switches
gnucash over to python 3.

Cheers,
Julian

-- 
 ()  ascii ribbon campaign - against html e-mail 
 /\- against proprietary attachments
>From 9c192bb9c2ae1ab161d8bef4e9efb4e8a3b05fdc Mon Sep 17 00:00:00 2001
From: Julian Wollrath 
Date: Wed, 14 Mar 2018 10:39:58 +0100
Subject: [PATCH] Switch to python3 (Closes: #884343)

---
 debian/control |   8 +-
 debian/patches/fix_building_with_python3.diff  | 707 +
 debian/patches/series  |   1 +
 ...n-gnucash.examples => python3-gnucash.examples} |   0
 ...hon-gnucash.install => python3-gnucash.install} |   0
 ...gnucash.pyinstall => python3-gnucash.pyinstall} |   0
 debian/rules   |   4 +-
 8 files changed, 721 insertions(+), 6 deletions(-)
 create mode 100644 debian/patches/fix_building_with_python3.diff
 rename debian/{python-gnucash.examples => python3-gnucash.examples} (100%)
 rename debian/{python-gnucash.install => python3-gnucash.install} (100%)
 rename debian/{python-gnucash.pyinstall => python3-gnucash.pyinstall} (100%)

diff --git a/debian/control b/debian/control
index a64f0413..663574f9 100644
--- a/debian/control
+++ b/debian/control
@@ -25,8 +25,8 @@ Build-Depends: debhelper (>= 11~), pkg-config, dh-python
 ,libwebkit2gtk-4.0-dev
 ,libxml2-dev
 ,libxslt1-dev
-,python
-,python-dev
+,python3
+,python3-dev
 ,texinfo
 ,xsltproc
 ,zlib1g-dev
@@ -83,10 +83,10 @@ Description: common files for the financial-accounting software Gnucash
  not be installed directly, but is pulled in automatically by the dependencies
  of the Gnucash package.
 
-Package: python-gnucash
+Package: python3-gnucash
 Section: python
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-gtk2
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}
 Description: Gnucash interface for Python
  Gnucash provides accounting functions suitable for use by small businesses and
  individuals. It can track finances in multiple accounts, keeping running and
diff --git a/debian/patches/fix_building_with_python3.diff b/debian/patches/fix_building_with_python3.diff
new file mode 100644
index ..a5774b0f
--- /dev/null
+++ b/debian/patches/fix_building_with_python3.diff
@@ -0,0 +1,707 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 370a6d15f..c85bcf23c 100644
+--- a/CMakeLists.txt
 b/CMakeLists.txt
+@@ -459,7 +459,7 @@ ENDIF (WITH_SQL)
+ # 
+ 
+ IF (WITH_PYTHON)
+-  FIND_PACKAGE(PythonInterp)
++  FIND_PACKAGE(PythonInterp 3)
+   IF (NOT PYTHONINTERP_FOUND)
+ MESSAGE(SEND_ERROR "Python support enabled, but Python interpreter not found.")
+   ENDIF()
+@@ -468,14 +468,14 @@ IF (WITH_PYTHON)
+ MESSAGE(SEND_ERROR "Found python version ${PYTHON_VERSION_STRING}, but it's too old. Need python >= 2.4.0")
+   ENDIF()
+ 
+-  FIND_PACKAGE(PythonLibs)
++  FIND_PACKAGE(PythonLibs 3)
+   IF (NOT PYTHONLIBS_FOUND)
+ MESSAGE(SEND_ERROR "Python support enabled, but Python libraries not found.")
+   ENDIF()
+ 
+   # Determine where to install the python libraries.
+   EXECUTE_PROCESS(
+-COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print sysconfig.get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}', plat_specific=True)"
++COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}', plat_specific=True))"
+ RESULT_VARIABLE PYTHON_SYSCONFIG_RESULT
+ OUTPUT_VARIABLE PYTHON_SYSCONFIG_OUTPUT
+ ERROR_VARIABLE PYTHON_SYSCONFIG_ERROR
+diff --git a/bindings/python/__init__.py b/bindings/python/__init__.py
+index 3627eac47..1c874734e 100644
+--- a/bindings/python/__init__.py
 b/bindings/python/__init__.py
+@@ -3,7 +3,7 @@
+ # >>> from gnucash import thingy
+ # instead of
+ # >>> from gnucash.gnucash_core import thingy
+-from gnucash_core import *
++from gnucash.gnucash_core import *
+ ##  @file
+ #   @brief helper file for the importing of gnucash
+ #   @author Mark Jenkins, ParIT Worker Co-operative 
+diff --git a/bindings/python/function_class.py b/bindings/python/function_class.py
+index f628667a4..db159ff83 100644
+--- a/bindings/python/function_class.py
 b/bindings/python/function_class.py
+@@ -1,5 +1,5 @@
+ # function_class.py -- Library for making python classes from a set
+-#  of functions. 
++#  of functions.
+ #
+ # Copyright (C) 2008 ParIT Worker Co-operative 
+ # This program is free software; you can redistribute it and/or
+@@ -53,7 +53,7 @@ class ClassFromFunctions(object):
+ # already exist with the same __instance value, or equivalent __instance
+ # values, where this is 

Bug#884343: Please switch to python3

2017-12-14 Thread Laurent Bigonville
Source: gnucash
Version: 1:2.6.18-1
Severity: normal

Hi,

With python2 being EOL in 2020 (during buster lifecycle) it would be
nice if the gnucash was switching to python3 early enough before the
buster release so things can be properly tested.

This change might break external python scripts, so it's probably a good
idea to put that in the NEWS.Debian file (and maybe in the release
notes).

Regards,

Laurent Bigonville

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

-- no debconf information