|
| 1 | +# Copyright The GeoML Team |
| 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 | +import os |
| 15 | +from io import open |
| 16 | + |
| 17 | +from setuptools import setup, find_packages, Command |
| 18 | + |
| 19 | +try: |
| 20 | + import builtins |
| 21 | +except ImportError: |
| 22 | + import __builtin__ as builtins |
| 23 | + |
| 24 | +PATH_ROOT = os.path.dirname(__file__) |
| 25 | +builtins.__STOCHMAN_SETUP__ = True |
| 26 | + |
| 27 | +import stochman |
| 28 | + |
| 29 | + |
| 30 | +class CleanCommand(Command): |
| 31 | + """Custom clean command to tidy up the project root.""" |
| 32 | + |
| 33 | + user_options = [] |
| 34 | + |
| 35 | + def initialize_options(self): |
| 36 | + pass |
| 37 | + |
| 38 | + def finalize_options(self): |
| 39 | + pass |
| 40 | + |
| 41 | + def run(self): |
| 42 | + os.system("rm -vrf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info") |
| 43 | + |
| 44 | + |
| 45 | +PATH_ROOT = os.path.dirname(__file__) |
| 46 | + |
| 47 | + |
| 48 | +def load_requirements(path_dir=PATH_ROOT, comment_char="#"): |
| 49 | + with open(os.path.join(path_dir, "requirements.txt"), "r") as file: |
| 50 | + lines = [ln.strip() for ln in file.readlines()] |
| 51 | + reqs = [] |
| 52 | + for ln in lines: |
| 53 | + # filer all comments |
| 54 | + if comment_char in ln: |
| 55 | + ln = ln[: ln.index(comment_char)] |
| 56 | + if ln: # if requirement is not empty |
| 57 | + reqs.append(ln) |
| 58 | + return reqs |
| 59 | + |
| 60 | + |
| 61 | +setup( |
| 62 | + name="stochman", |
| 63 | + version=stochman.__version__, |
| 64 | + description=stochman.__docs__, |
| 65 | + author=stochman.__author__, |
| 66 | + author_email=stochman.__author_email__, |
| 67 | + license=stochman.__license__, |
| 68 | + packages=find_packages(), |
| 69 | + python_requires=">=3.8", |
| 70 | + install_requires=load_requirements(PATH_ROOT), |
| 71 | + classifiers=[ |
| 72 | + "Environment :: Console", |
| 73 | + "Natural Language :: English", |
| 74 | + # How mature is this project? Common values are |
| 75 | + # 3 - Alpha, 4 - Beta, 5 - Production/Stable |
| 76 | + "Development Status :: 3 - Alpha", |
| 77 | + # Indicate who your project is intended for |
| 78 | + "Intended Audience :: Developers", |
| 79 | + "Topic :: Scientific/Engineering :: Artificial Intelligence", |
| 80 | + # Pick your license as you wish |
| 81 | + "License :: OSI Approved :: Apache Software License", |
| 82 | + "Operating System :: OS Independent", |
| 83 | + # Specify the Python versions you support here. In particular, ensure |
| 84 | + # that you indicate whether you support Python 2, Python 3 or both. |
| 85 | + "Programming Language :: Python :: 3.8", |
| 86 | + ], |
| 87 | +) |
0 commit comments