88import io
99
1010from setuptools import setup , Command
11- from setuptools .command .test import test as TestCommand
1211
1312
1413with io .open ('eql/__init__.py' , 'rt' , encoding = 'utf8' ) as f :
1514 __version__ = re .search (r'__version__ = \'(.*?)\'' , f .read ()).group (1 )
1615
1716install_requires = [
18- "lark>=1.3.1; python_version>='3.8'" ,
19- "lark-parser~=0.12.0; python_version<'3.8'" ,
20- "enum34; python_version<'3.4'" ,
21- "ipaddress; python_version<'3'" ,
17+ "lark>=1.3.1" ,
2218]
2319
2420test_requires = [
25- "mock~=1.3.0" ,
2621 "pytest~=3.8.2" ,
2722 "pytest-cov==2.4" ,
28- "flake8==2.5.1; python_version<'3.8'" ,
29- "flake8>=3.8.0; python_version>='3.8'" ,
23+ "flake8>=3.8.0" ,
3024 "pep257==0.7.0" ,
3125 "coverage==4.5.3" ,
32- "flake8-pep257==1.0.5; python_version<'3.8'" ,
33- "flake8-docstrings>=1.5.0; python_version>='3.8'" ,
34- "PyYAML<6.0; python_version<'3.4'" ,
35- "PyYAML; python_version>='3.4'" ,
26+ "flake8-docstrings>=1.5.0" ,
27+ "PyYAML" ,
3628 "toml~=0.10" ,
37- "pluggy==1.0.0-dev0; python_version<'3.4'" ,
38- "configparser<5.0; python_version<'3.4'" ,
39- "contextlib2~=0.6.0" ,
40- "more-itertools~=5.0; python_version<'3.4'" ,
41- "importlib-metadata<3.0; python_version<'3.4'" ,
42- "zipp<1.0; python_version<'3.4'" ,
4329 "attrs==21.4.0"
4430]
4531etc_files = [os .path .relpath (fn , 'eql' ) for fn in glob .glob ('eql/etc/*' ) if not fn .endswith ('.py' )]
@@ -59,42 +45,32 @@ def finalize_options(self):
5945
6046 def run (self ):
6147 """Run the flake8 linter."""
62- self .distribution .fetch_build_eggs (test_requires )
63- self .distribution .packages .append ('tests' )
64-
65- # Handle different flake8 API versions
66- try :
67- # Old flake8 API (2.x)
68- from flake8 .main import Flake8Command
69- flake8cmd = Flake8Command (self .distribution )
70- flake8cmd .options_dict = {}
71- flake8cmd .run ()
72- except ImportError :
73- # New flake8 API (3.x+)
74- import subprocess
75- # Run flake8 via command line (respects setup.cfg configuration)
76- result = subprocess .run (
77- [sys .executable , '-m' , 'flake8' , 'eql' , 'tests' ],
78- cwd = os .path .dirname (os .path .abspath (__file__ ))
79- )
80- sys .exit (result .returncode )
81-
82-
83- class Test (TestCommand ):
48+ import subprocess
49+ # Run flake8 via command line (respects setup.cfg configuration)
50+ result = subprocess .run (
51+ [sys .executable , '-m' , 'flake8' , 'eql' , 'tests' ],
52+ cwd = os .path .dirname (os .path .abspath (__file__ ))
53+ )
54+ sys .exit (result .returncode )
55+
56+
57+ class Test (Command ):
8458 """Use pytest (http://pytest.org/latest/) in place of the standard unittest library."""
8559
8660 user_options = [("pytest-args=" , "a" , "Arguments to pass to pytest" )]
8761
8862 def initialize_options (self ):
89- """Need to ensure pytest_args exists."""
90- TestCommand .initialize_options (self )
63+ """Initialize options."""
9164 self .pytest_args = []
9265
93- def run_tests (self ):
66+ def finalize_options (self ):
67+ """Finalize options."""
68+ pass
69+
70+ def run (self ):
9471 """Run pytest."""
9572 import pytest
9673 import eql
97-
9874 eql .parser .full_tracebacks = True
9975 sys .exit (pytest .main (self .pytest_args ))
10076
@@ -113,19 +89,17 @@ def run_tests(self):
11389 'Intended Audience :: Science/Research' ,
11490 'Intended Audience :: System Administrators' ,
11591 'Natural Language :: English' ,
116- 'Programming Language :: Python :: 2' ,
117- 'Programming Language :: Python :: 2.7' ,
11892 'Programming Language :: Python :: 3' ,
119- 'Programming Language :: Python :: 3.4' ,
120- 'Programming Language :: Python :: 3.5' ,
121- 'Programming Language :: Python :: 3.6' ,
122- 'Programming Language :: Python :: 3.7' ,
93+ 'Programming Language :: Python :: 3.8' ,
94+ 'Programming Language :: Python :: 3.9' ,
95+ 'Programming Language :: Python :: 3.10' ,
96+ 'Programming Language :: Python :: 3.11' ,
97+ 'Programming Language :: Python :: 3.12' ,
12398 'Topic :: Database' ,
12499 'Topic :: Internet :: Log Analysis' ,
125100 'Topic :: Scientific/Engineering :: Information Analysis' ,
126101 ],
127102 url = 'https://eql.readthedocs.io' ,
128- tests_require = install_requires + test_requires ,
129103 cmdclass = {
130104 'lint' : Lint ,
131105 'test' : Test
0 commit comments