1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Setup script for gdal-utils.
from glob import glob
# from importlib.metadata import entry_points
from pathlib import Path
from setuptools import find_packages, setup
from osgeo_utils import (
__author__,
__author_email__,
__description__,
__license_type__,
__maintainer__,
__maintainer_email__,
__package_name__,
__url__,
__version__,
)
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: GIS",
"Topic :: Scientific/Engineering :: Information Analysis",
]
__readme__ = open("README.rst", encoding="utf-8").read()
__readme_type__ = "text/x-rst"
package_root = "." # package sources are under this dir
packages = find_packages(package_root) # include all packages under package_root
package_dir = {"": package_root} # packages sources are under package_root
scripts = sorted(glob("./osgeo_utils/*.py"), reverse=True) # command line scripts
def define_entry_points(scripts, entry_points=None):
"""
Return a dict defining scripts that get installed to PYTHONHOME/Scripts.
console_scripts : [
# CLI_command = dirname.filename
'gdal_edit = osgeo_utils.gdal_edit',
'gdal_merge = osgeo_utils.gdal_merge',
... ]
"""
console_scripts = []
for f in scripts:
name = Path(f).stem # 'gdal_edit' from 'gdal_edit.py'
console_scripts.append([f"{name} = osgeo_utils.{name}:main"])
entry_points = {"console_scripts": console_scripts}
return entry_points
setup(
name=__package_name__,
version=__version__,
author=__author__,
author_email=__author_email__,
maintainer=__maintainer__,
maintainer_email=__maintainer_email__,
long_description=__readme__,
long_description_content_type=__readme_type__,
description=__description__,
license=__license_type__,
classifiers=classifiers,
url=__url__,
python_requires=">=3.6.0",
packages=packages,
package_dir=package_dir,
# scripts=glob('./scripts/*.py'), # use entry_points console_script instead
install_requires=["gdal"],
extras_require={"numpy": ["numpy > 1.0.0"]},
entry_points=define_entry_points(scripts),
)
|