Skip to content

Commit 726c573

Browse files
committed
Cleanup setup.py
1 parent 8f790d3 commit 726c573

File tree

1 file changed

+33
-98
lines changed

1 file changed

+33
-98
lines changed

setup.py

Lines changed: 33 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,46 @@
1-
#!/usr/bin/env python
2-
3-
# Stolen from Shapely's setup.py
4-
# Two environment variables influence this script.
5-
#
6-
# PDAL_LIBRARY_PATH: a path to a PDAL C++ shared library.
7-
#
8-
# PDAL_CONFIG: the path to a pdal-config program that points to PDAL version,
9-
# headers, and libraries.
10-
#
11-
# NB: within this setup scripts, software versions are evaluated according
12-
# to https://www.python.org/dev/peps/pep-0440/.
13-
14-
import logging
15-
import os
16-
import platform
17-
import sys
18-
import numpy
19-
import glob
20-
import sysconfig
21-
import setuptools
221
from skbuild import setup
23-
from packaging.version import Version
24-
25-
26-
27-
def get_pdal_config(option):
28-
'''Get configuration option from the `pdal-config` development utility
29-
30-
This code was adapted from Shapely's geos-config stuff
31-
'''
32-
import subprocess
33-
pdal_config = os.environ.get('PDAL_CONFIG','pdal-config')
34-
if not pdal_config or not isinstance(pdal_config, str):
35-
raise OSError('Path to pdal-config is not set')
36-
try:
37-
stdout, stderr = subprocess.Popen(
38-
[pdal_config, option],
39-
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
40-
except OSError as ex:
41-
# e.g., [Errno 2] No such file or directory
42-
raise OSError(
43-
'Could not find pdal-config %r: %s' % (pdal_config, ex))
44-
if stderr and not stdout:
45-
raise ValueError(stderr.strip())
46-
if sys.version_info[0] >= 3:
47-
result = stdout.decode('ascii').strip()
48-
else:
49-
result = stdout.strip()
50-
return result
512

523
# Get the version from the pdal module
53-
module_version = None
54-
with open('pdal/__init__.py', 'r') as fp:
4+
with open("pdal/__init__.py", "r") as fp:
555
for line in fp:
566
if line.startswith("__version__"):
57-
module_version = Version(line.split("=")[1].strip().strip("\"'"))
7+
version = line.split("=")[1].strip().strip("\"'")
588
break
9+
else:
10+
raise ValueError("Could not determine Python package version")
5911

60-
if not module_version:
61-
raise ValueError("Could not determine Python package version")
62-
63-
# Handle UTF-8 encoding of certain text files.
64-
open_kwds = {}
65-
if sys.version_info >= (3,):
66-
open_kwds['encoding'] = 'utf-8'
67-
68-
with open('README.rst', 'r', **open_kwds) as fp:
12+
with open("README.rst", "r", encoding="utf-8") as fp:
6913
readme = fp.read()
7014

71-
with open('CHANGES.txt', 'r', **open_kwds) as fp:
15+
with open("CHANGES.txt", "r", encoding="utf-8") as fp:
7216
changes = fp.read()
7317

74-
long_description = readme + '\n\n' + changes
75-
76-
# https://github.com/ktbarrett/hello/blob/master/CMakeLists.txt
77-
78-
setup_args = dict(
79-
name = 'PDAL',
80-
version = str(module_version),
81-
requires = ['Python (>=3.0)', 'Numpy'],
82-
description = 'Point cloud data processing',
83-
license = 'BSD',
84-
keywords = 'point cloud spatial',
85-
author = 'Howard Butler',
86-
author_email = '[email protected]',
87-
maintainer = 'Howard Butler',
88-
maintainer_email = '[email protected]',
89-
url = 'https://pdal.io',
90-
long_description = long_description,
91-
long_description_content_type = 'text/x-rst',
92-
test_suite = 'test',
93-
packages = [
94-
'pdal',
18+
setup(
19+
name="PDAL",
20+
version=version,
21+
requires=["Python (>=3.0)", "Numpy"],
22+
description="Point cloud data processing",
23+
license="BSD",
24+
keywords="point cloud spatial",
25+
author="Howard Butler",
26+
author_email="[email protected]",
27+
maintainer="Howard Butler",
28+
maintainer_email="[email protected]",
29+
url="https://pdal.io",
30+
long_description=readme + "\n\n" + changes,
31+
long_description_content_type="text/x-rst",
32+
test_suite="test",
33+
packages=["pdal"],
34+
include_package_data=False,
35+
classifiers=[
36+
"Development Status :: 5 - Production/Stable",
37+
"Intended Audience :: Developers",
38+
"Intended Audience :: Science/Research",
39+
"License :: OSI Approved :: BSD License",
40+
"Operating System :: OS Independent",
41+
"Programming Language :: Python :: 3.6",
42+
"Programming Language :: Python :: 3.7",
43+
"Programming Language :: Python :: 3.8",
44+
"Topic :: Scientific/Engineering :: GIS",
9545
],
96-
include_package_data = False,
97-
classifiers = [
98-
'Development Status :: 5 - Production/Stable',
99-
'Intended Audience :: Developers',
100-
'Intended Audience :: Science/Research',
101-
'License :: OSI Approved :: BSD License',
102-
'Operating System :: OS Independent',
103-
'Programming Language :: Python :: 3.6',
104-
'Programming Language :: Python :: 3.7',
105-
'Programming Language :: Python :: 3.8',
106-
'Topic :: Scientific/Engineering :: GIS',
107-
],
108-
10946
)
110-
output = setup(**setup_args)
111-

0 commit comments

Comments
 (0)