Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
Bill Wendling | 92290f1 | 2018-01-14 16:49:35 -0800 | [diff] [blame] | 2 | # Copyright 2015 Google Inc. All Rights Reserved. |
Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 3 | # |
| 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 Lasher | 49a3e0a | 2015-03-26 01:44:36 -0700 | [diff] [blame] | 16 | import codecs |
Andy Hayden | fca09e2 | 2015-04-16 22:47:11 -0700 | [diff] [blame] | 17 | import sys |
Bill Wendling | bb9968f | 2017-03-28 00:16:36 -0700 | [diff] [blame] | 18 | import unittest |
| 19 | |
Misha Wolfson | b3c3a58 | 2021-04-26 13:57:19 -0400 | [diff] [blame] | 20 | from setuptools import find_packages, setup, Command |
Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 21 | |
| 22 | import yapf |
Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 23 | |
| 24 | |
| 25 | class 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 Bendersky | 1fe5034 | 2015-03-23 06:25:14 -0700 | [diff] [blame] | 35 | loader = unittest.TestLoader() |
| 36 | tests = loader.discover('yapftests', pattern='*_test.py', top_level_dir='.') |
Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 37 | runner = unittest.TextTestRunner() |
Andy Hayden | fca09e2 | 2015-04-16 22:47:11 -0700 | [diff] [blame] | 38 | results = runner.run(tests) |
| 39 | sys.exit(0 if results.wasSuccessful() else 1) |
Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 40 | |
Bill Wendling | a3792b0 | 2016-05-23 20:23:36 -0700 | [diff] [blame] | 41 | |
Chris Lasher | 49a3e0a | 2015-03-26 01:44:36 -0700 | [diff] [blame] | 42 | with codecs.open('README.rst', 'r', 'utf-8') as fd: |
Bill Wendling | 3363671 | 2016-07-16 02:49:28 -0700 | [diff] [blame] | 43 | 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 Wolfson | b3c3a58 | 2021-04-26 13:57:19 -0400 | [diff] [blame] | 52 | packages=find_packages('.'), |
Bill Wendling | 3363671 | 2016-07-16 02:49:28 -0700 | [diff] [blame] | 53 | 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 Wendling | fe6460f | 2018-01-26 15:08:07 -0800 | [diff] [blame] | 63 | 'Programming Language :: Python :: 3.6', |
Bill Wendling | 3363671 | 2016-07-16 02:49:28 -0700 | [diff] [blame] | 64 | 'Topic :: Software Development :: Libraries :: Python Modules', |
| 65 | 'Topic :: Software Development :: Quality Assurance', |
| 66 | ], |
Bill Wendling | 8d32136 | 2017-02-05 18:29:26 -0800 | [diff] [blame] | 67 | entry_points={ |
Bouwe Andela | b88e2ab | 2020-11-09 00:03:43 +0100 | [diff] [blame] | 68 | 'console_scripts': [ |
| 69 | 'yapf = yapf:run_main', |
| 70 | 'yapf-diff = yapf.third_party.yapf_diff.yapf_diff:main', |
| 71 | ], |
Bill Wendling | 8d32136 | 2017-02-05 18:29:26 -0800 | [diff] [blame] | 72 | }, |
| 73 | cmdclass={ |
| 74 | 'test': RunTests, |
Bill Wendling | 5f83cfb | 2017-10-08 01:12:27 -0700 | [diff] [blame] | 75 | }, |
| 76 | ) |