1# coding: utf-8
2from distutils.command.build_py import build_py
3from setuptools import setup
4
5package = "spreg"
6
7with open("README.md", encoding="utf8") as file:
8    long_description = file.read()
9
10with open("%s/__init__.py" % package, "r") as f:
11    exec(f.readline())
12
13
14def _get_requirements_from_files(groups_files):
15    groups_reqlist = {}
16
17    for k, v in groups_files.items():
18        with open(v, "r") as f:
19            pkg_list = f.read().splitlines()
20        groups_reqlist[k] = pkg_list
21
22    return groups_reqlist
23
24
25def setup_package():
26    # get all file endings and copy whole file names without a file suffix
27    # assumes nested directories are only down one level
28    _groups_files = {
29        "base": "requirements.txt",
30        "tests": "requirements_tests.txt",
31        "plus": "requirements_plus.txt",
32        "docs": "requirements_docs.txt",
33    }
34
35    reqs = _get_requirements_from_files(_groups_files)
36    install_reqs = reqs.pop("base")
37    extras_reqs = reqs
38
39    setup(
40        name=package,
41        version=__version__,
42        description="PySAL Spatial Econometrics Package",
43        long_description=long_description,
44        long_description_content_type="text/markdown",
45        maintainer="PySAL Developers",
46        maintainer_email="pysal-dev@googlegroups.com",
47        url="https://github.com/pysal/" + package,
48        download_url="https://pypi.python.org/pypi/%s" % package,
49        license="BSD",
50        py_modules=[package],
51        packages=[package],
52        keywords="spatial statistics",
53        classifiers=[
54            "Development Status :: 5 - Production/Stable",
55            "Intended Audience :: Science/Research",
56            "Intended Audience :: Developers",
57            "Intended Audience :: Education",
58            "Topic :: Scientific/Engineering",
59            "Topic :: Scientific/Engineering :: GIS",
60            "License :: OSI Approved :: BSD License",
61            "Programming Language :: Python",
62            "Programming Language :: Python :: 3.7",
63            "Programming Language :: Python :: 3.8",
64        ],
65        install_requires=install_reqs,
66        extras_require=extras_reqs,
67        cmdclass={"build_py": build_py},
68    )
69
70
71if __name__ == "__main__":
72    setup_package()
73