Joe Gregorio | d92897c | 2011-07-07 11:44:56 -0400 | [diff] [blame] | 1 | # Copyright (C) 2010 Google Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | """Setup script for oauth2client. |
| 16 | |
| 17 | Also installs included versions of third party libraries, if those libraries |
| 18 | are not already installed. |
| 19 | """ |
| 20 | import setup_utils |
| 21 | |
| 22 | has_setuptools = False |
| 23 | try: |
| 24 | from setuptools import setup |
| 25 | has_setuptools = True |
| 26 | except ImportError: |
| 27 | from distutils.core import setup |
| 28 | |
| 29 | packages = [ |
| 30 | 'oauth2client', |
| 31 | ] |
| 32 | |
| 33 | install_requires = [] |
| 34 | py_modules = [] |
| 35 | |
| 36 | |
| 37 | # (module to test for, install_requires to add if missing, packages to add if missing, py_modules to add if missing) |
| 38 | REQUIREMENTS = [ |
| 39 | ('httplib2', 'httplib2', 'httplib2', None), |
| 40 | ('gflags', 'python-gflags', None, ['gflags', 'gflags_validators']), |
| 41 | (['json', 'simplejson', 'django.utils'], 'simplejson', 'simplejson', None) |
| 42 | ] |
| 43 | |
| 44 | for import_name, requires, package, modules in REQUIREMENTS: |
| 45 | if setup_utils.is_missing(import_name): |
| 46 | if has_setuptools: |
| 47 | install_requires.append(requires) |
| 48 | else: |
| 49 | if package is not None: |
| 50 | packages.append(package) |
| 51 | else: |
| 52 | py_modules.extend(modules) |
| 53 | |
| 54 | |
| 55 | long_desc = """The oauth2client is a client library for OAuth 2.0.""" |
| 56 | |
| 57 | setup(name="oauth2client", |
| 58 | version="1.0beta2", |
| 59 | description="OAuth 2.0 client library", |
| 60 | long_description=long_desc, |
| 61 | author="Joe Gregorio", |
| 62 | author_email="jcgregorio@google.com", |
| 63 | url="http://code.google.com/p/google-api-python-client/", |
| 64 | install_requires=install_requires, |
| 65 | packages=packages, |
| 66 | py_modules=py_modules, |
| 67 | license="Apache 2.0", |
| 68 | keywords="google oauth 2.0 http client", |
| 69 | classifiers=['Development Status :: 4 - Beta', |
| 70 | 'Intended Audience :: Developers', |
| 71 | 'License :: OSI Approved :: Apache Software License', |
| 72 | 'Operating System :: POSIX', |
| 73 | 'Topic :: Internet :: WWW/HTTP']) |