diff --git a/packages/p/python-m2r/.files b/packages/p/python-m2r/.files index b79fcc40780..661f04c058d 100644 Binary files a/packages/p/python-m2r/.files and b/packages/p/python-m2r/.files differ diff --git a/packages/p/python-m2r/.rev b/packages/p/python-m2r/.rev index 8a6bec734ca..13829d2e577 100644 --- a/packages/p/python-m2r/.rev +++ b/packages/p/python-m2r/.rev @@ -23,4 +23,13 @@ 688722 + + 30b1f922a2447a8d846d91897c869eae + 0.2.1 + + dimstar_suse + - Instead of skipping the tests, the patch open-encoding.patch + fixes gh#miyakogi/m2r#52. + 756648 + diff --git a/packages/p/python-m2r/open-encoding.patch b/packages/p/python-m2r/open-encoding.patch new file mode 100644 index 00000000000..fbc0f6f4a3b --- /dev/null +++ b/packages/p/python-m2r/open-encoding.patch @@ -0,0 +1,81 @@ +--- a/tests/test_cli.py ++++ b/tests/test_cli.py +@@ -4,6 +4,7 @@ + from __future__ import print_function, unicode_literals + + import sys ++import io + import os + from os import path + from copy import copy +@@ -37,12 +38,12 @@ class TestConvert(TestCase): + options.disable_inline_math = False + self._orig_argv = copy(sys.argv) + if path.exists(test_rst): +- with open(test_rst) as f: ++ with io.open(test_rst, encoding="utf8") as f: + self._orig_rst = f.read() + + def tearDown(self): + sys.argv = self._orig_argv +- with open(test_rst, 'w') as f: ++ with io.open(test_rst, 'w', encoding="utf8") as f: + f.write(self._orig_rst) + + def test_no_file(self): +@@ -62,14 +63,14 @@ class TestConvert(TestCase): + + def test_parse_file(self): + output = parse_from_file(test_md) +- with open(test_rst) as f: ++ with io.open(test_rst, encoding="utf8") as f: + expected = f.read() + self.assertEqual(output.strip(), expected.strip()) + + def test_dryrun(self): + sys.argv = [sys.argv[0], '--dry-run', test_md] + target_file = path.join(curdir, 'test.rst') +- with open(target_file) as f: ++ with io.open(target_file, encoding="utf8") as f: + rst = f.read() + os.remove(target_file) + self.assertFalse(path.exists(target_file)) +@@ -89,24 +90,24 @@ class TestConvert(TestCase): + def test_overwrite_file(self): + sys.argv = [sys.argv[0], test_md] + target_file = path.join(curdir, 'test.rst') +- with open(target_file, 'w') as f: ++ with io.open(target_file, 'w', encoding="utf8") as f: + f.write('test') +- with open(target_file) as f: ++ with io.open(target_file, encoding="utf8") as f: + first_line = f.readline() + self.assertIn('test', first_line) + with patch(_builtin + '.input', return_value='y'): + main() + self.assertTrue(path.exists(target_file)) +- with open(target_file) as f: ++ with io.open(target_file, encoding="utf8") as f: + first_line = f.readline() + self.assertNotIn('test', first_line) + + def test_overwrite_option(self): + sys.argv = [sys.argv[0], '--overwrite', test_md] + target_file = path.join(curdir, 'test.rst') +- with open(target_file, 'w') as f: ++ with io.open(target_file, 'w', encoding="utf8") as f: + f.write('test') +- with open(target_file) as f: ++ with io.open(target_file, encoding="utf8") as f: + first_line = f.readline() + self.assertIn('test', first_line) + with patch(_builtin + '.input', return_value='y') as m_input: +@@ -115,7 +116,7 @@ class TestConvert(TestCase): + self.assertTrue(path.exists(target_file)) + self.assertFalse(m_input.called) + self.assertFalse(m_print.called) +- with open(target_file) as f: ++ with io.open(target_file, encoding="utf8") as f: + first_line = f.readline() + self.assertNotIn('test', first_line) + diff --git a/packages/p/python-m2r/python-m2r.changes b/packages/p/python-m2r/python-m2r.changes index 7fde01c7996..a79e384296c 100644 --- a/packages/p/python-m2r/python-m2r.changes +++ b/packages/p/python-m2r/python-m2r.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Fri Dec 13 00:04:10 CET 2019 - Matej Cepl + +- Instead of skipping the tests, the patch open-encoding.patch + fixes gh#miyakogi/m2r#52. + +------------------------------------------------------------------- +Tue Dec 10 21:41:04 CET 2019 - Matej Cepl + +- On Leap 15 skip tests which are failing. gh#miyakogi/m2r#52 + ------------------------------------------------------------------- Tue Mar 26 12:54:38 UTC 2019 - pgajdos@suse.com diff --git a/packages/p/python-m2r/python-m2r.spec b/packages/p/python-m2r/python-m2r.spec index 0b36205f1f1..6efed8b77b8 100644 --- a/packages/p/python-m2r/python-m2r.spec +++ b/packages/p/python-m2r/python-m2r.spec @@ -1,7 +1,7 @@ # # spec file for package python-m2r # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,13 +27,17 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/miyakogi/%{modname} Source: https://files.pythonhosted.org/packages/source/m/m2r/%{modname}-%{version}.tar.gz +Patch0: open-encoding.patch BuildRequires: %{python_module docutils} BuildRequires: %{python_module mistune} BuildRequires: %{python_module setuptools} %if %{with test} -BuildRequires: %{python_module mock} +BuildRequires: %{python_module Sphinx} +BuildRequires: %{python_module coverage} +BuildRequires: %{python_module flake8} BuildRequires: %{python_module pygments} BuildRequires: %{python_module pytest} +BuildRequires: python2-mock %endif BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -50,6 +54,8 @@ M2R converts a markdown file including reST markups to a valid reST format. %prep %setup -q -n %{modname}-%{version} +%autopatch -p1 + sed -i '/^#!.*/d' m2r.py %build @@ -58,8 +64,9 @@ sed -i '/^#!.*/d' m2r.py %install %python_install %python_clone -a %{buildroot}%{_bindir}/m2r -%python_expand %fdupes %{buildroot}%{$python_sitelib}/ -%python_expand rm -rf %{buildroot}%{$python_sitelib}/tests/ +%{python_expand %fdupes %{buildroot}%{$python_sitelib}/ +rm -rf %{buildroot}%{$python_sitelib}/tests/ +} %post %python_install_alternative m2r