File: setup.py

package info (click to toggle)
cpplint 1.6.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,776 kB
  • sloc: cpp: 13,511; python: 8,913; ansic: 854; makefile: 18
file content (86 lines) | stat: -rwxr-xr-x 2,955 bytes parent folder | download | duplicates (2)
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
#! /usr/bin/env python

from setuptools import setup, Command
from subprocess import check_call
from distutils.spawn import find_executable
import cpplint as cpplint

class Cmd(Command):
    '''
    Superclass for other commands to run via setup.py, declared in setup.cfg.
    These commands will auto-install setup_requires in a temporary folder.
    '''
    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):
    '''run with python setup.py lint'''
    description = 'Run linting of the code'
    user_options = Cmd.user_options + [
      ('jobs', 'j', 'Use multiple processes to speed up the linting')
    ]
    executable = 'pylint'

    def run(self):
        self.execute('cpplint.py')

# some pip versions bark on comments (e.g. on travis)
def read_without_comments(filename):
    with open(filename) as f:
        return [line for line in f.read().splitlines() if not len(line) == 0 and not line.startswith('#')]

test_required = read_without_comments('test-requirements')

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='see_github@nospam.com',
      classifiers=['Programming Language :: Python',
                   'Programming Language :: Python :: 2',
                   'Programming Language :: Python :: 2.7',
                   'Programming Language :: Python :: 3',
                   'Programming Language :: Python :: 3.6',
                   'Programming Language :: Python :: 3.7',
                   'Programming Language :: Python :: 3.8',
                   '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',
      setup_requires=[
          "pytest-runner"
      ],
      tests_require=test_required,
      # extras_require allow pip install .[dev]
      extras_require={
          'test': test_required,
          'dev': read_without_comments('dev-requirements') + test_required
      },
      cmdclass={
          'lint': Lint
      })