Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame^] | 1 | # Copyright 2016 Google Inc. All rights reserved. |
| 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 | import os |
| 16 | from datetime import datetime |
| 17 | from setuptools import setup |
| 18 | |
| 19 | |
| 20 | def version(): |
| 21 | version = os.getenv('VERSION', None) |
| 22 | if version: |
| 23 | # Most git tags are prefixed with 'v' (example: v1.2.3) this is |
| 24 | # never desirable for artifact repositories, so we strip the |
| 25 | # leading 'v' if it's present. |
| 26 | return version[1:] if version.startswith('v') else version |
| 27 | else: |
| 28 | # Default version is an ISO8601 compiliant datetime. PyPI doesn't allow |
| 29 | # the colon ':' character in its versions, and time is required to allow |
| 30 | # for multiple publications to master in one day. This datetime string |
| 31 | # uses the "basic" ISO8601 format for both its date and time components |
| 32 | # to avoid issues with the colon character (ISO requires that date and |
| 33 | # time components of a date-time string must be uniformly basic or |
| 34 | # extended, which is why the date component does not have dashes. |
| 35 | # |
| 36 | # Publications using datetime versions should only be made from master |
| 37 | # to represent the HEAD moving forward. |
| 38 | version = datetime.utcnow().strftime('%Y%m%d%H%M%S') |
| 39 | print("VERSION environment variable not set, using datetime instead: {}" |
| 40 | .format(version)) |
| 41 | |
| 42 | return version |
| 43 | |
| 44 | setup( |
| 45 | name='flatbuffers', |
| 46 | version=version(), |
| 47 | license='Apache 2.0', |
| 48 | author='FlatBuffers Contributors', |
| 49 | author_email='me@rwinslow.com', |
| 50 | url='https://google.github.io/flatbuffers/', |
| 51 | long_description=('Python runtime library for use with the ' |
| 52 | '`Flatbuffers <https://google.github.io/flatbuffers/>`_ ' |
| 53 | 'serialization format.'), |
| 54 | packages=['flatbuffers'], |
| 55 | include_package_data=True, |
| 56 | requires=[], |
| 57 | description='The FlatBuffers serialization format for Python', |
| 58 | classifiers=[ |
| 59 | 'Intended Audience :: Developers', |
| 60 | 'License :: OSI Approved :: Apache Software License', |
| 61 | 'Operating System :: OS Independent', |
| 62 | 'Programming Language :: Python', |
| 63 | 'Programming Language :: Python :: 2', |
| 64 | 'Programming Language :: Python :: 3', |
| 65 | 'Topic :: Software Development :: Libraries :: Python Modules', |
| 66 | ], |
| 67 | project_urls={ |
| 68 | 'Documentation': 'https://google.github.io/flatbuffers/', |
| 69 | 'Source': 'https://github.com/google/flatbuffers', |
| 70 | }, |
| 71 | ) |