Bug#964609: pyxdg: Proposed solution for pyxdg test failure and ftbfs

2020-08-17 Thread Matthieu Clemenceau
Package: pyxdg
Version: 0.26-3
Followup-For: Bug #964609
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu groovy ubuntu-patch

Dear Maintainer,

While reviewing GCC10 FTBFS with ubuntu 20.10 Groovy, I worked on pyxdg failure.
After reproducing the failure in a sbuild environment I noticed that this wasn't
a ftbfs issue but more likely an issue introduced with python 3.8.4

In Python 3.8.4 rc1, Custom AST constant naming became more strict and raised 
ValueError when True, False and Node are used within a ast.Name node [1]

After some research I found a similar issue reported here [2] and inspired from
it to write a solution for pyxdg

This patch has been submitted for groovy and is in proposed. This test failure
was also blocking nose to migrate from proposed which shoudl now be able to 
migrate to groovy devel

  * Fix compatibility issue with python 3.8.4 (Closes: #964609, #968399)

Thanks for considering the patch.

Matthieu

[1] https://bugs.python.org/issue40870
[2] https://github.com/nestorsalceda/mamba/pull/151

-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-42-generic (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru pyxdg-0.26/debian/patches/python384compat.diff 
pyxdg-0.26/debian/patches/python384compat.diff
--- pyxdg-0.26/debian/patches/python384compat.diff  1969-12-31 
18:00:00.0 -0600
+++ pyxdg-0.26/debian/patches/python384compat.diff  2020-08-12 
17:41:44.0 -0500
@@ -0,0 +1,57 @@
+Description: Fix Pytyhon 3.8.4 compatibility Issue
+ Starting with Python 3.8.4 rc1, Custom AST constant naming became more strict 
+ and raised ValueError when True, False and Noe are used within a ast.Name 
node 
+ Solution inspired from https://github.com/nestorsalceda/mamba/pull/151 
+Author: Matthieu Clemenceau 
+Origin: vendor
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964609
+Last-Update: 2020-08-17
+
+--- pyxdg-0.26.orig/xdg/Menu.py
 pyxdg-0.26/xdg/Menu.py
+@@ -21,6 +21,8 @@ import os
+ import locale
+ import subprocess
+ import ast
++import sys
++
+ try:
+ import xml.etree.cElementTree as etree
+ except ImportError:
+@@ -34,6 +36,17 @@ from xdg.util import PY3
+ import xdg.Locale
+ import xdg.Config
+ 
++def _ast_const(name):
++# fixes compat issue with python 3.8.4+
++# c.f https://github.com/pytest-dev/pytest/issues/7322
++if sys.version_info >= (3, 4):
++name = ast.literal_eval(name)
++if sys.version_info >= (3, 8):
++return ast.Constant(name)
++else:
++return ast.NameConstant(name)
++else:
++return ast.Name(id=name, ctx=ast.Load())
+ 
+ def _strxfrm(s):
+ """Wrapper around locale.strxfrm that accepts unicode strings on Python 2.
+@@ -763,7 +776,8 @@ class XMLMenuBuilder(object):
+ if expr:
+ tree.body = expr
+ else:
+-tree.body = ast.Name('False', ast.Load())
++#tree.body = ast.Name('False', ast.Load())
++tree.body = _ast_const('False')
+ ast.fix_missing_locations(tree)
+ return Rule(type, tree)
+ 
+@@ -790,7 +804,7 @@ class XMLMenuBuilder(object):
+ expr = self.parse_bool_op(node, ast.Or())
+ return ast.UnaryOp(ast.Not(), expr) if expr else None
+ elif tag == 'All':
+-return ast.Name('True', ast.Load())
++return _ast_const('True')
+ elif tag == 'Category':
+ category = node.text
+ return ast.Compare(
diff -Nru pyxdg-0.26/debian/patches/series pyxdg-0.26/debian/patches/series
--- pyxdg-0.26/debian/patches/series2020-03-27 09:30:55.0 -0500
+++ pyxdg-0.26/debian/patches/series2020-08-12 17:41:44.0 -0500
@@ -2,3 +2,4 @@
 set-default-menu.patch
 gettext-support.patch
 test_mime_skip_symlink.patch
+python384compat.diff


Bug#959138: nipy: resolve nipy autopkgtest failure due to numpy testing decorators

2020-05-20 Thread Matthieu Clemenceau
Source: nipy
Followup-For: Bug #959138
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu groovy ubuntu-patch

Dear Maintainer,

While working on numpy proposed-migration for groovy, I realize nipy
autopkgtest was failing. It appears that numpy changed the pass to the
module decorators from numpy.testing.decorators to
numpy.testing._private.decorators.

In Ubuntu, the attached patch was applied allowing nipy to pass autopkg
test and migrate from groovy-proposed to groovy.

The Changelog below was added to nipy-0.4.2-3ubuntu1
  * Resolved test failure due to numpy 1:1.18.4-1. (Closes: #959138)


Thanks for considering the patch.


-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-29-generic (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Description: Fix Autopkgtest failure caused by the new numpy 1:1.18.4-1
Author: Matthieu Clemenceau 
Origin: vendor
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=959138#5
Forwarded: yes
Last-Update: 2020-05-15
--- a/nipy/algorithms/clustering/tests/test_vmm.py
+++ b/nipy/algorithms/clustering/tests/test_vmm.py
@@ -13,7 +13,7 @@
 select_vmm_cv)
 
 from nose.tools import assert_true, assert_equal
-from numpy.testing import decorators
+from numpy.testing._private import decorators
 
 from nibabel.optpkg import optional_package
 
--- a/nipy/algorithms/diagnostics/tests/test_screen.py
+++ b/nipy/algorithms/diagnostics/tests/test_screen.py
@@ -23,7 +23,8 @@
 from nose.tools import (assert_true, assert_false, assert_equal, assert_raises)
 
 from numpy.testing import (assert_array_equal, assert_array_almost_equal,
-   assert_almost_equal, decorators)
+   assert_almost_equal)
+from numpy.testing._private import decorators
 
 from nipy.testing import funcfile
 from nipy.testing.decorators import needs_mpl_agg
--- a/nipy/fixes/numpy/testing/nosetester.py
+++ b/nipy/fixes/numpy/testing/nosetester.py
@@ -21,7 +21,7 @@
 
 Examples
 
->>> from numpy.testing import nosetester
+>>> from numpy.testing._private import nosetester
 >>> nosetester.get_package_name('nonsense')
 'numpy'
 
--- a/nipy/testing/decorators.py
+++ b/nipy/testing/decorators.py
@@ -8,7 +8,7 @@
 from __future__ import print_function
 from __future__ import absolute_import
 
-from numpy.testing.decorators import *
+from numpy.testing._private.decorators import *
 
 from nipy.utils import templates, example_data, DataError
 
--- a/nipy/tests/test_scripts.py
+++ b/nipy/tests/test_scripts.py
@@ -19,7 +19,9 @@
 from nose.tools import assert_true, assert_false, assert_equal, assert_raises
 
 from ..testing import funcfile
-from numpy.testing import decorators, assert_almost_equal
+
+from numpy.testing._private import decorators
+from numpy.testing import assert_almost_equal
 
 from nipy.testing.decorators import make_label_dec