[pycoast] 01/10: New upstream version 1.0.0+dfsg
Antonio Valentino
a_valentino-guest at moszumanska.debian.org
Fri Aug 18 17:12:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
a_valentino-guest pushed a commit to branch master
in repository pycoast.
commit 0a06838c7e90fe5a2f4b5ec87dd0e2e86d127967
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date: Fri Aug 18 09:19:50 2017 +0000
New upstream version 1.0.0+dfsg
---
.bumpversion.cfg | 2 +-
.travis.yml | 8 ++++++--
MANIFEST.in | 2 +-
changelog.rst | 31 ++++++++++++++++++++++++++++++-
pycoast/__init__.py | 1 +
pycoast/cw_agg.py | 23 +++++++++++------------
pycoast/cw_base.py | 26 ++++++++++++++++----------
pycoast/cw_pil.py | 21 +++++++++++----------
pycoast/tests/test_pycoast.py | 42 +++++++++++++++++++++---------------------
pycoast/version.py | 2 +-
setup.py | 24 +++++++++++++++---------
11 files changed, 114 insertions(+), 68 deletions(-)
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 2a43fee..9761f48 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 0.6.1
+current_version = 1.0.0
commit = True
tag = True
diff --git a/.travis.yml b/.travis.yml
index 3d458ce..996d444 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,16 @@
language: python
python:
- '2.7'
+- '3.4'
+- '3.5'
+- '3.6'
sudo: false
install:
-- pip install git+git://github.com/mraspaud/aggdraw.git
+# aggdraw is not currently supported on python 3
+- pip install git+git://github.com/davidh-ssec/aggdraw.git
- python setup.py install
- pip install coveralls
script: coverage run --source=pycoast setup.py test
after_success: coveralls
notifications:
- slack: pytroll:96mNSYSI1dBjGyzVXkBT6qFt
\ No newline at end of file
+ slack: pytroll:96mNSYSI1dBjGyzVXkBT6qFt
diff --git a/MANIFEST.in b/MANIFEST.in
index cc61af1..4b067c0 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,6 @@
include docs/Makefile
recursive-include docs/source *
-include test/*.png
+include pycoast/tests/*.png
include LICENSE.txt
include MANIFEST.in
diff --git a/changelog.rst b/changelog.rst
index 1324b5d..64524d5 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -2,6 +2,29 @@ Changelog
=========
+v1.0.0 (2017-08-15)
+-------------------
+- Update changelog. [Martin Raspaud]
+- Bump version: 0.6.1 → 1.0.0. [Martin Raspaud]
+- Merge remote-tracking branch 'origin/master' into pre-master. [Martin
+ Raspaud]
+- Merge pull request #9 from pytroll/feature-python3. [Martin Raspaud]
+
+ Feature python3
+- Fix version import on python 3.4 (again) [davidh-ssec]
+- Fix version import on python 3.4. [davidh-ssec]
+- Remove unused import in setup.py. [davidh-ssec]
+- Change version import to use importlib. [davidh-ssec]
+- Use davidh-ssec/aggdraw for travis builds. [davidh-ssec]
+- Fix version import in setup.py. [davidh-ssec]
+- Fix version import in setup.py and add version to main package init.
+ [davidh-ssec]
+- Remove aggdraw from python 3 travis executions for now. [davidh-ssec]
+- Add python 3 to travis tests. [davidh-ssec]
+- Fix python 3 compatiblity in cw_X.py modules. [davidh-ssec]
+- Fix tests and MANIFEST to be more modern. [davidh-ssec]
+
+
v0.6.1 (2017-05-18)
-------------------
- Update changelog. [Panu Lahtinen]
@@ -36,6 +59,12 @@ v0.6.1 (2017-05-18)
- Minor PEP8. [Panu Lahtinen]
- Pep8 pretify. [Adam.Dybbroe]
- Pep8. [Adam.Dybbroe]
+
+
+v0.5.5 (2016-08-31)
+-------------------
+- Update changelog. [Martin Raspaud]
+- Bump version: 0.5.4 → 0.5.5. [Martin Raspaud]
- Update fonts in two test images. [Martin Raspaud]
@@ -70,7 +99,6 @@ Other
Conflicts:
.gitignore
setup.py
-
- Add a gitignore file. [Martin Raspaud]
- Merge pull request #2 from mitkin/master. [Martin Raspaud]
@@ -203,3 +231,4 @@ Other
- First version. [Esben S. Nielsen]
+
diff --git a/pycoast/__init__.py b/pycoast/__init__.py
index c4d3101..34737df 100644
--- a/pycoast/__init__.py
+++ b/pycoast/__init__.py
@@ -3,6 +3,7 @@
# Default to PIL based ContourWriter in case the import of aggdraw or
# cairo fail.
+from .version import __version__
from .cw_pil import ContourWriter
try:
from .cw_agg import ContourWriterAGG
diff --git a/pycoast/cw_agg.py b/pycoast/cw_agg.py
index 6a32c7c..2ee7e2d 100644
--- a/pycoast/cw_agg.py
+++ b/pycoast/cw_agg.py
@@ -22,15 +22,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import numpy as np
from PIL import Image
import logging
import aggdraw
-from cw_base import ContourWriterBase
-from cw_base import _get_lon_lat_bounding_box
-from cw_base import _get_pixel_index
+from pycoast.cw_base import ContourWriterBase
logger = logging.getLogger(__name__)
@@ -54,7 +51,7 @@ class ContourWriterAGG(ContourWriterBase):
"""
return aggdraw.Draw(image)
- def _engine_text_draw(self, draw, (x_pos, y_pos), txt, font, **kwargs):
+ def _engine_text_draw(self, draw, x_pos, y_pos, txt, font, **kwargs):
draw.text((x_pos, y_pos), txt, font)
def _draw_polygon(self, draw, coordinates, **kwargs):
@@ -278,7 +275,7 @@ class ContourWriterAGG(ContourWriterBase):
fill_opacity=fill_opacity, outline=outline,
width=width, outline_opacity=outline_opacity)
- def add_grid(self, image, area_def, (Dlon, Dlat), (dlon, dlat),
+ def add_grid(self, image, area_def, Dlonlat, dlonlat,
font=None, write_text=True, fill=None, fill_opacity=255,
outline='white', width=1, outline_opacity=255,
minor_outline='white', minor_width=0.5,
@@ -291,9 +288,9 @@ class ContourWriterAGG(ContourWriterBase):
PIL image object
proj4_string : str
Projection of area as Proj.4 string
- (Dlon,Dlat): (float,float)
+ Dlonlat: (float, float)
Major grid line separation
- (dlon,dlat): (float,float)
+ dlonlat: (float, float)
Minor grid line separation
font: Aggdraw Font object, optional
Font for major line markings
@@ -316,6 +313,8 @@ class ContourWriterAGG(ContourWriterBase):
minor_is_tick : boolean, optional
Use tick minor line style (True) or full minor line style (False)
"""
+ Dlon, Dlat = Dlonlat
+ dlon, dlat = dlonlat
self._add_grid(image, area_def, Dlon, Dlat, dlon, dlat,
font=font, write_text=write_text,
fill=fill, fill_opacity=fill_opacity, outline=outline,
@@ -326,7 +325,7 @@ class ContourWriterAGG(ContourWriterBase):
lon_placement=lon_placement,
lat_placement=lat_placement)
- def add_grid_to_file(self, filename, area_def, (Dlon, Dlat), (dlon, dlat),
+ def add_grid_to_file(self, filename, area_def, Dlonlat, dlonlat,
font=None, write_text=True,
fill=None, fill_opacity=255,
outline='white', width=1, outline_opacity=255,
@@ -340,9 +339,9 @@ class ContourWriterAGG(ContourWriterBase):
PIL image object
proj4_string : str
Projection of area as Proj.4 string
- (Dlon,Dlat): (float,float)
+ Dlonlat: (float, float)
Major grid line separation
- (dlon,dlat): (float,float)
+ dlonlat: (float, float)
Minor grid line separation
font: Aggdraw Font object, optional
Font for major line markings
@@ -367,7 +366,7 @@ class ContourWriterAGG(ContourWriterBase):
"""
image = Image.open(filename)
- self.add_grid(image, area_def, (Dlon, Dlat), (dlon, dlat),
+ self.add_grid(image, area_def, Dlonlat, dlonlat,
font=font, write_text=write_text,
fill=fill, fill_opacity=fill_opacity,
outline=outline, width=width,
diff --git a/pycoast/cw_base.py b/pycoast/cw_base.py
index 0e779e6..0879778 100644
--- a/pycoast/cw_base.py
+++ b/pycoast/cw_base.py
@@ -28,9 +28,13 @@ import numpy as np
from PIL import Image, ImageFont
import pyproj
import logging
-from ConfigParser import ConfigParser
from .errors import *
+try:
+ import configparser
+except ImportError:
+ from six.moves import configparser
+
logger = logging.getLogger(__name__)
@@ -70,9 +74,9 @@ class ContourWriterBase(object):
elif ay == 'c':
y_pos = y_pos - txt_width / 2
- self._engine_text_draw(draw, (x_pos, y_pos), txt, font, **kwargs)
+ self._engine_text_draw(draw, x_pos, y_pos, txt, font, **kwargs)
- def _engine_text_draw(self, draw, (x_pos, y_pos), txt, font, **kwargs):
+ def _engine_text_draw(self, draw, pos, txt, font, **kwargs):
raise NotImplementedError('Text drawing undefined for render engine')
def _draw_grid_labels(self, draw, xys, linetype, txt, font, **kwargs):
@@ -91,8 +95,10 @@ class ContourWriterBase(object):
offset by margins and returns an array of coordintes"""
x_size, y_size = size
- def is_in_box((x, y), (xmin, xmax, ymin, ymax)):
- if x > xmin and x < xmax and y > ymin and y < ymax:
+ def is_in_box(x_y, extents):
+ x, y = x_y
+ xmin, xmax, ymin, ymax = extents
+ if xmin < x < xmax and ymin < y < ymax:
return True
else:
return False
@@ -703,7 +709,7 @@ class ContourWriterBase(object):
Area Definition of the creating image
"""
- config = ConfigParser()
+ config = configparser.ConfigParser()
try:
with open(config_file, 'r'):
logger.info("Overlays config file %s found", str(config_file))
@@ -712,11 +718,11 @@ class ContourWriterBase(object):
logger.error("Overlays config file %s does not exist!",
str(config_file))
raise
- except NoSectionError:
+ except configparser.NoSectionError:
logger.error("Error in %s", str(config_file))
raise
- # Cache management
+ # Cache management
cache_file = None
if config.has_section('cache'):
config_file_name, config_file_extention = \
@@ -727,7 +733,7 @@ class ContourWriterBase(object):
try:
configTime = os.path.getmtime(config_file)
cacheTime = os.path.getmtime(cache_file)
- # Cache file will be used only if it's newer than config file
+ # Cache file will be used only if it's newer than config file
if configTime < cacheTime:
foreground = Image.open(cache_file)
logger.info('Using image in cache %s', cache_file)
@@ -896,7 +902,7 @@ class ContourWriterBase(object):
try:
(x, y) = area_def.get_xy_from_lonlat(lons, lats)
- except ValueError, exc:
+ except ValueError as exc:
logger.debug("Point not added (%s)", str(exc))
else:
diff --git a/pycoast/cw_pil.py b/pycoast/cw_pil.py
index b4f1b16..74a5474 100644
--- a/pycoast/cw_pil.py
+++ b/pycoast/cw_pil.py
@@ -26,7 +26,7 @@ from PIL import Image, ImageFont
from PIL import ImageDraw
import logging
-from cw_base import ContourWriterBase
+from pycoast.cw_base import ContourWriterBase
logger = logging.getLogger(__name__)
@@ -50,7 +50,7 @@ class ContourWriter(ContourWriterBase):
return ImageDraw.Draw(image)
- def _engine_text_draw(self, draw, (x_pos, y_pos), txt, font, **kwargs):
+ def _engine_text_draw(self, draw, x_pos, y_pos, txt, font, **kwargs):
draw.text((x_pos, y_pos), txt, font=font, fill=kwargs['fill'])
def _draw_polygon(self, draw, coordinates, **kwargs):
@@ -218,7 +218,7 @@ class ContourWriter(ContourWriterBase):
self._add_polygon(image, area_def, lonlats, x_offset=x_offset,
y_offset=y_offset, fill=fill, outline=outline)
- def add_grid(self, image, area_def, (Dlon, Dlat), (dlon, dlat),
+ def add_grid(self, image, area_def, Dlonlat, dlonlat,
font=None, write_text=True, fill=None, outline='white',
minor_outline='white', minor_is_tick=True,
lon_placement='tb', lat_placement='lr'):
@@ -229,9 +229,9 @@ class ContourWriter(ContourWriterBase):
PIL image object
proj4_string : str
Projection of area as Proj.4 string
- (Dlon,Dlat): (float,float)
+ Dlonlat: (float, float)
Major grid line separation
- (dlon,dlat): (float,float)
+ dlonlat: (float, float)
Minor grid line separation
font: PIL ImageFont object, optional
Font for major line markings
@@ -246,12 +246,14 @@ class ContourWriter(ContourWriterBase):
minor_is_tick : boolean, optional
Use tick minor line style (True) or full minor line style (False)
"""
+ Dlon, Dlat = Dlonlat
+ dlon, dlat = dlonlat
self._add_grid(image, area_def, Dlon, Dlat, dlon, dlat, font=font,
write_text=write_text, fill=fill, outline=outline,
minor_outline=minor_outline, minor_is_tick=minor_is_tick,
lon_placement=lon_placement, lat_placement=lat_placement)
- def add_grid_to_file(self, filename, area_def, (Dlon, Dlat), (dlon, dlat),
+ def add_grid_to_file(self, filename, area_def, Dlonlat, dlonlat,
font=None, write_text=True, fill=None, outline='white',
minor_outline='white', minor_is_tick=True,
lon_placement='tb', lat_placement='lr'):
@@ -262,9 +264,9 @@ class ContourWriter(ContourWriterBase):
PIL image object
proj4_string : str
Projection of area as Proj.4 string
- (Dlon,Dlat): (float,float)
+ Dlonlat: (float, float)
Major grid line separation
- (dlon,dlat): (float,float)
+ dlonlat: (float, float)
Minor grid line separation
font: PIL ImageFont object, optional
Font for major line markings
@@ -279,9 +281,8 @@ class ContourWriter(ContourWriterBase):
minor_is_tick : boolean, optional
Use tick minor line style (True) or full minor line style (False)
"""
-
image = Image.open(filename)
- self.add_grid(image, area_def, (Dlon, Dlat), (dlon, dlat), font=font,
+ self.add_grid(image, area_def, Dlonlat, dlonlat, font=font,
write_text=write_text, fill=fill, outline=outline,
minor_outline=minor_outline,
minor_is_tick=minor_is_tick,
diff --git a/pycoast/tests/test_pycoast.py b/pycoast/tests/test_pycoast.py
index 8d8fb8b..9cc8348 100644
--- a/pycoast/tests/test_pycoast.py
+++ b/pycoast/tests/test_pycoast.py
@@ -100,7 +100,7 @@ class TestPIL(TestPycoast):
cw.add_borders(img, area_def, outline=(255, 0, 0))
res = np.array(img)
- self.failUnless(fft_metric(euro_data, res),
+ self.assertTrue(fft_metric(euro_data, res),
'Writing of contours failed')
def test_europe_file(self):
@@ -119,7 +119,7 @@ class TestPIL(TestPycoast):
img = Image.open(test_file)
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(euro_data, res), 'Writing of contours failed')
def test_geos(self):
@@ -137,7 +137,7 @@ class TestPIL(TestPycoast):
cw.add_coastlines(img, area_def, resolution='l')
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(geos_data, res), 'Writing of geos contours failed')
def test_grid(self):
@@ -161,7 +161,7 @@ class TestPIL(TestPycoast):
outline='blue', minor_outline='blue')
res = np.array(img)
- self.failUnless(fft_metric(grid_data, res), 'Writing of grid failed')
+ self.assertTrue(fft_metric(grid_data, res), 'Writing of grid failed')
def test_grid_geos(self):
geos_img = Image.open(
@@ -180,7 +180,7 @@ class TestPIL(TestPycoast):
write_text=False)
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(geos_data, res), 'Writing of geos contours failed')
def test_grid_file(self):
@@ -204,7 +204,7 @@ class TestPIL(TestPycoast):
img = Image.open(grid_file)
res = np.array(img)
- self.failUnless(fft_metric(grid_data, res), 'Writing of grid failed')
+ self.assertTrue(fft_metric(grid_data, res), 'Writing of grid failed')
def test_dateline_cross(self):
dl_img = Image.open(os.path.join(os.path.dirname(__file__),
@@ -228,7 +228,7 @@ class TestPIL(TestPycoast):
lon_placement='b', lat_placement='lr')
res = np.array(img)
- self.failUnless(fft_metric(dl_data, res),
+ self.assertTrue(fft_metric(dl_data, res),
'Writing of dateline crossing data failed')
def test_dateline_boundary_cross(self):
@@ -254,7 +254,7 @@ class TestPIL(TestPycoast):
lon_placement='b', lat_placement='lr')
res = np.array(img)
- self.failUnless(fft_metric(dl_data, res),
+ self.assertTrue(fft_metric(dl_data, res),
'Writing of dateline boundary crossing data failed')
def test_grid_nh(self):
@@ -279,7 +279,7 @@ class TestPIL(TestPycoast):
lon_placement='tblr', lat_placement='')
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(grid_data, res), 'Writing of nh grid failed')
def test_add_polygon(self):
@@ -314,7 +314,7 @@ class TestPIL(TestPycoast):
cw.add_coastlines(img, area_def, resolution='l', level=4)
res = np.array(img)
- self.failUnless(fft_metric(grid_data, res),
+ self.assertTrue(fft_metric(grid_data, res),
'Writing of nh polygons failed')
def test_add_shapefile_shapes(self):
@@ -345,7 +345,7 @@ class TestPIL(TestPycoast):
outline='blue', fill='green')
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(grid_data, res), 'Writing of Brazil shapefiles failed')
@@ -370,7 +370,7 @@ class TestPILAGG(TestPycoast):
cw.add_borders(img, area_def, outline=(255, 0, 0),
width=3, outline_opacity=32)
res = np.array(img)
- self.failUnless(fft_metric(euro_data, res),
+ self.assertTrue(fft_metric(euro_data, res),
'Writing of contours failed for AGG')
def test_europe_agg_file(self):
@@ -392,7 +392,7 @@ class TestPILAGG(TestPycoast):
img = Image.open(test_file)
res = np.array(img)
- self.failUnless(fft_metric(euro_data, res),
+ self.assertTrue(fft_metric(euro_data, res),
'Writing of contours failed for AGG')
def test_geos_agg(self):
@@ -411,7 +411,7 @@ class TestPILAGG(TestPycoast):
cw.add_coastlines(img, (proj4_string, area_extent),
resolution='l', width=0.5)
res = np.array(img)
- self.failUnless(fft_metric(geos_data, res),
+ self.assertTrue(fft_metric(geos_data, res),
'Writing of geos contours failed for AGG')
def test_grid_agg(self):
@@ -435,7 +435,7 @@ class TestPILAGG(TestPycoast):
minor_width=0.5, minor_is_tick=False)
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(grid_data, res), 'Writing of grid failed for AGG')
def test_grid_agg_txt(self):
@@ -464,7 +464,7 @@ class TestPILAGG(TestPycoast):
minor_width=0.5, minor_is_tick=False, write_text=False)
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(grid_data, res), 'Writing of grid failed for AGG')
def test_grid_geos_agg(self):
@@ -485,7 +485,7 @@ class TestPILAGG(TestPycoast):
write_text=False)
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(geos_data, res), 'Writing of geos contours failed')
def test_grid_agg_file(self):
@@ -509,7 +509,7 @@ class TestPILAGG(TestPycoast):
minor_width=0.5, minor_is_tick=False)
img = Image.open(grid_file)
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(grid_data, res), 'Writing of grid failed for AGG')
def test_grid_nh_agg(self):
@@ -540,7 +540,7 @@ class TestPILAGG(TestPycoast):
# NOTE: Experience inconsistency in ttf font writing between systems.
# Still trying to figure out why this test sometimes fails to write
# correct font markings.
- self.failUnless(fft_metric(grid_data, res),
+ self.assertTrue(fft_metric(grid_data, res),
'Writing of nh grid failed for AGG')
def test_add_polygon_agg(self):
@@ -578,7 +578,7 @@ class TestPILAGG(TestPycoast):
cw.add_coastlines(img, area_def, resolution='l', level=4)
res = np.array(img)
- self.failUnless(fft_metric(grid_data, res),
+ self.assertTrue(fft_metric(grid_data, res),
'Writing of nh polygons failed')
def test_add_shapefile_shapes_agg(self):
@@ -611,7 +611,7 @@ class TestPILAGG(TestPycoast):
outline='blue', fill='green')
res = np.array(img)
- self.failUnless(
+ self.assertTrue(
fft_metric(grid_data, res), 'Writing of Brazil shapefiles failed')
diff --git a/pycoast/version.py b/pycoast/version.py
index e400e26..fbe74d4 100644
--- a/pycoast/version.py
+++ b/pycoast/version.py
@@ -16,4 +16,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__version__ = '0.6.1'
+__version__ = '1.0.0'
diff --git a/setup.py b/setup.py
index f9a2d1d..6ee78b5 100644
--- a/setup.py
+++ b/setup.py
@@ -15,21 +15,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import sys
from setuptools import setup
-import imp
-version = imp.load_source('pycoast.version', 'pycoast/version.py')
+def get_version():
+ if sys.version_info >= (3, 5):
+ import importlib
+ spec = importlib.util.spec_from_file_location('version', 'pycoast/version.py')
+ version = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(version)
+ else:
+ # python 2.7 doesn't have the `importlib.util` package
+ # python 3.4 doesn't have the `module_from_spec` method
+ import imp
+ version = imp.load_source('pycoast.version', 'pycoast/version.py')
+ return version.__version__
-requires = ["pyshp", 'numpy', 'pyproj']
-
-try:
- from PIL import Image
-except ImportError:
- requires.append("pillow")
+requires = ["pyshp", 'numpy', 'pyproj', 'pillow', 'six']
setup(name='pycoast',
- version=version.__version__,
+ version=get_version(),
description='Writing of coastlines, borders and rivers to images in Python',
author='Esben S. Nielsen',
author_email='esn at dmi.dk',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pycoast.git
More information about the Pkg-grass-devel
mailing list