14
0

Accepting request 678595 from home:jayvdb:coala:python3-bears

- Add missing dependencies for Python 2, enum34 and pathlib and add
  missing test dependency mock
- Remove unnecessary build dependency python-devel
- Remove %bcond test
- Fix CLI tests with test-sys-executable.patch
- Change version == pins to >= in setup.py and test-requirements.txt
- Update to v0.3.19
  * New features
    + Initial support for stdin
  * Bug fixes
    + Disable ProhibitImplicitScopeVariable
    + Suppress warnings caused by map([], ' "x" ')
    + Fix linting autocmd
    + Fix acceptance tests
  * Optimize
    + ProhibitUnusedVariable
    + get_asset_path
    + ConfigProjectSource
  * Documentation
    + Link to default config
    + Fix a broken code block for example
- Initial version v0.3.18

OBS-URL: https://build.opensuse.org/request/show/678595
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-vim-vint?expand=0&rev=1
This commit is contained in:
Tomáš Chvátal
2019-02-25 08:29:38 +00:00
committed by Git OBS Bridge
commit 41dc3ccef4
6 changed files with 298 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

29
python-vim-vint.changes Normal file
View File

@@ -0,0 +1,29 @@
-------------------------------------------------------------------
Wed Feb 13 06:23:38 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Add missing dependencies for Python 2, enum34 and pathlib and add
missing test dependency mock
- Remove unnecessary build dependency python-devel
- Remove %bcond test
- Fix CLI tests with test-sys-executable.patch
- Change version == pins to >= in setup.py and test-requirements.txt
- Update to v0.3.19
* New features
+ Initial support for stdin
* Bug fixes
+ Disable ProhibitImplicitScopeVariable
+ Suppress warnings caused by map([], ' "x" ')
+ Fix linting autocmd
+ Fix acceptance tests
* Optimize
+ ProhibitUnusedVariable
+ get_asset_path
+ ConfigProjectSource
* Documentation
+ Link to default config
+ Fix a broken code block for example
-------------------------------------------------------------------
Thu Nov 16 17:46:12 UTC 2017 - toddrme2178@gmail.com
- Initial version v0.3.18

78
python-vim-vint.spec Normal file
View File

@@ -0,0 +1,78 @@
#
# spec file for package python-vim-vint
#
# Copyright (c) 2018 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-vim-vint
Version: 0.3.19
Release: 0
License: MIT
Summary: Lint tool for Vim script Language
Url: https://github.com/Kuniwak/vint
Group: Development/Languages/Python
Source: https://github.com/Kuniwak/vint/archive/v0.3.19.tar.gz
Patch0: test-sys-executable.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: %{python_module ansicolor >= 0.2.4}
BuildRequires: %{python_module chardet >= 2.3.0}
BuildRequires: %{python_module PyYAML >= 3.11}
BuildRequires: %{python_module coverage >= 3.7.1}
BuildRequires: %{python_module pathlib}
BuildRequires: %{python_module pytest >= 2.6.4}
BuildRequires: %{python_module pytest-cov >= 1.8.1}
BuildRequires: python-enum34 >= 1.0.4
BuildRequires: python2-mock >= 1.0.1
BuildRequires: python-typing >= 3.6.2
Requires: python-ansicolor >= 0.2.4
Requires: python-chardet >= 2.3.0
Requires: python-PyYAML >= 3.11
%ifpython2
Requires: python-enum34 >= 1.0.4
Requires: python-pathlib >= 1.0.1
Requires: python-typing >= 3.6.2
%endif
BuildArch: noarch
%python_subpackages
%description
A lint tool for the Vim script Language.
%prep
%setup -q -n vint-%{version}
%patch0 -p1
sed -i 's/==/>=/g' setup.py test-requirements.txt
sed -i -e '/^#!\//, 1d' vint/_bundles/vimlparser.py
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python setup.py test
%files %{python_files}
%license LICENSE.txt
%doc README.rst
%python3_only %{_bindir}/vint
%{python_sitelib}/*
%changelog

164
test-sys-executable.patch Normal file
View File

@@ -0,0 +1,164 @@
From e02e67ddfbeebb76dafeff684e261873423b21f2 Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
Date: Mon, 25 Feb 2019 09:06:03 +0700
Subject: [PATCH] Create vint.__main__
Allow vint to be run using python -m vint, which
allows the CLI tests to run without the bin/vint,
and without vint being installed.
---
test/acceptance/test_cli.py | 21 +++++++++++----------
test/acceptance/test_cli_vital.py | 4 +++-
vint/__main__.py | 15 +++++++++++++++
3 files changed, 29 insertions(+), 11 deletions(-)
create mode 100644 vint/__main__.py
diff --git a/test/acceptance/test_cli.py b/test/acceptance/test_cli.py
index 46d639b..b20a587 100644
--- a/test/acceptance/test_cli.py
+++ b/test/acceptance/test_cli.py
@@ -2,6 +2,7 @@
from pathlib import Path
import json
import subprocess
+import sys
class TestCLI(unittest.TestCase):
@@ -16,7 +17,7 @@ def assertRegex(self, string, pattern):
def assertReturnedStdoutEqual(self, expected_stdout, cmd):
got_stdout = '(no stdout)'
-
+ cmd = [sys.executable, '-m'] + cmd
try:
got_stdout = subprocess.check_output(cmd, universal_newlines=True)
except subprocess.CalledProcessError as err:
@@ -29,7 +30,7 @@ def assertReturnedStdoutEqual(self, expected_stdout, cmd):
def test_exec_vint_with_valid_file_on_project_root(self):
valid_file = str(Path('test', 'fixture', 'cli', 'valid1.vim'))
- cmd = ['bin/vint', valid_file]
+ cmd = ['vint', valid_file]
expected_output = ''
@@ -38,7 +39,7 @@ def test_exec_vint_with_valid_file_on_project_root(self):
def test_exec_vint_with_valid_file_encoded_cp932_on_project_root(self):
valid_file = str(Path('test', 'fixture', 'cli', 'valid-cp932.vim'))
- cmd = ['bin/vint', valid_file]
+ cmd = ['vint', valid_file]
expected_output = ''
@@ -47,7 +48,7 @@ def test_exec_vint_with_valid_file_encoded_cp932_on_project_root(self):
def test_exec_vint_with_invalid_file_on_project_root(self):
invalid_file = str(Path('test', 'fixture', 'cli', 'invalid1.vim'))
- cmd = ['bin/vint', invalid_file]
+ cmd = [sys.executable, '-m', 'vint', invalid_file]
with self.assertRaises(subprocess.CalledProcessError) as context_manager:
subprocess.check_output(cmd, universal_newlines=True)
@@ -59,7 +60,7 @@ def test_exec_vint_with_invalid_file_on_project_root(self):
def test_exec_vint_with_no_args(self):
- cmd = ['bin/vint']
+ cmd = [sys.executable, '-m', 'vint']
with self.assertRaises(subprocess.CalledProcessError) as context_manager:
subprocess.check_output(cmd,
@@ -73,7 +74,7 @@ def test_exec_vint_with_no_args(self):
def test_exec_vint_with_unexistent_file(self):
- cmd = ['bin/vint', '/path/to/unexistent']
+ cmd = [sys.executable, '-m', 'vint', '/path/to/unexistent']
with self.assertRaises(subprocess.CalledProcessError) as context_manager:
subprocess.check_output(cmd,
@@ -88,7 +89,7 @@ def test_exec_vint_with_unexistent_file(self):
def test_exec_vint_with_stat_flag(self):
invalid_file = str(Path('test', 'fixture', 'cli', 'invalid1.vim'))
- cmd = ['bin/vint', '--stat', invalid_file]
+ cmd = [sys.executable, '-m', 'vint', '--stat', invalid_file]
with self.assertRaises(subprocess.CalledProcessError) as context_manager:
subprocess.check_output(cmd,
@@ -105,7 +106,7 @@ def test_exec_vint_with_stat_flag(self):
def test_exec_vint_with_json_flag(self):
invalid_file = str(Path('test', 'fixture', 'cli', 'invalid1.vim'))
- cmd = ['bin/vint', '--json', invalid_file]
+ cmd = [sys.executable, '-m', 'vint', '--json', invalid_file]
with self.assertRaises(subprocess.CalledProcessError) as context_manager:
# We should not capture STRERR because coverage plugin use it.
@@ -120,7 +121,7 @@ def test_exec_vint_with_json_flag(self):
def test_exec_vint_with_verbose_flag(self):
valid_file = str(Path('test', 'fixture', 'cli', 'valid1.vim'))
- cmd = ['bin/vint', '--verbose', valid_file]
+ cmd = [sys.executable, '-m', 'vint', '--verbose', valid_file]
got_output = subprocess.check_output(cmd,
universal_newlines=True,
@@ -133,7 +134,7 @@ def test_exec_vint_with_verbose_flag(self):
@unittest.skip('Does drone.io not like ANSI color?')
def test_exec_vint_with_color_flag(self):
invalid_file = str(Path('test', 'fixture', 'cli', 'invalid1.vim'))
- cmd = ['bin/vint', '--color', invalid_file]
+ cmd = [sys.executable, '-m', 'vint', '--color', invalid_file]
with self.assertRaises(subprocess.CalledProcessError) as context_manager:
subprocess.check_output(cmd, universal_newlines=True)
diff --git a/test/acceptance/test_cli_vital.py b/test/acceptance/test_cli_vital.py
index f8bca7d..151ade3 100644
--- a/test/acceptance/test_cli_vital.py
+++ b/test/acceptance/test_cli_vital.py
@@ -1,10 +1,12 @@
import unittest
from pathlib import Path
import subprocess
+import sys
class TestVintDoNotDiedWhenLintingVital(unittest.TestCase):
def assertVintStillAlive(self, cmd):
+ cmd = [sys.executable, '-m'] + cmd
try:
got_output = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
@@ -19,7 +21,7 @@ def assertVintStillAlive(self, cmd):
def test_survive_after_linting(self):
vital_dir = str(Path('test', 'fixture', 'cli', 'vital.vim'))
- cmd = ['bin/vint', vital_dir]
+ cmd = ['vint', vital_dir]
self.assertVintStillAlive(cmd)
diff --git a/vint/__main__.py b/vint/__main__.py
new file mode 100644
index 0000000..11f9c87
--- /dev/null
+++ b/vint/__main__.py
@@ -0,0 +1,15 @@
+from vint.bootstrap import (
+ init_logger,
+ init_linter,
+ init_cli,
+)
+
+
+def main():
+ init_logger()
+ init_linter()
+ init_cli()
+
+
+if __name__ == '__main__':
+ main()

3
v0.3.19.tar.gz Normal file
View File

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