Skip to content

Commit

Permalink
Update python-m2r to rev 4 via SR 756648
Browse files Browse the repository at this point in the history
https://build.opensuse.org/request/show/756648
by user dimstar_suse
- Instead of skipping the tests, the patch open-encoding.patch
  fixes gh#miyakogi/m2r#52.
  • Loading branch information
bmwiedemann committed Dec 18, 2019
1 parent c2a70b5 commit 5e2e75a
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 4 deletions.
Binary file modified packages/p/python-m2r/.files
Binary file not shown.
9 changes: 9 additions & 0 deletions packages/p/python-m2r/.rev
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@
<comment></comment>
<requestid>688722</requestid>
</revision>
<revision rev="4" vrev="2">
<srcmd5>30b1f922a2447a8d846d91897c869eae</srcmd5>
<version>0.2.1</version>
<time>1576676638</time>
<user>dimstar_suse</user>
<comment>- Instead of skipping the tests, the patch open-encoding.patch
fixes gh#miyakogi/m2r#52.</comment>
<requestid>756648</requestid>
</revision>
</revisionlist>
81 changes: 81 additions & 0 deletions packages/p/python-m2r/open-encoding.patch
Original file line number Diff line number Diff line change
@@ -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)

11 changes: 11 additions & 0 deletions packages/p/python-m2r/python-m2r.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Dec 13 00:04:10 CET 2019 - Matej Cepl <[email protected]>

- 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 <[email protected]>

- On Leap 15 skip tests which are failing. gh#miyakogi/m2r#52

-------------------------------------------------------------------
Tue Mar 26 12:54:38 UTC 2019 - [email protected]

Expand Down
15 changes: 11 additions & 4 deletions packages/p/python-m2r/python-m2r.spec
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5e2e75a

Please sign in to comment.