14
0

- Add patch to build with python 3.7:

* python37.patch

- Update to 1.2.1:
  *  Added directory support via @dhruvsomani in #48. Fixes #38

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-restructuredtext_lint?expand=0&rev=5
This commit is contained in:
Tomáš Chvátal
2019-01-02 12:05:25 +00:00
committed by Git OBS Bridge
parent a0683400ed
commit 2c0ba80c86
5 changed files with 97 additions and 7 deletions

View File

@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Wed Jan 2 12:00:58 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to build with python 3.7:
* python37.patch
-------------------------------------------------------------------
Wed Jan 2 11:54:41 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.2.1:
* Added directory support via @dhruvsomani in #48. Fixes #38
-------------------------------------------------------------------
Tue Dec 4 12:53:51 UTC 2018 - Matej Cepl <mcepl@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-restructuredtext_lint
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,20 +18,20 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-restructuredtext_lint
Version: 1.1.3
Version: 1.2.1
Release: 0
Summary: Linter for reStructuredText
License: Unlicense
Group: Development/Languages/Python
Url: https://github.com/twolfson/restructuredtext-lint
Source: https://files.pythonhosted.org/packages/source/r/restructuredtext_lint/restructuredtext_lint-%{version}.tar.gz
Patch0: python37.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module docutils >= 0.11}
BuildRequires: %{python_module nose}
# /SECTION
Requires: python-PyYAML
Requires: python-docutils >= 0.11
@@ -48,6 +48,7 @@ in junction with a Sublime Text linter.
%prep
%setup -q -n restructuredtext_lint-%{version}
%patch0 -p1
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
%build
@@ -59,7 +60,7 @@ find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
%check
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib}
$python -B -m nose
$python -m unittest discover
}
%files %{python_files}

77
python37.patch Normal file
View File

@@ -0,0 +1,77 @@
Index: restructuredtext_lint-1.2.1/restructuredtext_lint/test/test.py
===================================================================
--- restructuredtext_lint-1.2.1.orig/restructuredtext_lint/test/test.py
+++ restructuredtext_lint-1.2.1/restructuredtext_lint/test/test.py
@@ -11,12 +11,12 @@ import yaml
import restructuredtext_lint
-__dir__ = os.path.dirname(os.path.abspath(__file__))
-valid_rst = os.path.join(__dir__, 'test_files', 'valid.rst')
-warning_rst = os.path.join(__dir__, 'test_files', 'second_short_heading.rst')
-dir_rst = os.path.join(__dir__, 'test_files', 'dir')
-invalid_rst = os.path.join(__dir__, 'test_files', 'invalid.rst')
-rst_lint_path = os.path.join(__dir__, os.pardir, 'cli.py')
+_dir = os.path.dirname(os.path.abspath(__file__))
+valid_rst = os.path.join(_dir, 'test_files', 'valid.rst')
+warning_rst = os.path.join(_dir, 'test_files', 'second_short_heading.rst')
+dir_rst = os.path.join(_dir, 'test_files', 'dir')
+invalid_rst = os.path.join(_dir, 'test_files', 'invalid.rst')
+rst_lint_path = os.path.join(_dir, os.pardir, 'cli.py')
"""
# TODO: Implement this as a class (options) with a sugar function that lints a string against a set of options
@@ -51,7 +51,7 @@ class TestRestructuredtextLint(TestCase)
actual_errors = self._lint_file(content, invalid_rst)
# Load in expected errors
- expected_yaml = self._load_file(os.path.join(__dir__, 'test_files', 'invalid.yaml'))
+ expected_yaml = self._load_file(os.path.join(_dir, 'test_files', 'invalid.yaml'))
expected_errors = yaml.load(expected_yaml)
# Assert errors against expected errors
@@ -65,7 +65,7 @@ class TestRestructuredtextLint(TestCase)
def test_encoding_utf8(self):
"""A document with utf-8 characters is valid."""
- filepath = os.path.join(__dir__, 'test_files', 'utf8.rst')
+ filepath = os.path.join(_dir, 'test_files', 'utf8.rst')
errors = restructuredtext_lint.lint_file(filepath, encoding='utf-8')
self.assertEqual(errors, [])
@@ -74,7 +74,7 @@ class TestRestructuredtextLint(TestCase)
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/5
"""
- filepath = os.path.join(__dir__, 'test_files', 'second_short_heading.rst')
+ filepath = os.path.join(_dir, 'test_files', 'second_short_heading.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertEqual(errors[0].line, 6)
self.assertEqual(errors[0].source, filepath)
@@ -84,7 +84,7 @@ class TestRestructuredtextLint(TestCase)
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/6
"""
- filepath = os.path.join(__dir__, 'test_files', 'invalid_target.rst')
+ filepath = os.path.join(_dir, 'test_files', 'invalid_target.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertIn('Unknown target name', errors[0].message)
@@ -93,7 +93,7 @@ class TestRestructuredtextLint(TestCase)
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/7
"""
- filepath = os.path.join(__dir__, 'test_files', 'invalid_line_mismatch.rst')
+ filepath = os.path.join(_dir, 'test_files', 'invalid_line_mismatch.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertIn('Title overline & underline mismatch', errors[0].message)
@@ -102,7 +102,7 @@ class TestRestructuredtextLint(TestCase)
This is a regression test for https://github.com/twolfson/restructuredtext-lint/issues/12
"""
- filepath = os.path.join(__dir__, 'test_files', 'invalid_link.rst')
+ filepath = os.path.join(_dir, 'test_files', 'invalid_link.rst')
errors = restructuredtext_lint.lint_file(filepath)
self.assertIn('Anonymous hyperlink mismatch: 1 references but 0 targets.', errors[0].message)
self.assertIn('Hyperlink target "hello" is not referenced.', errors[1].message)

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c48ca9a84c312b262809f041fe47dcfaedc9ee4879b3e1f9532f745c182b4037
size 25101

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8712f9066d2c748002ec24f6f7ddca13e0c37654ae4f1ba0dcf0e78ba453c387
size 19214