forked from cpplint/cpplint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·100 lines (83 loc) · 2.97 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#! /usr/bin/env python
from setuptools import setup, Command
from setuptools.command.test import test as TestCommand
from subprocess import check_call
from multiprocessing import cpu_count
from distutils.spawn import find_executable
import cpplint as cpplint
class Test(TestCommand):
def run_tests(self):
check_call(('./cpplint_unittest.py'))
check_call(('./cpplint_clitest.py'))
class Cmd(Command):
user_options = [
('executable', 'e', 'The executable to use for the command')
]
def initialize_options(self):
self.executable = find_executable(self.executable)
def finalize_options(self):
pass
def execute(self, *k):
check_call((self.executable,) + k)
class Lint(Cmd):
description = 'Run linting of the code'
user_options = Cmd.user_options + [
('jobs', 'j', 'Use multiple processes to speed up the linting')
]
executable = 'pylint'
def initialize_options(self):
self.jobs = cpu_count()
def finalize_options(self):
self.jobs = int(self.jobs)
if self.jobs < 1:
raise ValueError('Jobs must be one or larger')
def run(self):
self.execute('-j', str(self.jobs), 'cpplint.py')
class Format(Cmd):
description = 'Formats the code'
executable = 'yapf'
def run(self):
self.execute('--parallel', '--in-place', 'cpplint.py')
setup(name='cpplint',
version=cpplint.__VERSION__,
py_modules=['cpplint'],
# generate platform specific start script
entry_points={
'console_scripts': [
'cpplint = cpplint:main'
]
},
install_requires=[],
url='https://github.com/cpplint/cpplint',
download_url='https://github.com/cpplint/cpplint',
keywords=['lint', 'python', 'c++'],
maintainer='cpplint Developers',
maintainer_email='[email protected]',
classifiers=['Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: C++',
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Topic :: Software Development :: Quality Assurance',
'License :: Freely Distributable'],
description='Automated checker to ensure C++ files follow Google\'s style guide',
long_description=open('README.rst').read(),
license='BSD-3-Clause',
extras_require={
'dev': [
'pylint',
'flake8',
'yapf',
]
},
cmdclass={
'test': Test,
'lint': Lint,
'format': Format
})