blob: 70e57da68502fae59fd55966466f6d57931625e6 [file] [log] [blame]
Bill Wendling7d623452015-03-18 13:36:07 -07001#!/usr/bin/env python
Bill Wendling92290f12018-01-14 16:49:35 -08002# Copyright 2015 Google Inc. All Rights Reserved.
Bill Wendling7d623452015-03-18 13:36:07 -07003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
Chris Lasher49a3e0a2015-03-26 01:44:36 -070016import codecs
Andy Haydenfca09e22015-04-16 22:47:11 -070017import sys
Bill Wendlingbb9968f2017-03-28 00:16:36 -070018import unittest
19
Misha Wolfsonb3c3a582021-04-26 13:57:19 -040020from setuptools import find_packages, setup, Command
Bill Wendling7d623452015-03-18 13:36:07 -070021
22import yapf
Bill Wendling7d623452015-03-18 13:36:07 -070023
24
25class RunTests(Command):
26 user_options = []
27
28 def initialize_options(self):
29 pass
30
31 def finalize_options(self):
32 pass
33
34 def run(self):
Eli Bendersky1fe50342015-03-23 06:25:14 -070035 loader = unittest.TestLoader()
36 tests = loader.discover('yapftests', pattern='*_test.py', top_level_dir='.')
Bill Wendling7d623452015-03-18 13:36:07 -070037 runner = unittest.TextTestRunner()
Andy Haydenfca09e22015-04-16 22:47:11 -070038 results = runner.run(tests)
39 sys.exit(0 if results.wasSuccessful() else 1)
Bill Wendling7d623452015-03-18 13:36:07 -070040
Bill Wendlinga3792b02016-05-23 20:23:36 -070041
Chris Lasher49a3e0a2015-03-26 01:44:36 -070042with codecs.open('README.rst', 'r', 'utf-8') as fd:
Bill Wendling33636712016-07-16 02:49:28 -070043 setup(
44 name='yapf',
45 version=yapf.__version__,
46 description='A formatter for Python code.',
47 long_description=fd.read(),
48 license='Apache License, Version 2.0',
49 author='Google Inc.',
50 maintainer='Bill Wendling',
51 maintainer_email='morbo@google.com',
Misha Wolfsonb3c3a582021-04-26 13:57:19 -040052 packages=find_packages('.'),
Bill Wendling33636712016-07-16 02:49:28 -070053 classifiers=[
54 'Development Status :: 4 - Beta',
55 'Environment :: Console',
56 'Intended Audience :: Developers',
57 'License :: OSI Approved :: Apache Software License',
58 'Operating System :: OS Independent',
59 'Programming Language :: Python',
60 'Programming Language :: Python :: 2',
61 'Programming Language :: Python :: 2.7',
62 'Programming Language :: Python :: 3',
Bill Wendlingfe6460f2018-01-26 15:08:07 -080063 'Programming Language :: Python :: 3.6',
Bill Wendling33636712016-07-16 02:49:28 -070064 'Topic :: Software Development :: Libraries :: Python Modules',
65 'Topic :: Software Development :: Quality Assurance',
66 ],
Bill Wendling8d321362017-02-05 18:29:26 -080067 entry_points={
Bouwe Andelab88e2ab2020-11-09 00:03:43 +010068 'console_scripts': [
69 'yapf = yapf:run_main',
70 'yapf-diff = yapf.third_party.yapf_diff.yapf_diff:main',
71 ],
Bill Wendling8d321362017-02-05 18:29:26 -080072 },
73 cmdclass={
74 'test': RunTests,
Bill Wendling5f83cfb2017-10-08 01:12:27 -070075 },
76 )