|
| 1 | +# ================================================================= |
| 2 | +# |
| 3 | +# Authors: Benjamin Webb <bwebb@lincolninst.edu> |
| 4 | +# |
| 5 | +# Copyright (c) 2023 Benjamin Webb |
| 6 | +# |
| 7 | +# Permission is hereby granted, free of charge, to any person |
| 8 | +# obtaining a copy of this software and associated documentation |
| 9 | +# files (the "Software"), to deal in the Software without |
| 10 | +# restriction, including without limitation the rights to use, |
| 11 | +# copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | +# copies of the Software, and to permit persons to whom the |
| 13 | +# Software is furnished to do so, subject to the following |
| 14 | +# conditions: |
| 15 | +# |
| 16 | +# The above copyright notice and this permission notice shall be |
| 17 | +# included in all copies or substantial portions of the Software. |
| 18 | +# |
| 19 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 20 | +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 21 | +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 22 | +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 23 | +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 24 | +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 25 | +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 26 | +# OTHER DEALINGS IN THE SOFTWARE. |
| 27 | +# |
| 28 | +# ================================================================= |
| 29 | + |
| 30 | +import io |
| 31 | +import os |
| 32 | +import re |
| 33 | +from setuptools import Command, find_packages, setup |
| 34 | + |
| 35 | + |
| 36 | +class PyTest(Command): |
| 37 | + user_options = [] |
| 38 | + |
| 39 | + def initialize_options(self): |
| 40 | + pass |
| 41 | + |
| 42 | + def finalize_options(self): |
| 43 | + pass |
| 44 | + |
| 45 | + def run(self): |
| 46 | + import subprocess |
| 47 | + errno = subprocess.call(['pytest']) |
| 48 | + raise SystemExit(errno) |
| 49 | + |
| 50 | + |
| 51 | +def read(filename, encoding='utf-8'): |
| 52 | + """read file contents""" |
| 53 | + full_path = os.path.join(os.path.dirname(__file__), filename) |
| 54 | + with io.open(full_path, encoding=encoding) as fh: |
| 55 | + contents = fh.read().strip() |
| 56 | + return contents |
| 57 | + |
| 58 | + |
| 59 | +def get_package_version(): |
| 60 | + """get version from top-level package init""" |
| 61 | + version_file = read('sitemap_generator/__init__.py') |
| 62 | + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", |
| 63 | + version_file, re.M) |
| 64 | + if version_match: |
| 65 | + return version_match.group(1) |
| 66 | + raise RuntimeError("Unable to find version string.") |
| 67 | + |
| 68 | + |
| 69 | +KEYWORDS = [ |
| 70 | + 'sitemap', |
| 71 | + 'cgs', |
| 72 | + 'internetofwater' |
| 73 | +] |
| 74 | + |
| 75 | +DESCRIPTION = ('Sitemap generator provides a python interface to generate' |
| 76 | + 'sitemap XML files.') |
| 77 | + |
| 78 | + |
| 79 | +# ensure a fresh MANIFEST file is generated |
| 80 | +if (os.path.exists('MANIFEST')): |
| 81 | + os.unlink('MANIFEST') |
| 82 | + |
| 83 | + |
| 84 | +setup( |
| 85 | + name='sitemap_generator', |
| 86 | + version=get_package_version(), |
| 87 | + description=DESCRIPTION.strip(), |
| 88 | + long_description=read('README.md'), |
| 89 | + long_description_content_type='text/markdown', |
| 90 | + license='MIT Software License', |
| 91 | + platforms='all', |
| 92 | + keywords=' '.join(KEYWORDS), |
| 93 | + author='Ben Webb', |
| 94 | + author_email='bwebb@lincolninst.edu', |
| 95 | + maintainer='Ben Webb', |
| 96 | + maintainer_email='bwebb@lincolninst.edu', |
| 97 | + url='https://github.com/cgs-earth/sitemap-generator', |
| 98 | + install_requires=read('requirements.txt').splitlines(), |
| 99 | + packages=find_packages(), |
| 100 | + include_package_data=True, |
| 101 | + entry_points={ |
| 102 | + 'console_scripts': [ |
| 103 | + 'sitemap-generator=sitemap_generator:cli' |
| 104 | + ] |
| 105 | + }, |
| 106 | + classifiers=[ |
| 107 | + 'Development Status :: 1 - Beta', |
| 108 | + 'Environment :: Console', |
| 109 | + 'Intended Audience :: Developers', |
| 110 | + 'Intended Audience :: Science/Research', |
| 111 | + 'License :: OSI Approved :: MIT Software License', |
| 112 | + 'Operating System :: OS Independent', |
| 113 | + 'Programming Language :: Python', |
| 114 | + 'Topic :: Scientific/Engineering :: Atmospheric Science', |
| 115 | + 'Topic :: Scientific/Engineering :: GIS', |
| 116 | + 'Topic :: Scientific/Engineering :: Information Analysis' |
| 117 | + ], |
| 118 | + project_urls={ |
| 119 | + 'Homepage': 'https://github.com/cgs-earth/sitemap-generator', |
| 120 | + 'Source Code': 'https://github.com/cgs-earth/sitemap-generator', |
| 121 | + 'Issue Tracker': 'https://github.com/cgs-earth/sitemap-generator/issues' |
| 122 | + }, |
| 123 | + cmdclass={'test': PyTest}, |
| 124 | + test_suite='tests.run_tests' |
| 125 | +) |
0 commit comments