Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 1 | # Copyright 2017-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 |
Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 16 | |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 17 | import os |
| 18 | from shutil import copyfile |
| 19 | |
| 20 | from setuptools import setup |
| 21 | |
| 22 | |
| 23 | def version(): |
| 24 | # Copy VERSION file of parent to module directory if not found |
| 25 | if not os.path.exists("xosmigrate/VERSION"): |
| 26 | copyfile("../../VERSION", "xosmigrate/VERSION") |
| 27 | with open("xosmigrate/VERSION") as f: |
| 28 | return f.read().strip() |
| 29 | |
| 30 | |
| 31 | def parse_requirements(filename): |
| 32 | # parse a requirements.txt file, allowing for blank lines and comments |
| 33 | requirements = [] |
| 34 | for line in open(filename): |
| 35 | if line and not line.startswith("#"): |
| 36 | requirements.append(line) |
| 37 | return requirements |
| 38 | |
Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 39 | |
| 40 | setup( |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 41 | name="xosmigrate", |
| 42 | version=version(), |
Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 43 | description="XOS Migrations Toolkit", |
| 44 | author="Matteo Scandolo", |
| 45 | author_email="teo@opennetworking.org", |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 46 | classifiers=["License :: OSI Approved :: Apache Software License"], |
| 47 | license="Apache v2", |
Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 48 | packages=["xosmigrate"], |
| 49 | scripts=["bin/xos-migrate"], |
Zack Williams | 5c2ea23 | 2019-01-30 15:23:01 -0700 | [diff] [blame] | 50 | install_requires=parse_requirements("requirements.txt"), |
Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 51 | include_package_data=True, |
Matteo Scandolo | 57fdb4b | 2019-02-06 18:27:56 -0800 | [diff] [blame] | 52 | ) |