11# /usr/bin/env python
22import os
33import re
4+
45from setuptools import setup
56from setuptools .command .test import test as Command
67
78
8- class LintCommand (Command ):
9- """
10- A copy of flake8's Flake8Command
11- """
12-
13- description = "Run flake8 on modules registered in setuptools"
14- user_options = []
15-
16- def initialize_options (self ):
17- # must override
18- pass
19-
20- def finalize_options (self ):
21- # must override
22- pass
23-
24- def distribution_files (self ):
25- if self .distribution .packages :
26- for package in self .distribution .packages :
27- yield package .replace ("." , os .path .sep )
28-
29- if self .distribution .py_modules :
30- for filename in self .distribution .py_modules :
31- yield "%s.py" % filename
32-
33- def run (self ):
34- from flake8 .api .legacy import get_style_guide
35-
36- flake8_style = get_style_guide (config_file = "setup.cfg" )
37- paths = self .distribution_files ()
38- report = flake8_style .check_files (paths )
39- raise SystemExit (report .total_errors > 0 )
40-
41-
429def version ():
4310 version = ""
4411 with open ("table2ascii/__init__.py" ) as f :
45- version = re .search (
46- r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]' , f .read (), re .MULTILINE
47- ).group (1 )
12+ version = re .search (r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]' , f .read (), re .MULTILINE )
4813 if not version :
4914 raise RuntimeError ("version is not set" )
50- return version
15+ return version . group ( 1 )
5116
5217
5318def long_description ():
@@ -68,12 +33,21 @@ def requirements():
6833
6934extras_require = {
7035 "docs" : [
71- "sphinx>=4.4.0,<5" ,
72- "enum-tools>=0.9.0.post1,<1" ,
73- "sphinx-toolbox>=2.18.0,<3" ,
74- "sphinxcontrib_trio>=1.1.2,<2" ,
75- "sphinx-rtd-theme>=1.0.0,<2" ,
76- "sphinxext-opengraph>=0.6.2,<1" ,
36+ "sphinx" ,
37+ "enum-tools" ,
38+ "sphinx-toolbox" ,
39+ "sphinxcontrib_trio" ,
40+ "sphinx-rtd-theme" ,
41+ "sphinxext-opengraph" ,
42+ "sphinx-autobuild" ,
43+ ],
44+ "dev" : [
45+ "pre-commit==2.18.1" ,
46+ "taskipy==1.10.1" ,
47+ "slotscheck==0.14.0" ,
48+ "python-dotenv==0.20.0" ,
49+ "pyright==1.1.244" ,
50+ "tox==3.24.5" ,
7751 ],
7852}
7953
@@ -109,7 +83,4 @@ def requirements():
10983 tests_require = [
11084 "pytest>=6.2,<7" ,
11185 ],
112- cmdclass = {
113- "lint" : LintCommand ,
114- },
11586)
0 commit comments