Skip to content

Commit 64cd799

Browse files
committed
update appveyor build
1 parent 143beab commit 64cd799

File tree

5 files changed

+84
-63
lines changed

5 files changed

+84
-63
lines changed

appveyor.yml

+44-47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
platform:
2+
- x64
3+
14
# This is based on file and files in ci/appveyor are from
25
# https://github.com/ogrisel/python-appveyor-demo
36
environment:
@@ -13,57 +16,57 @@ environment:
1316
# build is limited to 60 minutes, without caching each build takes 10-30 minutes
1417
# with caching build takes less than 1 minute
1518

16-
# Python 2.6 will need to run this `pip install unittest2`
17-
# - PYTHON: "C:\\Python26"
18-
# PYTHON_VERSION: "2.6.x"
19-
# PYTHON_ARCH: "32"
20-
21-
# - PYTHON: "C:\\Python26-x64"
22-
# PYTHON_VERSION: "2.6.x"
23-
# PYTHON_ARCH: "64"
24-
25-
- PYTHON: "C:\\Python27"
26-
PYTHON_VERSION: "2.7.x"
27-
PYTHON_ARCH: "32"
28-
29-
- PYTHON: "C:\\Python27-x64"
30-
PYTHON_VERSION: "2.7.x"
31-
PYTHON_ARCH: "64"
32-
33-
# - PYTHON: "C:\\Python33"
34-
# PYTHON_VERSION: "3.3.x"
35-
# PYTHON_ARCH: "32"
36-
37-
- PYTHON: "C:\\Python33-x64"
38-
PYTHON_VERSION: "3.3.x"
19+
- PYTHON: "C:\\Python36-x64"
20+
PYTHON_VERSION: "3.6"
3921
PYTHON_ARCH: "64"
22+
VS_VERSION: Visual Studio 14
23+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
4024

41-
# - PYTHON: "C:\\Python34"
42-
# PYTHON_VERSION: "3.4.x"
43-
# PYTHON_ARCH: "32"
44-
45-
- PYTHON: "C:\\Python34-x64"
46-
PYTHON_VERSION: "3.4.x"
47-
PYTHON_ARCH: "64"
48-
49-
- PYTHON: "C:\\Python35"
50-
PYTHON_VERSION: "3.5.x"
51-
PYTHON_ARCH: "32"
52-
53-
- PYTHON: "C:\\Python35-x64"
54-
PYTHON_VERSION: "3.5.x"
55-
PYTHON_ARCH: "64"
25+
shallow_clone: true
5626

5727
cache:
5828
- C:\Users\appveyor\AppData\Local\pip\Cache\wheels
5929

30+
build_script:
31+
# setup sqlite3
32+
- vcpkg install sqlite3:"%platform%"-windows
33+
- set SQLITE3_BIN=%APPVEYOR_BUILD_FOLDER%\sqlite3\bin
34+
- mkdir %SQLITE3_BIN%
35+
- copy c:\tools\vcpkg\installed\"%platform%"-windows\bin\sqlite3.dll %SQLITE3_BIN%
36+
- ps: |
37+
appveyor DownloadFile https://sqlite.org/2018/sqlite-tools-win32-x86-3250100.zip
38+
7z x sqlite-tools-win32-x86-3250100.zip
39+
- copy "%APPVEYOR_BUILD_FOLDER%"\sqlite-tools-win32-x86-3250100\sqlite3.exe %SQLITE3_BIN%
40+
- set PATH=%PATH%;%SQLITE3_BIN%
41+
# setup PROJ.4
42+
- git clone https://github.com/OSGeo/proj.4.git
43+
- cd proj.4/data
44+
- curl -O http://download.osgeo.org/proj/proj-datumgrid-1.7.zip
45+
- 7z e -aoa -y proj-datumgrid-1.7.zip
46+
- cd "%APPVEYOR_BUILD_FOLDER%"\proj.4
47+
- if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64
48+
- if "%platform%" == "x64" SET BUILD_LIBPROJ_SHARED=ON
49+
- if "%platform%" == "x86" SET VS_FULL=%VS_VERSION%
50+
- if "%platform%" == "x86" SET BUILD_LIBPROJ_SHARED=OFF
51+
- echo "%VS_FULL%"
52+
#
53+
- mkdir "build_%platform%"
54+
- cd "build_%platform%"
55+
- set PROJ_DIR=%APPVEYOR_BUILD_FOLDER%\proj_dir
56+
- cmake -G "%VS_FULL%" .. -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBPROJ_SHARED="%BUILD_LIBPROJ_SHARED%" -DCMAKE_C_FLAGS="/WX" -DCMAKE_CXX_FLAGS="/WX" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX="%PROJ_DIR%"
57+
- cmake --build . --config Release --target install
58+
- set PATH=%PATH%;%PROJ_DIR%\bin
59+
- set PROJ_DATA=%PROJ_DIR%\share
60+
- proj
61+
# Build and install pyproj
62+
- cd %APPVEYOR_BUILD_FOLDER%
63+
- set PYPROJ_FULL_COVERAGE=YES
64+
- "%CMD_IN_ENV% pip install -e ."
65+
6066
install:
6167
- ECHO "Filesystem root:"
6268
- ps: "ls \"C:/\""
6369

64-
- ECHO "Installed SDKs:"
65-
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
66-
6770
# Install Python (from the official .msi of http://python.org) and pip when
6871
# not already installed.
6972
# - ps: if (-not(Test-Path($env:PYTHON))) { & ci\appveyor\install.ps1 }
@@ -90,14 +93,8 @@ install:
9093
# target Python version and architecture
9194
- "%CMD_IN_ENV% pip install -r requirements-dev.txt"
9295

93-
build_script:
94-
# Build and install pyproj
95-
# - "%CMD_IN_ENV% python setup.py install"
96-
- "%CMD_IN_ENV% pip install ."
97-
9896
test_script:
9997
# Run the project tests
100-
- "%CMD_IN_ENV% python lib/pyproj/__init__.py"
10198
- "%CMD_IN_ENV% python -c \"import pyproj; pyproj.Proj(init='epsg:4269')\""
10299
- "%CMD_IN_ENV% python unittest/test.py -v"
103100

pyproj/_proj.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def _transform(p1, p2, inx, iny, inz):
336336
cdef int errno = proj_errno(pj_trans.projpj)
337337
if errno:
338338
raise ProjError("proj_trans_generic error: {}".format(
339-
proj_errno_string(errno)))
339+
pystrdecode(proj_errno_string(errno))))
340340
if proj_angular_output(pj_trans.projpj, PJ_FWD):
341341
for i from 0 <= i < npts:
342342
xx[i] = xx[i]*_RAD2DG

pyproj/datadir.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
import os
55

66
if "PROJ_DATA" not in os.environ:
7-
pyproj_datadir = os.path.join(
8-
os.path.dirname(os.path.abspath(__file__)), "proj_dir", "share", "proj"
9-
)
7+
base_dir = os.path.dirname(os.path.abspath(__file__))
8+
pyproj_datadir = os.path.join(base_dir, "proj_dir", "share", "proj")
9+
if not os.path.exists(pyproj_datadir):
10+
pyproj_datadir = os.path.join(base_dir, "proj_dir", "share")
11+
if not os.path.exists(pyproj_datadir):
12+
raise RuntimeError("PROJ_DATA directory not found. Please set PROJ_DATA.")
1013
os.environ["PROJ_DATA"] = pyproj_datadir
1114
else:
1215
pyproj_datadir = os.environ["PROJ_DATA"]

requirements-dev.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
numpy
21
cython>=0.28.4
32
nose2
43
pytest
54
cov-core
6-
coverage>=4.0
7-
pyproj
5+
coverage>=4.0

setup.py

+32-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import with_statement
22

3+
from glob import glob
34
import os
45
import sys
56
from distutils.spawn import find_executable
@@ -24,7 +25,12 @@
2425

2526
def check_proj_version(proj_dir):
2627
proj = os.path.join(proj_dir, "bin", "proj")
27-
proj_version = subprocess.check_output([proj], stderr=subprocess.STDOUT)
28+
try:
29+
proj_version = subprocess.check_output([proj], stderr=subprocess.STDOUT)
30+
except subprocess.CalledProcessError:
31+
if os.name == "nt":
32+
return
33+
raise
2834
proj_version = proj_version.split()[1].split(b".")
2935
proj_version = tuple(int(v.strip(b",")) for v in proj_version)
3036
if proj_version < PROJ_MIN_VERSION:
@@ -58,7 +64,7 @@ def check_proj_version(proj_dir):
5864
elif proj_dir is not None and os.path.exists(proj_dir):
5965
print("PROJ_DIR is set, using existing proj4 installation..\n")
6066
else:
61-
sys.exit("ERROR: Invalid path for PROJ_DIR")
67+
sys.exit("ERROR: Invalid path for PROJ_DIR {}".format(proj_dir))
6268

6369
# check_proj_version
6470
check_proj_version(proj_dir)
@@ -73,24 +79,41 @@ def check_proj_version(proj_dir):
7379
proj_libdir = os.environ.get("PROJ_LIBDIR")
7480
libdirs = []
7581
if proj_libdir is None:
76-
libdirs.append(os.path.join(proj_dir, "lib"))
77-
libdirs.append(os.path.join(proj_dir, "lib64"))
82+
if os.path.exists(os.path.join(proj_dir, "lib")):
83+
libdirs.append(os.path.join(proj_dir, "lib"))
84+
libdirs.append(os.path.join(proj_dir, "lib64"))
85+
elif os.path.exists(os.path.join(proj_dir, "local", "lib")):
86+
libdirs.append(os.path.join(proj_dir, "local", "lib"))
87+
else:
88+
sys.exit("ERROR: PROJ_LIBDIR dir not found. Please set PROJ_LIBDIR.")
7889
else:
7990
libdirs.append(proj_libdir)
8091

8192
proj_incdir = os.environ.get("PROJ_INCDIR")
8293
incdirs = []
8394
if proj_incdir is None:
84-
incdirs.append(os.path.join(proj_dir, "include"))
95+
if os.path.exists(os.path.join(proj_dir, "include")):
96+
incdirs.append(os.path.join(proj_dir, "include"))
97+
elif os.path.exists(os.path.join(proj_dir, "local", "include")):
98+
incdirs.append(os.path.join(proj_dir, "local", "include"))
99+
else:
100+
sys.exit("ERROR: PROJ_INCDIR dir not found. Please set PROJ_INCDIR.")
85101
else:
86-
libdirs.append(proj_incdir)
87-
102+
incdirs.append(proj_incdir)
103+
104+
libraries = ["proj"]
105+
if os.name == "nt":
106+
for libdir in libdirs:
107+
projlib = glob(os.path.join(libdir, "proj*.lib"))
108+
if projlib:
109+
libraries = [os.path.basename(projlib[0]).split(".lib")[0]]
110+
break
88111

89112
ext_options = dict(
90113
include_dirs=incdirs,
91114
library_dirs=libdirs,
92-
runtime_library_dirs=libdirs,
93-
libraries=["proj"],
115+
runtime_library_dirs=libdirs if os.name != "nt" else None,
116+
libraries=libraries,
94117
)
95118

96119
ext_modules = cythonize(

0 commit comments

Comments
 (0)