Spaces:
Running
Running
JunchuanYu
commited on
Commit
•
b1ef6db
1
Parent(s):
9472391
Delete lib
Browse files- lib/Dockerfile.wheels +0 -190
- lib/GDAL-3.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl +0 -3
- lib/Makefile +0 -7
- lib/build-linux-wheels.sh +0 -23
- lib/gdalinit.py +0 -40
- lib/setup.py +0 -353
lib/Dockerfile.wheels
DELETED
@@ -1,190 +0,0 @@
|
|
1 |
-
# An image for building manylinux1 wheels equivalent to those that
|
2 |
-
# https://github.com/sgillies/frs-wheel-builds makes for macosx.
|
3 |
-
#
|
4 |
-
# TODO: Figure out how to make the builds for osx!
|
5 |
-
#
|
6 |
-
# Note well: a very limited set of format drivers are included in these
|
7 |
-
# wheels. See the GDAL configuration below for details.
|
8 |
-
|
9 |
-
FROM quay.io/pypa/manylinux1_x86_64
|
10 |
-
|
11 |
-
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf \
|
12 |
-
&& sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo \
|
13 |
-
&& sed -i 's|#baseurl=http://mirror.centos.org/centos/$releasever|baseurl=http://vault.centos.org/5.11|' /etc/yum.repos.d/CentOS-Base.repo
|
14 |
-
|
15 |
-
RUN yum update -y && yum install -y curl-devel json-c-devel zlib-devel libtiff-devel postgresql-devel
|
16 |
-
|
17 |
-
# Install openssl
|
18 |
-
RUN mkdir -p /src \
|
19 |
-
&& cd /src \
|
20 |
-
&& curl -f -L -O https://www.openssl.org/source/openssl-1.0.2o.tar.gz \
|
21 |
-
&& echo "ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d openssl-1.0.2o.tar.gz" > checksum \
|
22 |
-
&& sha256sum -c checksum \
|
23 |
-
&& tar zxf openssl-1.0.2o.tar.gz \
|
24 |
-
&& cd /src/openssl-1.0.2o \
|
25 |
-
&& ./config no-shared no-ssl2 no-async -fPIC -O2 \
|
26 |
-
&& make -j 4 \
|
27 |
-
&& make install \
|
28 |
-
&& rm -rf /src
|
29 |
-
|
30 |
-
# Install curl
|
31 |
-
RUN mkdir -p /src \
|
32 |
-
&& cd /src \
|
33 |
-
&& curl -f -L -O http://curl.askapache.com/download/curl-7.73.0.tar.bz2 \
|
34 |
-
&& tar jxf curl-7.73.0.tar.bz2 \
|
35 |
-
&& cd /src/curl-7.73.0 \
|
36 |
-
&& LIBS=-ldl CFLAGS="-O2 -Wl,-S" ./configure --with-ssl=/usr/local/ssl \
|
37 |
-
&& make -j 4 \
|
38 |
-
&& make install \
|
39 |
-
&& rm -rf /src
|
40 |
-
|
41 |
-
# Install geos
|
42 |
-
RUN mkdir -p /src \
|
43 |
-
&& cd /src \
|
44 |
-
&& curl -f -L -O http://download.osgeo.org/geos/geos-3.9.0.tar.bz2 \
|
45 |
-
&& tar jxf geos-3.9.0.tar.bz2 \
|
46 |
-
&& cd /src/geos-3.9.0 \
|
47 |
-
&& CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure \
|
48 |
-
&& make -j 4 \
|
49 |
-
&& make install \
|
50 |
-
&& rm -rf /src
|
51 |
-
|
52 |
-
# Install jasper
|
53 |
-
RUN mkdir -p /src \
|
54 |
-
&& cd /src \
|
55 |
-
&& curl -f -L -O http://download.osgeo.org/gdal/jasper-1.900.1.uuid.tar.gz \
|
56 |
-
&& tar xzf jasper-1.900.1.uuid.tar.gz \
|
57 |
-
&& cd /src/jasper-1.900.1.uuid \
|
58 |
-
&& ./configure --disable-debug --enable-shared \
|
59 |
-
&& make -j 4 \
|
60 |
-
&& make install \
|
61 |
-
&& rm -rf /src
|
62 |
-
|
63 |
-
# proj4
|
64 |
-
RUN mkdir -p /src \
|
65 |
-
&& cd /src \
|
66 |
-
&& curl -f -L -O http://download.osgeo.org/proj/proj-4.9.3.tar.gz \
|
67 |
-
&& tar xzf proj-4.9.3.tar.gz \
|
68 |
-
&& cd /src/proj-4.9.3 \
|
69 |
-
&& ./configure CFLAGS="-O2 -Wl,-S" \
|
70 |
-
&& make -j 4 \
|
71 |
-
&& make install \
|
72 |
-
&& rm -rf /src
|
73 |
-
|
74 |
-
# cmake
|
75 |
-
RUN cd /usr/local/src \
|
76 |
-
&& curl -f -L -O http://www.cmake.org/files/v3.13/cmake-3.13.5.tar.gz \
|
77 |
-
&& tar xzf cmake-3.13.5.tar.gz \
|
78 |
-
&& cd cmake-3.13.5 \
|
79 |
-
&& ./bootstrap --prefix=/usr/local/cmake \
|
80 |
-
&& make -j 4; make install
|
81 |
-
|
82 |
-
# openjpeg
|
83 |
-
RUN mkdir -p /src \
|
84 |
-
&& cd /src \
|
85 |
-
&& curl -f -L -O https://github.com/uclouvain/openjpeg/archive/v2.4.0.tar.gz \
|
86 |
-
&& tar xzf v2.4.0.tar.gz \
|
87 |
-
&& cd /src/openjpeg-2.4.0 \
|
88 |
-
&& mkdir -p build \
|
89 |
-
&& cd build \
|
90 |
-
&& /usr/local/cmake/bin/cmake .. -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
|
91 |
-
&& make -j 4 install \
|
92 |
-
&& make clean \
|
93 |
-
&& rm -rf /src
|
94 |
-
|
95 |
-
# hdf5
|
96 |
-
RUN cd /usr/local/src \
|
97 |
-
&& curl -f -L -O https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/src/hdf5-1.12.0.tar.gz \
|
98 |
-
&& tar xzf hdf5-1.12.0.tar.gz \
|
99 |
-
&& cd hdf5-1.12.0 \
|
100 |
-
&& ./configure --prefix=/usr/local --enable-shared --enable-build-mode=production CFLAGS="-O2 -Wl,-S" \
|
101 |
-
&& make -j 4 \
|
102 |
-
&& make install
|
103 |
-
|
104 |
-
## netcdf
|
105 |
-
RUN cd /usr/local/src \
|
106 |
-
&& curl -f -L -O ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.6.1.tar.gz \
|
107 |
-
&& tar xzf netcdf-4.6.1.tar.gz \
|
108 |
-
&& cd netcdf-4.6.1 \
|
109 |
-
&& CFLAGS="-I/usr/local/include -O2 -Wl,-S" CXXFLAGS="-I/usr/local/include -O2 -Wl,-S" LDFLAGS="-L/usr/local/lib" ./configure \
|
110 |
-
&& make -j 4 \
|
111 |
-
&& make install
|
112 |
-
|
113 |
-
## expat
|
114 |
-
RUN cd /usr/local/src \
|
115 |
-
&& curl -f -L -O https://github.com/libexpat/libexpat/releases/download/R_2_2_10/expat-2.2.10.tar.bz2 \
|
116 |
-
&& tar xjf expat-2.2.10.tar.bz2 \
|
117 |
-
&& cd expat-2.2.10 \
|
118 |
-
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
|
119 |
-
&& make -j 4 \
|
120 |
-
&& make install
|
121 |
-
|
122 |
-
## webp
|
123 |
-
RUN cd /usr/local/src \
|
124 |
-
&& curl -f -L -O https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.0.tar.gz \
|
125 |
-
&& tar xzf libwebp-1.2.0.tar.gz \
|
126 |
-
&& cd libwebp-1.2.0 \
|
127 |
-
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
|
128 |
-
&& make -j 4 \
|
129 |
-
&& make install
|
130 |
-
|
131 |
-
# gdal
|
132 |
-
RUN mkdir -p /src \
|
133 |
-
&& cd /src \
|
134 |
-
&& curl -f -L -O http://download.osgeo.org/gdal/2.4.4/gdal-2.4.4.tar.gz \
|
135 |
-
&& tar xzf gdal-2.4.4.tar.gz \
|
136 |
-
&& cd /src/gdal-2.4.4 \
|
137 |
-
&& CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure \
|
138 |
-
--with-threads \
|
139 |
-
--disable-debug \
|
140 |
-
--disable-static \
|
141 |
-
--without-grass \
|
142 |
-
--without-libgrass \
|
143 |
-
--without-jpeg12 \
|
144 |
-
--with-libtiff \
|
145 |
-
--with-jpeg \
|
146 |
-
--with-pg \
|
147 |
-
--with-gif \
|
148 |
-
--with-png \
|
149 |
-
--with-webp \
|
150 |
-
--with-geotiff=internal \
|
151 |
-
--with-sqlite3=/usr \
|
152 |
-
--with-pcraster=internal \
|
153 |
-
--with-pcidsk=internal \
|
154 |
-
--with-bsb \
|
155 |
-
--with-grib \
|
156 |
-
--with-pam \
|
157 |
-
--with-geos=/usr/local/bin/geos-config \
|
158 |
-
--with-static-proj4=/usr/local \
|
159 |
-
--with-expat=/usr/local \
|
160 |
-
--with-libjson-c \
|
161 |
-
--with-libiconv-prefix=/usr \
|
162 |
-
--with-libz=/usr \
|
163 |
-
--with-curl=/usr/local/bin/curl-config \
|
164 |
-
--with-netcdf=/usr/local/netcdf \
|
165 |
-
--with-openjpeg \
|
166 |
-
--with-jasper=/usr/local \
|
167 |
-
--with-hdf5=/usr/local \
|
168 |
-
--without-python \
|
169 |
-
--without-hdf4 \
|
170 |
-
&& make -j 12 \
|
171 |
-
&& make install
|
172 |
-
|
173 |
-
# Bake dev requirements into the Docker image for faster builds
|
174 |
-
ADD requirements.txt /tmp/requirements.txt
|
175 |
-
RUN for PYBIN in /opt/python/*/bin; do \
|
176 |
-
$PYBIN/pip install -U pip || true; \
|
177 |
-
$PYBIN/pip install -r /tmp/requirements.txt || true; \
|
178 |
-
done
|
179 |
-
|
180 |
-
# Replace SWIG's setup.py with this modified one, which gets numpy in
|
181 |
-
# there as a dependency.
|
182 |
-
ADD setup.py /src/gdal-2.4.4/swig/python/setup.py
|
183 |
-
|
184 |
-
# Replace the osgeo module __init__.py with this modified one, which
|
185 |
-
# sets the GDAL_DATA and PROJ_LIB variables on import to where they've
|
186 |
-
# been copied to.
|
187 |
-
ADD gdalinit.py /src/gdal-2.4.4/swig/python/osgeo/__init__.py
|
188 |
-
|
189 |
-
WORKDIR /io
|
190 |
-
CMD ["/io/build-linux-wheels.sh"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/GDAL-3.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:8e5714dfc0a4b75cb799e1c6e70870ac1e7aeea6caad79fa0a72e7f57248c0fc
|
3 |
-
size 76042352
|
|
|
|
|
|
|
|
lib/Makefile
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
# GDAL python bindings make file.
|
2 |
-
|
3 |
-
SHELL = /bin/bash
|
4 |
-
|
5 |
-
wheels: Dockerfile.wheels build-linux-wheels.sh
|
6 |
-
docker build -f Dockerfile.wheels -t gdal-wheelbuilder .
|
7 |
-
docker run -v `pwd`:/io gdal-wheelbuilder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/build-linux-wheels.sh
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
set -e
|
3 |
-
|
4 |
-
GDAL_BUILD_PATH=/src/gdal-2.4.4/swig/python
|
5 |
-
ORIGINAL_PATH=$PATH
|
6 |
-
UNREPAIRED_WHEELS=/tmp/wheels
|
7 |
-
|
8 |
-
# Enable devtoolset-2 for C++11
|
9 |
-
source /opt/rh/devtoolset-2/enable
|
10 |
-
|
11 |
-
# Compile wheels
|
12 |
-
pushd ${GDAL_BUILD_PATH}
|
13 |
-
for PYBIN in /opt/python/*/bin; do
|
14 |
-
export PATH=${PYBIN}:$ORIGINAL_PATH
|
15 |
-
rm -rf build
|
16 |
-
CFLAGS="-std=c++11" python setup.py bdist_wheel -d ${UNREPAIRED_WHEELS} || true
|
17 |
-
done
|
18 |
-
popd
|
19 |
-
|
20 |
-
# Bundle GEOS into the wheels
|
21 |
-
for whl in ${UNREPAIRED_WHEELS}/*.whl; do
|
22 |
-
auditwheel repair ${whl} -w wheels || true
|
23 |
-
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/gdalinit.py
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
# __init__ for osgeo package.
|
2 |
-
import os
|
3 |
-
import sys
|
4 |
-
|
5 |
-
# making the osgeo package version the same as the gdal version:
|
6 |
-
from sys import version_info
|
7 |
-
if version_info >= (2,6,0):
|
8 |
-
def swig_import_helper():
|
9 |
-
from os.path import dirname
|
10 |
-
import imp
|
11 |
-
fp = None
|
12 |
-
try:
|
13 |
-
fp, pathname, description = imp.find_module('_gdal', [dirname(__file__)])
|
14 |
-
except ImportError:
|
15 |
-
import _gdal
|
16 |
-
return _gdal
|
17 |
-
if fp is not None:
|
18 |
-
try:
|
19 |
-
_mod = imp.load_module('_gdal', fp, pathname, description)
|
20 |
-
finally:
|
21 |
-
fp.close()
|
22 |
-
return _mod
|
23 |
-
_gdal = swig_import_helper()
|
24 |
-
del swig_import_helper
|
25 |
-
else:
|
26 |
-
import _gdal
|
27 |
-
|
28 |
-
__version__ = _gdal.__version__ = _gdal.VersionInfo("RELEASE_NAME")
|
29 |
-
|
30 |
-
# Set gdal and proj data directories.
|
31 |
-
if 'GDAL_DATA' not in os.environ:
|
32 |
-
whl_datadir = os.path.abspath(os.path.join(os.path.dirname(__file__), "gdal_data"))
|
33 |
-
share_datadir = os.path.join(sys.prefix, 'share/gdal')
|
34 |
-
if os.path.exists(os.path.join(whl_datadir, 'pcs.csv')):
|
35 |
-
os.environ['GDAL_DATA'] = whl_datadir
|
36 |
-
elif os.path.exists(os.path.join(share_datadir, 'pcs.csv')):
|
37 |
-
os.environ['GDAL_DATA'] = share_datadir
|
38 |
-
if 'PROJ_LIB' not in os.environ:
|
39 |
-
whl_datadir = os.path.abspath(os.path.join(os.path.dirname(__file__), "proj_data"))
|
40 |
-
os.environ['PROJ_LIB'] = whl_datadir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/setup.py
DELETED
@@ -1,353 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python
|
2 |
-
# -*- coding: utf-8 -*-
|
3 |
-
|
4 |
-
# Setup script for GDAL Python bindings.
|
5 |
-
# Inspired by psycopg2 setup.py file
|
6 |
-
# http://www.initd.org/tracker/psycopg/browser/psycopg2/trunk/setup.py
|
7 |
-
# Howard Butler hobu.inc@gmail.com
|
8 |
-
|
9 |
-
|
10 |
-
gdal_version = '2.4.4'
|
11 |
-
|
12 |
-
import sys
|
13 |
-
import shutil
|
14 |
-
import os
|
15 |
-
|
16 |
-
from glob import glob
|
17 |
-
|
18 |
-
# ---------------------------------------------------------------------------
|
19 |
-
# Switches
|
20 |
-
# ---------------------------------------------------------------------------
|
21 |
-
|
22 |
-
HAVE_NUMPY=False
|
23 |
-
HAVE_SETUPTOOLS = False
|
24 |
-
BUILD_FOR_CHEESESHOP = False
|
25 |
-
GNM_ENABLED = False
|
26 |
-
|
27 |
-
# ---------------------------------------------------------------------------
|
28 |
-
# Default build options
|
29 |
-
# (may be overridden with setup.cfg or command line switches).
|
30 |
-
# ---------------------------------------------------------------------------
|
31 |
-
|
32 |
-
include_dirs = ['../../port', '../../gcore', '../../alg', '../../ogr/', '../../ogr/ogrsf_frmts', '../../gnm', '../../apps']
|
33 |
-
library_dirs = ['../../.libs', '../../']
|
34 |
-
libraries = ['gdal']
|
35 |
-
|
36 |
-
# ---------------------------------------------------------------------------
|
37 |
-
# Helper Functions
|
38 |
-
# ---------------------------------------------------------------------------
|
39 |
-
|
40 |
-
# Function to find numpy's include directory
|
41 |
-
def get_numpy_include():
|
42 |
-
if HAVE_NUMPY:
|
43 |
-
return numpy.get_include()
|
44 |
-
else:
|
45 |
-
return '.'
|
46 |
-
|
47 |
-
def copy_data_tree(datadir, destdir):
|
48 |
-
try:
|
49 |
-
shutil.rmtree(destdir)
|
50 |
-
except OSError:
|
51 |
-
pass
|
52 |
-
shutil.copytree(datadir, destdir)
|
53 |
-
|
54 |
-
# ---------------------------------------------------------------------------
|
55 |
-
# Imports
|
56 |
-
# ---------------------------------------------------------------------------
|
57 |
-
|
58 |
-
try:
|
59 |
-
import numpy
|
60 |
-
HAVE_NUMPY = True
|
61 |
-
# check version
|
62 |
-
numpy_major = numpy.__version__.split('.')[0]
|
63 |
-
if int(numpy_major) < 1:
|
64 |
-
print("numpy version must be > 1.0.0")
|
65 |
-
HAVE_NUMPY = False
|
66 |
-
else:
|
67 |
-
# print ('numpy include', get_numpy_include())
|
68 |
-
if get_numpy_include() =='.':
|
69 |
-
print("numpy headers were not found! Array support will not be enabled")
|
70 |
-
HAVE_NUMPY=False
|
71 |
-
except ImportError:
|
72 |
-
pass
|
73 |
-
|
74 |
-
fixer_names = [
|
75 |
-
'lib2to3.fixes.fix_import',
|
76 |
-
'lib2to3.fixes.fix_next',
|
77 |
-
'lib2to3.fixes.fix_renames',
|
78 |
-
'lib2to3.fixes.fix_unicode',
|
79 |
-
'lib2to3.fixes.fix_ws_comma',
|
80 |
-
'lib2to3.fixes.fix_xrange',
|
81 |
-
]
|
82 |
-
extra = {}
|
83 |
-
try:
|
84 |
-
from setuptools import setup
|
85 |
-
from setuptools import Extension
|
86 |
-
HAVE_SETUPTOOLS = True
|
87 |
-
except ImportError:
|
88 |
-
from distutils.core import setup, Extension
|
89 |
-
|
90 |
-
try:
|
91 |
-
from distutils.command.build_py import build_py_2to3 as build_py
|
92 |
-
from distutils.command.build_scripts import build_scripts_2to3 as build_scripts
|
93 |
-
except ImportError:
|
94 |
-
from distutils.command.build_py import build_py
|
95 |
-
from distutils.command.build_scripts import build_scripts
|
96 |
-
else:
|
97 |
-
build_py.fixer_names = fixer_names
|
98 |
-
build_scripts.fixer_names = fixer_names
|
99 |
-
else:
|
100 |
-
if sys.version_info >= (3,):
|
101 |
-
from lib2to3.refactor import get_fixers_from_package
|
102 |
-
|
103 |
-
all_fixers = set(get_fixers_from_package('lib2to3.fixes'))
|
104 |
-
exclude_fixers = sorted(all_fixers.difference(fixer_names))
|
105 |
-
|
106 |
-
extra['use_2to3'] = True
|
107 |
-
extra['use_2to3_fixers'] = []
|
108 |
-
extra['use_2to3_exclude_fixers'] = exclude_fixers
|
109 |
-
|
110 |
-
class gdal_config_error(Exception): pass
|
111 |
-
|
112 |
-
|
113 |
-
from distutils.command.build_ext import build_ext
|
114 |
-
from distutils.ccompiler import get_default_compiler
|
115 |
-
|
116 |
-
def fetch_config(option, gdal_config='gdal-config'):
|
117 |
-
|
118 |
-
command = gdal_config + " --%s" % option
|
119 |
-
|
120 |
-
try:
|
121 |
-
import subprocess
|
122 |
-
command, args = command.split()[0], command.split()[1]
|
123 |
-
from sys import version_info
|
124 |
-
if version_info >= (3,0,0):
|
125 |
-
try:
|
126 |
-
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
|
127 |
-
except OSError:
|
128 |
-
import sys
|
129 |
-
e = sys.exc_info()[1]
|
130 |
-
raise gdal_config_error(e)
|
131 |
-
r = p.stdout.readline().decode('ascii').strip()
|
132 |
-
else:
|
133 |
-
exec("""try:
|
134 |
-
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
|
135 |
-
except OSError, e:
|
136 |
-
raise gdal_config_error, e""")
|
137 |
-
r = p.stdout.readline().strip()
|
138 |
-
p.stdout.close()
|
139 |
-
p.wait()
|
140 |
-
|
141 |
-
except ImportError:
|
142 |
-
|
143 |
-
import popen2
|
144 |
-
|
145 |
-
p = popen2.popen3(command)
|
146 |
-
r = p[0].readline().strip()
|
147 |
-
if not r:
|
148 |
-
raise Warning(p[2].readline())
|
149 |
-
|
150 |
-
return r
|
151 |
-
|
152 |
-
class gdal_ext(build_ext):
|
153 |
-
|
154 |
-
GDAL_CONFIG = 'gdal-config'
|
155 |
-
user_options = build_ext.user_options[:]
|
156 |
-
user_options.extend([
|
157 |
-
('gdal-config=', None,
|
158 |
-
"The name of the gdal-config binary and/or a full path to it"),
|
159 |
-
])
|
160 |
-
|
161 |
-
def initialize_options(self):
|
162 |
-
build_ext.initialize_options(self)
|
163 |
-
|
164 |
-
self.numpy_include_dir = get_numpy_include()
|
165 |
-
self.gdaldir = None
|
166 |
-
self.gdal_config = self.GDAL_CONFIG
|
167 |
-
self.already_raised_no_config_error = False
|
168 |
-
|
169 |
-
def get_compiler(self):
|
170 |
-
return self.compiler or get_default_compiler()
|
171 |
-
|
172 |
-
def get_gdal_config(self, option):
|
173 |
-
try:
|
174 |
-
return fetch_config(option, gdal_config = self.gdal_config)
|
175 |
-
except gdal_config_error:
|
176 |
-
# If an error is thrown, it is possibly because
|
177 |
-
# the gdal-config location given in setup.cfg is
|
178 |
-
# incorrect, or possibly the default -- ../../apps/gdal-config
|
179 |
-
# We'll try one time to use the gdal-config that might be
|
180 |
-
# on the path. If that fails, we're done, however.
|
181 |
-
if not self.already_raised_no_config_error:
|
182 |
-
self.already_raised_no_config_error = True
|
183 |
-
return fetch_config(option)
|
184 |
-
|
185 |
-
def finalize_options(self):
|
186 |
-
if self.include_dirs is None:
|
187 |
-
self.include_dirs = include_dirs
|
188 |
-
if self.library_dirs is None:
|
189 |
-
self.library_dirs = library_dirs
|
190 |
-
if self.libraries is None:
|
191 |
-
if self.get_compiler() == 'msvc':
|
192 |
-
libraries.remove('gdal')
|
193 |
-
libraries.append('gdal_i')
|
194 |
-
self.libraries = libraries
|
195 |
-
|
196 |
-
build_ext.finalize_options(self)
|
197 |
-
|
198 |
-
self.include_dirs.append(self.numpy_include_dir)
|
199 |
-
|
200 |
-
if self.get_compiler() == 'msvc':
|
201 |
-
return True
|
202 |
-
|
203 |
-
self.gdaldir = self.get_gdal_config('prefix')
|
204 |
-
self.library_dirs.append(os.path.join(self.gdaldir,'lib'))
|
205 |
-
self.include_dirs.append(os.path.join(self.gdaldir,'include'))
|
206 |
-
|
207 |
-
|
208 |
-
extra_link_args = []
|
209 |
-
extra_compile_args = []
|
210 |
-
|
211 |
-
if sys.platform == 'darwin' and [int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0]:
|
212 |
-
# since MacOS X 10.9, clang no longer accepts -mno-fused-madd
|
213 |
-
#extra_compile_args.append('-Qunused-arguments')
|
214 |
-
os.environ['ARCHFLAGS'] = '-Wno-error=unused-command-line-argument-hard-error-in-future'
|
215 |
-
|
216 |
-
gdal_module = Extension('osgeo._gdal',
|
217 |
-
sources=['extensions/gdal_wrap.cpp'],
|
218 |
-
extra_compile_args = extra_compile_args,
|
219 |
-
extra_link_args = extra_link_args)
|
220 |
-
|
221 |
-
gdalconst_module = Extension('osgeo._gdalconst',
|
222 |
-
sources=['extensions/gdalconst_wrap.c'],
|
223 |
-
extra_compile_args = extra_compile_args,
|
224 |
-
extra_link_args = extra_link_args)
|
225 |
-
|
226 |
-
osr_module = Extension('osgeo._osr',
|
227 |
-
sources=['extensions/osr_wrap.cpp'],
|
228 |
-
extra_compile_args = extra_compile_args,
|
229 |
-
extra_link_args = extra_link_args)
|
230 |
-
|
231 |
-
ogr_module = Extension('osgeo._ogr',
|
232 |
-
sources=['extensions/ogr_wrap.cpp'],
|
233 |
-
extra_compile_args = extra_compile_args,
|
234 |
-
extra_link_args = extra_link_args)
|
235 |
-
|
236 |
-
|
237 |
-
array_module = Extension('osgeo._gdal_array',
|
238 |
-
sources=['extensions/gdal_array_wrap.cpp'],
|
239 |
-
extra_compile_args = extra_compile_args,
|
240 |
-
extra_link_args = extra_link_args)
|
241 |
-
|
242 |
-
gnm_module = Extension('osgeo._gnm',
|
243 |
-
sources=['extensions/gnm_wrap.cpp'],
|
244 |
-
extra_compile_args = extra_compile_args,
|
245 |
-
extra_link_args = extra_link_args)
|
246 |
-
|
247 |
-
ext_modules = [gdal_module,
|
248 |
-
gdalconst_module,
|
249 |
-
osr_module,
|
250 |
-
ogr_module]
|
251 |
-
|
252 |
-
py_modules = ['gdal',
|
253 |
-
'ogr',
|
254 |
-
'osr',
|
255 |
-
'gdalconst']
|
256 |
-
|
257 |
-
if os.path.exists('setup_vars.ini'):
|
258 |
-
with open('setup_vars.ini') as f:
|
259 |
-
lines = f.readlines()
|
260 |
-
if 'GNM_ENABLED=yes' in lines or 'GNM_ENABLED=yes\n' in lines:
|
261 |
-
GNM_ENABLED = True
|
262 |
-
|
263 |
-
if GNM_ENABLED:
|
264 |
-
ext_modules.append(gnm_module)
|
265 |
-
py_modules.append('gnm')
|
266 |
-
|
267 |
-
|
268 |
-
if HAVE_NUMPY:
|
269 |
-
ext_modules.append(array_module)
|
270 |
-
py_modules.append('gdalnumeric')
|
271 |
-
|
272 |
-
packages = ["osgeo",]
|
273 |
-
|
274 |
-
readme = str(open('README.rst','rb').read())
|
275 |
-
|
276 |
-
name = 'GDAL'
|
277 |
-
version = gdal_version
|
278 |
-
author = "Frank Warmerdam"
|
279 |
-
author_email = "warmerdam@pobox.com"
|
280 |
-
maintainer = "Howard Butler"
|
281 |
-
maintainer_email = "hobu.inc@gmail.com"
|
282 |
-
description = "GDAL: Geospatial Data Abstraction Library"
|
283 |
-
license = "MIT"
|
284 |
-
url="http://www.gdal.org"
|
285 |
-
|
286 |
-
classifiers = [
|
287 |
-
'Development Status :: 5 - Production/Stable',
|
288 |
-
'Intended Audience :: Developers',
|
289 |
-
'Intended Audience :: Science/Research',
|
290 |
-
'License :: OSI Approved :: MIT License',
|
291 |
-
'Operating System :: OS Independent',
|
292 |
-
'Programming Language :: Python :: 2',
|
293 |
-
'Programming Language :: Python :: 3',
|
294 |
-
'Programming Language :: C',
|
295 |
-
'Programming Language :: C++',
|
296 |
-
'Topic :: Scientific/Engineering :: GIS',
|
297 |
-
'Topic :: Scientific/Engineering :: Information Analysis',
|
298 |
-
|
299 |
-
]
|
300 |
-
|
301 |
-
|
302 |
-
if BUILD_FOR_CHEESESHOP:
|
303 |
-
data_files = [("osgeo/data/gdal", glob(os.path.join("../../data", "*")))]
|
304 |
-
else:
|
305 |
-
data_files = None
|
306 |
-
|
307 |
-
exclude_package_data = {'':['GNUmakefile']}
|
308 |
-
|
309 |
-
# Copy gdal/proj data.
|
310 |
-
copy_data_tree('/usr/local/share/gdal', 'osgeo/gdal_data')
|
311 |
-
copy_data_tree('/usr/local/share/proj', 'osgeo/proj_data')
|
312 |
-
|
313 |
-
if HAVE_SETUPTOOLS:
|
314 |
-
setup( name = name,
|
315 |
-
version = gdal_version,
|
316 |
-
author = author,
|
317 |
-
author_email = author_email,
|
318 |
-
maintainer = maintainer,
|
319 |
-
maintainer_email = maintainer_email,
|
320 |
-
long_description = readme,
|
321 |
-
description = description,
|
322 |
-
license = license,
|
323 |
-
classifiers = classifiers,
|
324 |
-
py_modules = py_modules,
|
325 |
-
packages = packages,
|
326 |
-
url=url,
|
327 |
-
data_files = data_files,
|
328 |
-
zip_safe = False,
|
329 |
-
exclude_package_data = exclude_package_data,
|
330 |
-
cmdclass={'build_ext':gdal_ext},
|
331 |
-
ext_modules = ext_modules,
|
332 |
-
install_requires=['numpy=={}'.format(numpy.__version__)],
|
333 |
-
package_data={'osgeo': ['gdal_data/*', 'proj_data/*']},
|
334 |
-
**extra )
|
335 |
-
else:
|
336 |
-
setup( name = name,
|
337 |
-
version = gdal_version,
|
338 |
-
author = author,
|
339 |
-
author_email = author_email,
|
340 |
-
maintainer = maintainer,
|
341 |
-
maintainer_email = maintainer_email,
|
342 |
-
long_description = readme,
|
343 |
-
description = description,
|
344 |
-
license = license,
|
345 |
-
classifiers = classifiers,
|
346 |
-
py_modules = py_modules,
|
347 |
-
packages = packages,
|
348 |
-
data_files = data_files,
|
349 |
-
url=url,
|
350 |
-
cmdclass={'build_ext':gdal_ext,
|
351 |
-
'build_py': build_py,
|
352 |
-
'build_scripts': build_scripts},
|
353 |
-
ext_modules = ext_modules )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|