Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright 2015 Google Inc. All Rights Reserved. |
| 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 |
Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 17 | import unittest |
Andy Hayden | 48dc5b3 | 2015-04-04 22:02:24 -0700 | [diff] [blame] | 18 | from setuptools import setup, Command |
Andy Hayden | fca09e2 | 2015-04-16 22:47:11 -0700 | [diff] [blame] | 19 | import sys |
Bill Wendling | 7d62345 | 2015-03-18 13:36:07 -0700 | [diff] [blame] | 20 | |
| 21 | import yapf |
| 22 | import yapftests |
| 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 | |
Chris Lasher | 49a3e0a | 2015-03-26 01:44:36 -0700 | [diff] [blame] | 41 | with codecs.open('README.rst', 'r', 'utf-8') as fd: |
Bill Wendling | f57fc64 | 2015-10-11 23:59:34 -0700 | [diff] [blame] | 42 | setup(name='yapf', |
| 43 | version=yapf.__version__, |
| 44 | description='A formatter for Python code.', |
| 45 | long_description=fd.read(), |
| 46 | license='Apache License, Version 2.0', |
| 47 | author='Google Inc.', |
| 48 | maintainer='Bill Wendling', |
| 49 | maintainer_email='morbo@google.com', |
| 50 | packages=['yapf', 'yapf.yapflib', 'yapftests'], |
| 51 | classifiers=[ |
| 52 | 'Development Status :: 4 - Beta', |
| 53 | 'Environment :: Console', |
| 54 | 'Intended Audience :: Developers', |
| 55 | 'License :: OSI Approved :: Apache Software License', |
| 56 | 'Operating System :: OS Independent', |
| 57 | 'Programming Language :: Python', |
| 58 | 'Programming Language :: Python :: 2', |
| 59 | 'Programming Language :: Python :: 2.7', |
| 60 | 'Programming Language :: Python :: 3', |
| 61 | 'Programming Language :: Python :: 3.4', |
Felix Yan | 3212c67 | 2016-02-15 15:23:17 +0800 | [diff] [blame^] | 62 | 'Programming Language :: Python :: 3.5', |
Bill Wendling | f57fc64 | 2015-10-11 23:59:34 -0700 | [diff] [blame] | 63 | 'Topic :: Software Development :: Libraries :: Python Modules', |
| 64 | 'Topic :: Software Development :: Quality Assurance', |
| 65 | ], |
| 66 | entry_points={'console_scripts': ['yapf = yapf:run_main'],}, |
| 67 | cmdclass={'test': RunTests,},) |