Skip to content
Commits on Source (9)
[run]
plugins = Cython.Coverage
[report]
# number of decimal points to report for coverage percentage
precision = 2
src/* linguist-vendored
nad2bin.c linguist-vendored
......@@ -2,3 +2,22 @@ build/
nad2bin*
*.obj
*.o
*.pyc
*.so
_proj.c
.coverage
dist/
lib/pyproj.egg-info/
lib/pyproj/data/FL
lib/pyproj/data/MD
lib/pyproj/data/TN
lib/pyproj/data/WI
lib/pyproj/data/WO
lib/pyproj/data/alaska
lib/pyproj/data/conus
lib/pyproj/data/hawaii
lib/pyproj/data/null
lib/pyproj/data/prvi
lib/pyproj/data/stgeorge
lib/pyproj/data/stlrnc
lib/pyproj/data/stpaul
......@@ -2,26 +2,58 @@ language: python
sudo: false
cache: pip
env:
global:
- DEPENDS="numpy"
- PROJSOURCE=builtin
# External version of PROJ.4 installed:
# * 4.9.2 is installed due to it having easy binary install on
# Ubuntu Linux 16.04 Long Term Support (LTS) (April 2016).
# * git repository test for future compatibility changes to PROJ.4 may
# be caught early.
matrix:
include:
- python: 2.7
- python: 3.4
env:
- PROJSOURCE=4.9.2
- python: 3.5
- python: 3.6
- python: 3.7
dist: xenial
sudo: true
- python: "nightly"
env:
- PROJSOURCE=git
allow_failures:
- python: "nightly"
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
before_install:
- pip install $DEPENDS
- pip install -r requirements-dev.txt
- echo "PROJSOURCE is $PROJSOURCE"
- pwd
# Download external PROJ.4 version and compile
- |
if [[ $PROJSOURCE == "git" || $PROJSOURCE =~ "4."* ]]; then
ci/travis/proj-dl-and-compile "$PROJSOURCE"
export PROJ_DIR="/tmp/proj_dl_install"
fi
# add line to the top of _proj.pyx enabling coverage for Cython code
- ./ci/travis/add_line_proj_pyx.sh
install:
- python setup.py install
# coverage report requires a local install
- PYPROJ_FULL_COVERAGE=YES pip install -e .
script:
- python -c "import pyproj; pyproj.test()"
- python -c "import pyproj; pyproj.Proj(init='epsg:4269')"
- python unittest/test.py -v
- nose2 -v
notifications:
email: false
1.9.6
* fix segfault when inverse projection not defined (issue #43, pull request
#44).
* supports python 3.7
1.9.5.1
* fix for issue #42 (compilation error with microsoft visual studio).
1.9.5
......
To install:
pyproj
======
Installation
------------
* clone github repo or download source release at http://python.org/pypi/pyproj.
* If you clone the github repo, [Cython](http://cython.org/) is a dependency.
* python setup.py build
* python setup.py install (with sudo if necessary).
To test, run `python -c "import pyproj; pyproj.test()"`
To use proj4 lib (and data files) that are already installed on the system,
set PROJ_DIR environment variable to point to location of proj4 installation
before running setup.py. If PROJ_DIR is not set, the bundled proj4
source code and data files are used.
For new unit tests, run `python unittest/test.py`
Examples of how to set the PROJ_DIR environment variable:
* Windows - `C:\...> set PROJ_DIR=C:\OSGeo4W\`
* Linux/OS X on most shells- `$ export PROJ_DIR=/lib/`
To use installed proj lib (and data files),
set PROJ_DIR env var to point to location of proj installation.
before running setup.py. If PROJ_DIR is not set, bundled proj4
source code and data files are used.
Testing
-------
[nose2](https://github.com/nose-devs/nose2) is required to run some tests.
There are two testing suites: doctests and unittests. Doctests are located in
lib/pyproj/\__init\__.py. Unittests are located in unittest/.
To run all tests (add `-v` option to add verbose output):
```
nose2 [-v]
```
To run only the doctest:
```
python -c "import pyproj; pyproj.test()"
```
To run only the unittests:
```
python unittest/test.py [-v]
OR:
nose2 unittest/test.py [-v]
```
Code Coverage
-------------
nose2 will automatically produce coverage for python files. In order to
get coverage for the Cython code there are a couple extra steps needed.
Travis-CI should be set up to measure this automatically.
* Download pyproj source.
* Install Cython, and all other testing requirements
```
pip install -r requirements-dev.txt
```
* Add this line to top of _proj.pyx
```
# cython: linetrace=True
```
* Set the environment variable PYPROJ_FULL_COVERAGE to any value. This
is only needed for installation. Most platforms `$ export PYPROJ_FULL_COVERGAGE=1`.
Windows: `C:...> set PYPROJ_FULL_COVERGAGE=1`,
* Install in editable/development mode (python setup.py uses the `--inplace` flag)
* Using pip, use `--upgrade` flag if pyproj is already installed.
```
pip install [--upgrade] --editable .
```
* Using python setup.py (this isn't well tested)
```
python setup.py build_ext --inplace
python setup.py install
```
Docs at http://jswhit.github.io/pyproj.
Documentation
-------------
Docs are at http://jswhit.github.io/pyproj.
Bugs/Questions
--------------
Report bugs/ask questions at https://github.com/jswhit/pyproj/issues.
This diff is collapsed.
#cimport c_numpy
#c_numpy.import_array()
......@@ -8,7 +10,7 @@ cdef double _dg2rad, _rad2dg
_dg2rad = math.radians(1.)
_rad2dg = math.degrees(1.)
_doublesize = sizeof(double)
__version__ = "1.9.5.1"
__version__ = "1.9.6"
cdef extern from "math.h":
cdef enum:
......@@ -18,6 +20,8 @@ cdef extern from "math.h":
cdef extern from "geodesic.h":
struct geod_geodesic:
pass
struct geod_geodesicline:
pass
void geod_init(geod_geodesic* g, double a, double f)
void geod_direct(geod_geodesic* g,\
double lat1, double lon1, double azi1, double s12,\
......@@ -25,6 +29,24 @@ cdef extern from "geodesic.h":
void geod_inverse(geod_geodesic* g,\
double lat1, double lon1, double lat2, double lon2,\
double* ps12, double* pazi1, double* pazi2)
void geod_lineinit(geod_geodesicline* l,\
geod_geodesic* g,\
double lat1, double lon1, double azi1, unsigned caps)
void geod_position(geod_geodesicline* l, double s12,\
double* plat2, double* plon2, double* pazi2);
cdef enum:
GEODESIC_VERSION_MAJOR
GEODESIC_VERSION_MINOR
GEODESIC_VERSION_PATCH
# define part of the struct PJconsts from projects.h
ctypedef void (*c_func_type)()
ctypedef struct PJconsts:
void *ctx
c_func_type fwd
c_func_type inv
# ignore all other components of this struct, we don't need them
cdef extern from "proj_api.h":
ctypedef struct projUV:
......@@ -48,18 +70,41 @@ cdef extern from "proj_api.h":
projCtx pj_ctx_alloc()
projCtx pj_get_default_ctx()
void pj_free(projPJ)
# pj_dalloc: useful for deallocating stuff like i.e. pj_get_def char buffer
void pj_dalloc(void *)
void pj_set_searchpath ( int count, char **path )
void pj_dalloc(void *)
cdef enum:
PJ_VERSION
cdef extern from "Python.h":
int PyObject_AsWriteBuffer(object, void **rbuf, Py_ssize_t *len)
# version number strings for proj.4 and Geod
if PJ_VERSION > 499:
# proj.4 Version 4.10.0 and later: PJ_VERSION=MMMNNNPP later where MMM, NNN, PP
# are the major, minor, and patch numbers
proj_version_str = "{0}.{1}.{2}".format(PJ_VERSION // 10**5 % 1000,
PJ_VERSION // 10**2 % 1000, PJ_VERSION % 100)
else:
# before proj.4 version 4.10.0: PJ_VERSION=MNP where M, N, and P are the major,
# minor, and patch numbers;
proj_version_str = "{0}.{1}.{2}".format(PJ_VERSION // 100 % 10,
PJ_VERSION // 10 % 10, PJ_VERSION % 10)
geodesic_version_str = "{0}.{1}.{2}".format(GEODESIC_VERSION_MAJOR,
GEODESIC_VERSION_MINOR, GEODESIC_VERSION_PATCH)
def set_datapath(datapath):
bytestr = _strencode(datapath)
cdef const char *searchpath = bytestr
# convert the datapath into bytes if it is not already
if not isinstance(datapath, bytes):
datapath = datapath.encode('utf-8')
cdef const char *searchpath = datapath
pj_set_searchpath(1, &searchpath)
# deprecated: used in _proj.Proj.to_latlong
def _createproj(projstring):
return Proj(projstring)
......@@ -89,12 +134,39 @@ cdef class Proj:
pj_free(self.projpj)
pj_ctx_free(self.projctx)
def to_latlong_def(self):
"""return the definition string of the geographic (lat/lon)
coordinate version of the current projection"""
# This is a little hacky way of getting a latlong proj object
# Maybe instead of this function the __cinit__ function can take a
# Proj object and a type (where type = "geographic") as the libproj
# java wrapper
cdef projPJ llpj
cdef char *cstring_def
cdef int err
llpj = pj_latlong_from_proj(self.projpj) # create temp proj
if llpj is not NULL:
cstring_def = pj_get_def(llpj, 0) # get definition c string
pj_free(llpj) # deallocate temp proj
if cstring_def is not NULL:
try:
pystring_def = <bytes>cstring_def # copy to python string
return pystring_def
finally:
pj_dalloc(cstring_def) # deallocate c string
raise RuntimeError("could not create latlong definition")
# deprecated : using in transform raised a TypeError in release 1.9.5.1
# reported in issue #53, resolved in #73.
def to_latlong(self):
"""return a new Proj instance which is the geographic (lat/lon)
coordinate version of the current projection"""
cdef projPJ llpj
llpj = pj_latlong_from_proj(self.projpj)
initstring = pj_get_def(llpj, 0)
initstring = pj_get_def(llpj, 0) # this leaks the c char buffer
pj_free(llpj)
return _createproj(initstring)
......@@ -201,6 +273,9 @@ cdef class Proj:
continue
projxyin.u = xdatab[i]
projxyin.v = ydatab[i]
projpj2 = <PJconsts *> self.projpj
if (projpj2.inv == NULL):
raise RuntimeError('inverse projection undefined')
projlonlatout = pj_inv(projxyin,self.projpj)
if errcheck:
err = pj_ctx_get_errno(self.projctx)
......@@ -323,6 +398,20 @@ cdef class Proj:
else:
return False
def definition_string(self):
# Returns projection definition
cdef bytes py_def_string
cdef char* c_def_string
c_def_string = pj_get_def(self.projpj, 0)
py_def_string = c_def_string
pj_dalloc(c_def_string)
return py_def_string
def __repr__(self):
return "{modname}.{classname}({srs!r}, preserve_units=True)".format(
modname=self.__module__, classname=self.__class__.__name__,
srs=self.srs)
def _transform(Proj p1, Proj p2, inx, iny, inz, radians):
# private function to call pj_transform
cdef void *xdata
......@@ -371,13 +460,72 @@ cdef _strencode(pystr,encoding='ascii'):
except AttributeError:
return pystr # already bytes?
def _transform_sequence(Proj p1, Proj p2, Py_ssize_t stride, inseq, bint radians, bint switch):
# private function to itransform function
cdef:
void *buffer
double *coords
double *x
double *y
double *z
Py_ssize_t buflen, npts, i, j
int err
if stride < 2:
raise RuntimeError("coordinates must contain at least 2 values")
if PyObject_AsWriteBuffer(inseq, &buffer, &buflen) <> 0:
raise RuntimeError("object does not provide the python buffer writeable interface")
coords = <double*>buffer
npts = buflen // (stride * sizeof(double))
if not radians and p1.is_latlong():
for i from 0 <= i < npts:
j = stride*i
coords[j] *= _dg2rad
coords[j+1] *= _dg2rad
if not switch:
x = coords
y = coords + 1
else:
x = coords + 1
y = coords
if stride == 2:
z = NULL
else:
z = coords + 2
err = pj_transform(p1.projpj, p2.projpj, npts, stride, x, y, z)
if err != 0:
raise RuntimeError(pj_strerrno(err))
if not radians and p2.is_latlong():
for i from 0 <= i < npts:
j = stride*i
coords[j] *= _dg2rad
coords[j+1] *= _dg2rad
cdef class Geod:
cdef geod_geodesic _geod_geodesic
cdef public object initstring
def __cinit__(self, a, f):
self.initstring = '+a=%s +f=%s' % (a, f)
def __cinit__(self, a, f, sphere, b, es):
geod_init(&self._geod_geodesic, <double> a, <double> f)
self.a = a
self.f = f
if isinstance(a, float) and a.is_integer():
# convert 'a' only for initstring
a = int(a)
if f == 0.0:
f = 0
self.initstring = '+a=%s +f=%s' % (a, f)
self.sphere = sphere
self.b = b
self.es = es
def __reduce__(self):
"""special method that allows pyproj.Geod instance to be pickled"""
......@@ -424,9 +572,9 @@ cdef class Geod:
az1 = azdata[i]
s12 = distdata[i]
else:
lon1 = _dg2rad*lonsdata[i]
lat1 = _dg2rad*latsdata[i]
az1 = _dg2rad*azdata[i]
lon1 = _rad2dg*lonsdata[i]
lat1 = _rad2dg*latsdata[i]
az1 = _rad2dg*azdata[i]
s12 = distdata[i]
geod_direct(&self._geod_geodesic, lat1, lon1, az1, s12,\
&plat2, &plon2, &pazi2)
......@@ -436,17 +584,14 @@ cdef class Geod:
pazi2 = pazi2-180.
elif pazi2 <= 0:
pazi2 = pazi2+180.
# check for NaN.
if pazi2 != pazi2:
raise ValueError('undefined inverse geodesic (may be an antipodal point)')
if not radians:
lonsdata[i] = plon2
latsdata[i] = plat2
azdata[i] = pazi2
else:
lonsdata[i] = _rad2dg*plon2
latsdata[i] = _rad2dg*plat2
azdata[i] = _rad2dg*pazi2
lonsdata[i] = _dg2rad*plon2
latsdata[i] = _dg2rad*plat2
azdata[i] = _dg2rad*pazi2
def _inv(self, object lons1, object lats1, object lons2, object lats2, radians=False):
"""
......@@ -481,7 +626,6 @@ cdef class Geod:
latsdata = <double *>latdata
azdata = <double *>azdat
distdata = <double *>distdat
errmsg = 'undefined inverse geodesic (may be an antipodal point)'
for i from 0 <= i < ndim:
if radians:
lon1 = _rad2dg*lonsdata[i]
......@@ -501,11 +645,9 @@ cdef class Geod:
pazi2 = pazi2-180.
elif pazi2 <= 0:
pazi2 = pazi2+180.
if ps12 != ps12: # check for NaN
raise ValueError('undefined inverse geodesic (may be an antipodal point)')
if radians:
lonsdata[i] = _rad2dg*pazi1
latsdata[i] = _rad2dg*pazi2
lonsdata[i] = _dg2rad*pazi1
latsdata[i] = _dg2rad*pazi2
else:
lonsdata[i] = pazi1
latsdata[i] = pazi2
......@@ -516,14 +658,18 @@ cdef class Geod:
given initial and terminus lat/lon, find npts intermediate points."""
cdef int i
cdef double del_s,ps12,pazi1,pazi2,s12,plon2,plat2
cdef geod_geodesicline line
if radians:
lon1 = _rad2dg*lon1
lat1 = _rad2dg*lat1
lon2 = _rad2dg*lon2
lat2 = _rad2dg*lat2
# do inverse computation to set azimuths, distance.
# in proj 4.9.3 and later the next two steps can be replace by a call
# to geod_inverseline with del_s = line.s13/(npts+1)
geod_inverse(&self._geod_geodesic, lat1, lon1, lat2, lon2,
&ps12, &pazi1, &pazi2)
geod_lineinit(&line, &self._geod_geodesic, lat1, lon1, pazi1, 0u)
# distance increment.
del_s = ps12/(npts+1)
# initialize output tuples.
......@@ -532,8 +678,7 @@ cdef class Geod:
# loop over intermediate points, compute lat/lons.
for i from 1 <= i < npts+1:
s12 = i*del_s
geod_direct(&self._geod_geodesic, lat1, lon1, pazi1, s12,\
&plat2, &plon2, &pazi2)
geod_position(&line, s12, &plat2, &plon2, &pazi2);
if radians:
lats = lats + (_dg2rad*plat2,)
lons = lons + (_dg2rad*plon2,)
......@@ -541,3 +686,8 @@ cdef class Geod:
lats = lats + (plat2,)
lons = lons + (plon2,)
return lons, lats
def __repr__(self):
return "{modname}.{classname}({init!r})".format(modname=self.__module__,
classname=self.__class__.__name__,
init=self.initstring)
# This is based on file and files in ci/appveyor are from
# https://github.com/ogrisel/python-appveyor-demo
environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci\\appveyor\\run_with_env.cmd"
matrix:
# Pre-installed Python versions
# See: http://www.appveyor.com/docs/installed-software#python
# build is limited to 60 minutes, without caching each build takes 10-30 minutes
# with caching build takes less than 1 minute
# Python 2.6 will need to run this `pip install unittest2`
# - PYTHON: "C:\\Python26"
# PYTHON_VERSION: "2.6.x"
# PYTHON_ARCH: "32"
# - PYTHON: "C:\\Python26-x64"
# PYTHON_VERSION: "2.6.x"
# PYTHON_ARCH: "64"
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"
- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
# - PYTHON: "C:\\Python33"
# PYTHON_VERSION: "3.3.x"
# PYTHON_ARCH: "32"
- PYTHON: "C:\\Python33-x64"
PYTHON_VERSION: "3.3.x"
PYTHON_ARCH: "64"
# - PYTHON: "C:\\Python34"
# PYTHON_VERSION: "3.4.x"
# PYTHON_ARCH: "32"
- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "64"
- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "32"
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"
cache:
- C:\Users\appveyor\AppData\Local\pip\Cache\wheels
install:
- ECHO "Filesystem root:"
- ps: "ls \"C:/\""
- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
# - ps: if (-not(Test-Path($env:PYTHON))) { & ci\appveyor\install.ps1 }
# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"
# install wheel, caching
- "pip install wheel"
# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install -r requirements-dev.txt"
build_script:
# Build and install pyproj
# - "%CMD_IN_ENV% python setup.py install"
- "%CMD_IN_ENV% pip install ."
test_script:
# Run the project tests
- "%CMD_IN_ENV% python lib/pyproj/__init__.py"
- "%CMD_IN_ENV% python -c \"import pyproj; pyproj.Proj(init='epsg:4269')\""
- "%CMD_IN_ENV% python unittest/test.py -v"
#after_test:
# If tests are successful, create binary packages for the project.
# - "%CMD_IN_ENV% python setup.py bdist_wheel"
# - "%CMD_IN_ENV% python setup.py bdist_wininst"
# - "%CMD_IN_ENV% python setup.py bdist_msi"
# - ps: "ls dist"
#artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
# - path: dist\*
#on_success:
# - TODO: upload the content of dist/*.whl to a public wheelhouse
#
:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
::
:: To build extensions for 64 bit Python 2, we need to configure environment
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
::
:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific
:: environment configurations.
::
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
:: cmd interpreter, at least for (SDK v7.0)
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: http://stackoverflow.com/a/13751649/163740
::
:: Author: Olivier Grisel
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
::
:: Notes about batch files for Python people:
::
:: Quotes in values are literally part of the values:
:: SET FOO="bar"
:: FOO is now five characters long: " b a r "
:: If you don't want quotes, don't include them on the right-hand side.
::
:: The CALL lines at the end of this file look redundant, but if you move them
:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y
:: case, I don't know why.
@ECHO OFF
SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf
:: Extract the major and minor versions, and allow for the minor version to be
:: more than 9. This requires the version number to have two dots in it.
SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1%
IF "%PYTHON_VERSION:~3,1%" == "." (
SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1%
) ELSE (
SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2%
)
:: Based on the Python version, determine what SDK version to use, and whether
:: to set the SDK for 64-bit.
IF %MAJOR_PYTHON_VERSION% == 2 (
SET WINDOWS_SDK_VERSION="v7.0"
SET SET_SDK_64=Y
) ELSE (
IF %MAJOR_PYTHON_VERSION% == 3 (
SET WINDOWS_SDK_VERSION="v7.1"
IF %MINOR_PYTHON_VERSION% LEQ 4 (
SET SET_SDK_64=Y
) ELSE (
SET SET_SDK_64=N
IF EXIST "%WIN_WDK%" (
:: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/
REN "%WIN_WDK%" 0wdf
)
)
) ELSE (
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
EXIT 1
)
)
IF %PYTHON_ARCH% == 64 (
IF %SET_SDK_64% == Y (
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
) ELSE (
ECHO Using default MSVC build environment for 64 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
) ELSE (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
#!/usr/bin/env bash
# adds this line to _proj.pyx to enable measuring Cython coverage
sed -i '1 i\# cython: linetrace=True' _proj.pyx
#!/bin/bash
echo "Building PROJ.4 $1 version from source..."
if [[ $1 == "git" ]]; then
git clone https://github.com/OSGeo/proj.4.git proj.4-git
else
wget https://github.com/OSGeo/proj.4/archive/$1.tar.gz
tar zxf $1.tar.gz
fi
cd proj.4-$1
# Download and extract grids
wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip
cd nad
unzip -o ../proj-datumgrid-1.5.zip
cd ..
# could be installed to a cached location (probably not git version)
# seems to take only about 13 seconds of build time
cmake . -DCMAKE_INSTALL_PREFIX=/tmp/proj_dl_install
make -j3
make install
find /tmp/proj_dl_install
# export PROJ_DIR="/tmp/proj_git_install"
cd ..
python-pyproj (1.9.5.1-5) UNRELEASED; urgency=medium
python-pyproj (1.9.6-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.3.0, no changes.
* Drop autopkgtests to test installability & module import.
* Add lintian override for testsuite-autopkgtest-missing.
* Update watch file to limit matches to archive path.
* Update copyright file for PROJ changes.
* Drop Cython patch, included upstream. Refresh remaining patches.
* Use nose2 for tests.
* Add patch to not cythonize in the clean target.
* Don't move _proj.c out of the way, file no longer included upstream.
-- Bas Couwenberg <sebastic@debian.org> Thu, 05 Jul 2018 11:09:39 +0200
-- Bas Couwenberg <sebastic@debian.org> Sun, 30 Dec 2018 08:59:54 +0100
python-pyproj (1.9.5.1-4) unstable; urgency=medium
......
......@@ -7,11 +7,14 @@ Priority: optional
Build-Depends: debhelper (>= 9),
dh-python,
cython,
cython3,
python-all-dev,
python-setuptools,
python-nose2,
python-numpy,
python3-all-dev,
python3-setuptools,
python3-nose2,
python3-numpy,
libproj-dev (>= 4.9.0~)
Standards-Version: 4.3.0
......
......@@ -8,14 +8,18 @@ Copyright: © 2006-2009, 2013, Jeffrey Whitaker <jeffrey.s.whitaker@noaa.gov>
License: MIT-short
Files: src/*
Copyright: © 2012-2015, Charles Karney <charles@karney.com>
© 2000-2002, 2009-2010, 2012, Frank Warmerdam <warmerdam@pobox.com>
© 2008-2012, Even Rouault <even dot rouault at mines-paris dot org>
© 2011-2012, Martin Lambers <marlam@marlam.de>
© 2012, Martin Raspaud
© 1995, 2003-2004, 2006, Gerald I. Evenden
© 2006, Andrey Kiselev
© 2001, Thomas Flemming <tf@ttqv.com>
Copyright: 2016, Kristian Evers <kristianevers@gmail.com>
2016, Thomas Knudsen
2016, Drazen Tutic
2016, Lovro Gradiser
2012-2016, Charles Karney <charles@karney.com>
2000-2002, 2009-2010, 2012, Frank Warmerdam <warmerdam@pobox.com>
2008-2012, Even Rouault <even dot rouault at mines-paris dot org>
2011-2012, Martin Lambers <marlam@marlam.de>
2012, Martin Raspaud
1995, 2003-2004, 2006, Gerald I. Evenden
2006, Andrey Kiselev
2001, Thomas Flemming <tf@ttqv.com>
License: MIT
Files: src/proj_etmerc.c
......@@ -29,7 +33,7 @@ Comment: The code in this file is largly based upon procedures:
.
Modified and used here by permission of Reference Networks
Division, Kort og Matrikelstyrelsen (KMS), Copenhagen, Denmark
Copyright: © 2008, Gerald I. Evenden
Copyright: 2008, Gerald I. Evenden
License: MIT
Files: src/PJ_isea.c
......@@ -38,6 +42,10 @@ License: public-domain
This code was entirely written by Nathan Wagner
and is in the public domain.
Files: src/PJ_patterson.c
Copyright: 2014, Bojan Savric
License: Apache-2.0
Files: src/PJ_sch.c
Copyright: 2015, California Institute of Technology.
Government sponsorship acknowledged.
......@@ -72,7 +80,7 @@ License: public-domain
DEALINGS IN THE SOFTWARE.
Files: debian/*
Copyright: © 2009, David Paleino <dapal@debian.org>
Copyright: 2009, David Paleino <dapal@debian.org>
License: GPL-3+
License: MIT-short
......@@ -123,3 +131,18 @@ License: GPL-3+
version 3 can be found in the file
`/usr/share/common-licenses/GPL-3'.
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the complete text of the Apache License can be found
in `/usr/share/common-licenses/Apache-2.0'.
From: David Paleino <dapal@debian.org>
Subject: use official data instead of embedded copy
Description: Use packaged data instead of embedded copy
Author: David Paleino <dapal@debian.org>
Forwarded: not-needed
--- a/lib/pyproj/datadir.py
......
......@@ -7,8 +7,8 @@ Forwarded: not-needed
--- a/setup.py
+++ b/setup.py
@@ -23,16 +23,6 @@ if proj_dir is not None:
Extension("pyproj._proj",["_proj.c"],include_dirs=incdirs,library_dirs=libdirs,\
@@ -33,16 +33,6 @@ if proj_dir is not None:
Extension("pyproj._proj",["_proj"+ext],include_dirs=incdirs,library_dirs=libdirs,\
runtime_library_dirs=libdirs,libraries=libraries)
- # over-write default data directory.
......
Description: Use Cython in setup.py to generate C code on the fly from _proj.pyx.
Author: Micah Cochran <micahcochran@users.noreply.github.com>
Origin: https://github.com/jswhit/pyproj/commit/fd7b5ea23d5cb0b5c45a9a9ee5bf1c0e446cf474
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
To install:
* clone github repo or download source release at http://python.org/pypi/pyproj.
+* If you clone the github repo, (Cython)[http://cython.org/] is a dependency.
* python setup.py build
* python setup.py install (with sudo if necessary).
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,15 @@ import sys, os, glob, subprocess, shutil
from distutils import ccompiler, sysconfig
from setuptools import setup, Extension
+USE_CYTHON = False
+
+# is this a repository
+if not os.path.isfile("_proj.c"):
+ # no _proj.c, repository
+ USE_CYTHON = True
+
+ext = '.pyx' if USE_CYTHON else '.c'
+
proj_dir = os.environ.get('PROJ_DIR')
# if PROJ_DIR env var is set, build against
@@ -20,7 +29,7 @@ if proj_dir is not None:
incdirs.append(os.path.join(proj_dir,'include'))
pyprojext =\
- Extension("pyproj._proj",["_proj.c"],include_dirs=incdirs,library_dirs=libdirs,\
+ Extension("pyproj._proj",["_proj"+ext],include_dirs=incdirs,library_dirs=libdirs,\
runtime_library_dirs=libdirs,libraries=libraries)
extensions = [pyprojext]
@@ -48,7 +57,7 @@ else:
#macros.append(('HAVE_STRERROR',1))
# for win32 threads
#macros.append(('MUTEX_win32',1))
- extensions = [Extension("pyproj._proj",deps+['_proj.c'],
+ extensions = [Extension("pyproj._proj",deps+['_proj'+ext],
include_dirs=['src'],define_macros=macros)]
# create binary datum shift grid files.
@@ -75,6 +84,17 @@ else:
datafiles = [os.path.join('data',os.path.basename(f)) for f in datafiles]
package_data = {'pyproj':datafiles}
+# use Cython to generate the C code (_proj.c) from _proj.pyx
+if USE_CYTHON:
+ try:
+ from Cython.Build import cythonize
+ except ImportError:
+ sys.stderr.write("\n\n_proj.c does not exist in a repository copy.\n"
+ "ImportError: Cython must be installed in order to generate _proj.c\n"
+ "\tto install Cython run `pip install cython`\n")
+ sys.exit(1)
+
+ extensions = cythonize(extensions)
packages = ['pyproj']
package_dirs = {'':'lib'}
Description: Don't cythonize in the clean target.
Changes the source tree when it shouldn't.
Author: Bas Couwenberg <sebastic@debian.org>
--- a/setup.py
+++ b/setup.py
@@ -91,7 +91,7 @@ else:
# use Cython to generate the C code (_proj.c) from _proj.pyx
-if USE_CYTHON:
+if USE_CYTHON and "clean" not in sys.argv:
try:
from Cython.Build import cythonize
except ImportError:
......@@ -4,18 +4,18 @@ Forwarded: https://github.com/jswhit/pyproj/pull/95
--- a/docs/pyproj-pysrc.html
+++ b/docs/pyproj-pysrc.html
@@ -151,7 +151,7 @@
<a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"><tt class="py-string">'healpix'</tt><tt class="py-op">:</tt> <tt class="py-string">"HEALPix"</tt><tt class="py-op">,</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"><tt class="py-string">'rhealpix'</tt><tt class="py-op">:</tt> <tt class="py-string">"rHEALPix"</tt><tt class="py-op">,</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"><tt class="py-string">'igh'</tt><tt class="py-op">:</tt> <tt class="py-string">"Interrupted Goode Homolosine"</tt><tt class="py-op">,</tt> </tt>
-<a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"><tt class="py-string">'imw_p'</tt><tt class="py-op">:</tt> <tt class="py-string">"Internation Map of the World Polyconic"</tt><tt class="py-op">,</tt> </tt>
+<a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"><tt class="py-string">'imw_p'</tt><tt class="py-op">:</tt> <tt class="py-string">"International Map of the World Polyconic"</tt><tt class="py-op">,</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"><tt class="py-string">'isea'</tt><tt class="py-op">:</tt> <tt class="py-string">"Icosahedral Snyder Equal Area"</tt><tt class="py-op">,</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"><tt class="py-string">'kav5'</tt><tt class="py-op">:</tt> <tt class="py-string">"Kavraisky V"</tt><tt class="py-op">,</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"><tt class="py-string">'kav7'</tt><tt class="py-op">:</tt> <tt class="py-string">"Kavraisky VII"</tt><tt class="py-op">,</tt> </tt>
@@ -159,7 +159,7 @@
<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"><tt class="py-string">'healpix'</tt><tt class="py-op">:</tt> <tt class="py-string">"HEALPix"</tt><tt class="py-op">,</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"><tt class="py-string">'rhealpix'</tt><tt class="py-op">:</tt> <tt class="py-string">"rHEALPix"</tt><tt class="py-op">,</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"><tt class="py-string">'igh'</tt><tt class="py-op">:</tt> <tt class="py-string">"Interrupted Goode Homolosine"</tt><tt class="py-op">,</tt> </tt>
-<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"><tt class="py-string">'imw_p'</tt><tt class="py-op">:</tt> <tt class="py-string">"Internation Map of the World Polyconic"</tt><tt class="py-op">,</tt> </tt>
+<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"><tt class="py-string">'imw_p'</tt><tt class="py-op">:</tt> <tt class="py-string">"International Map of the World Polyconic"</tt><tt class="py-op">,</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"><tt class="py-string">'isea'</tt><tt class="py-op">:</tt> <tt class="py-string">"Icosahedral Snyder Equal Area"</tt><tt class="py-op">,</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"><tt class="py-string">'kav5'</tt><tt class="py-op">:</tt> <tt class="py-string">"Kavraisky V"</tt><tt class="py-op">,</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"><tt class="py-string">'kav7'</tt><tt class="py-op">:</tt> <tt class="py-string">"Kavraisky VII"</tt><tt class="py-op">,</tt> </tt>
--- a/lib/pyproj/__init__.py
+++ b/lib/pyproj/__init__.py
@@ -108,7 +108,7 @@ pj_list={
@@ -116,7 +116,7 @@ pj_list={
'healpix': "HEALPix",
'rhealpix': "rHEALPix",
'igh': "Interrupted Goode Homolosine",
......@@ -26,7 +26,7 @@ Forwarded: https://github.com/jswhit/pyproj/pull/95
'kav7': "Kavraisky VII",
--- a/src/pj_list.h
+++ b/src/pj_list.h
@@ -51,7 +51,7 @@ PROJ_HEAD(hatano, "Hatano Asymmetrical E
@@ -52,7 +52,7 @@ PROJ_HEAD(hatano, "Hatano Asymmetrical E
PROJ_HEAD(healpix, "HEALPix")
PROJ_HEAD(rhealpix, "rHEALPix")
PROJ_HEAD(igh, "Interrupted Goode Homolosine")
......