Zack Williams | 73a1285 | 2018-09-05 15:33:35 -0700 | [diff] [blame] | 1 | # Copyright 2018-present Open Networking Foundation |
| 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 | |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 15 | from __future__ import absolute_import |
| 16 | |
| 17 | import os |
| 18 | from shutil import copyfile |
| 19 | |
| 20 | from setuptools import setup |
Zack Williams | 73a1285 | 2018-09-05 15:33:35 -0700 | [diff] [blame] | 21 | |
| 22 | |
| 23 | def readme(): |
Zack Williams | 045b63d | 2019-01-22 16:30:57 -0700 | [diff] [blame] | 24 | with open("README.rst") as f: |
Zack Williams | 73a1285 | 2018-09-05 15:33:35 -0700 | [diff] [blame] | 25 | return f.read() |
| 26 | |
| 27 | |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 28 | def version(): |
| 29 | # Copy VERSION file of parent to module directory if not found |
| 30 | if not os.path.exists("xoskafka/VERSION"): |
| 31 | copyfile("../../VERSION", "xoskafka/VERSION") |
| 32 | with open("xoskafka/VERSION") as f: |
| 33 | return f.read().strip() |
| 34 | |
| 35 | |
| 36 | def parse_requirements(filename): |
| 37 | # parse a requirements.txt file, allowing for blank lines and comments |
| 38 | requirements = [] |
| 39 | for line in open(filename): |
| 40 | if line and not line.startswith("#"): |
| 41 | requirements.append(line) |
| 42 | return requirements |
| 43 | |
| 44 | |
| 45 | setup( |
Zack Williams | 045b63d | 2019-01-22 16:30:57 -0700 | [diff] [blame] | 46 | name="xoskafka", |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 47 | version=version(), |
Zack Williams | 045b63d | 2019-01-22 16:30:57 -0700 | [diff] [blame] | 48 | description="Wrapper around kafka for XOS", |
Zack Williams | 73a1285 | 2018-09-05 15:33:35 -0700 | [diff] [blame] | 49 | long_description=readme(), |
Zack Williams | 045b63d | 2019-01-22 16:30:57 -0700 | [diff] [blame] | 50 | author="Zack Williams", |
| 51 | author_email="zdw@opennetworking.org", |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 52 | classifiers=["License :: OSI Approved :: Apache Software License"], |
Zack Williams | 045b63d | 2019-01-22 16:30:57 -0700 | [diff] [blame] | 53 | license="Apache v2", |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 54 | packages=["xoskafka"], |
| 55 | install_requires=parse_requirements("requirements.txt"), |
Zack Williams | 73a1285 | 2018-09-05 15:33:35 -0700 | [diff] [blame] | 56 | include_package_data=True, |
Zack Williams | 045b63d | 2019-01-22 16:30:57 -0700 | [diff] [blame] | 57 | ) |