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 16import codecs 17import sys 18import unittest 19 20from setuptools import setup, Command 21 22import yapf 23 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): 35 loader = unittest.TestLoader() 36 tests = loader.discover('yapftests', pattern='*_test.py', top_level_dir='.') 37 runner = unittest.TextTestRunner() 38 results = runner.run(tests) 39 sys.exit(0 if results.wasSuccessful() else 1) 40 41 42with codecs.open('README.rst', 'r', 'utf-8') as fd: 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', 52 packages=['yapf', 'yapf.yapflib', 'yapftests'], 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', 63 'Programming Language :: Python :: 3.6', 64 'Topic :: Software Development :: Libraries :: Python Modules', 65 'Topic :: Software Development :: Quality Assurance', 66 ], 67 entry_points={ 68 'console_scripts': ['yapf = yapf:run_main'], 69 }, 70 cmdclass={ 71 'test': RunTests, 72 }, 73 ) 74