[Git][debian-gis-team/aggdraw][upstream] New upstream version 1.3.10
Antonio Valentino
gitlab at salsa.debian.org
Sun Jul 7 11:52:00 BST 2019
Antonio Valentino pushed to branch upstream at Debian GIS Project / aggdraw
Commits:
87f1279a by Antonio Valentino at 2019-07-07T10:03:01Z
New upstream version 1.3.10
- - - - -
12 changed files:
- .travis.yml
- CHANGES → CHANGELOG.md
- aggdraw.cxx
- appveyor.yml
- ci/travis-install.sh
- doc/Makefile
- − doc/index.rst
- doc/make.bat
- doc/conf.py → doc/source/conf.py
- + doc/source/index.rst
- selftest.py
- setup.py
Changes:
=====================================
.travis.yml
=====================================
@@ -4,12 +4,13 @@ env:
- PYTHON_VERSION=$TRAVIS_PYTHON_VERSION
- NUMPY_VERSION=stable
- MAIN_CMD='python setup.py'
- - CONDA_DEPENDENCIES='sphinx pillow coveralls coverage'
+ - CONDA_DEPENDENCIES='sphinx pillow coveralls coverage pytest'
- SETUP_XVFB=False
- EVENT_TYPE='push pull_request'
- SETUP_CMD='test'
- CONDA_CHANNELS='conda-forge'
- - CIBW_TEST_REQUIRES='numpy pillow'
+ - CONDA_CHANNEL_PRIORITY='True'
+ - CIBW_TEST_REQUIRES='numpy pillow pytest'
- CIBW_TEST_COMMAND='python {project}/selftest.py'
- CIBW_BEFORE_BUILD_LINUX='yum install -y freetype-devel'
- TWINE_USERNAME='dhoese'
=====================================
CHANGES → CHANGELOG.md
=====================================
@@ -1,119 +1,136 @@
-The Python Imaging Library: The aggdraw Module
-
-*** Version 1.3.6 ***
-
-- Fix Freetype linking on Linux with no freetype-config
-
-*** Version 1.3.5 ***
-
-- Fix Freetype linking on Windows by using ctypes
-
-*** Changes from release 1.3.3 to 1.3.4 ***
-
-- Fix Freetype linking on certain systems [#27]
-
-*** Changes from release 1.3.2 to 1.3.3 ***
-
-- Fix Windows compatibility [#25]
-
-*** Changes from release 1.3.1 to 1.3.2 ***
-
-- Fix segmentation fault with certain compilers [#22]
-
-*** Changes from release 1.3 to 1.3.1 ***
-
-- Fix Python 2 compatibility when getting RGB from string colors [#21]
-- Re-add ability to get colors from PIL [#21]
-
-*** Changes from release 1.2 to 1.3 ***
-
-- Python 3 support added
-- Use freetype-config to find root freetype directory
-- REVIVE THE PROJECT!
-
-*** Changes from release 1.1 to 1.2 ***
-
-(1.2a3 released)
-
-- Fixed crash when using type() or help() on aggdraw objects.
-
-- Fixed crash in Path() constructor.
-
-- Fixed some build issues under recent GCC versions. The compiler
- still issues more warnings than it should; I'll have to fix that
- in a future release.
-
-(1.2a2 released)
-
-- Changed 'expose' method to require keyword arguments. You can
- use 'hwnd' to pass in a window handle, or 'hdc' to pass in a
- device context:
-
- dib.expose(hwnd=window)
- dib.expose(hdc=dc)
-
-- Added 'clear' method. By default, it fills the entire image to
- the original background color. If you pass in a color name, it
- uses the given color instead.
-
-(1.2a1 released)
-
-- Added experimental 'Dib' support (based on code from the Python
- Imaging Library). The 'Dib' factory is similar to 'Draw', but
- allows the drawing context to be copied to the display.
-
- dib = Dib("RGB", size, background)
-
- ... draw ...
-
- dib.expose(hwnd=wnd)
-
-- Fixed a couple of gcc compiler nits.
-
-*** Changes from release 1.0 to 1.1 ***
-
-(1.1 released)
-
-- Fixed rendering of symbols containing nested polygons (broken in
- 1.1b3).
-
-- Added 'coords' method to the Path type. This returns the current
- path as a polyline. If the path consists of multiple path fragments,
- the return value is undefined. (experimental)
-
-(1.1b3 released)
-
-- The Windows installer now uses Freetype 2.1.10. This seems to fix
- the issue with irregular baselines reported for some fonts.
-
-- Performance: changes to how and when drawing adapters are created,
- and proper clipping in the rasterizer can result in massive speedups
- for some applications.
-
-- Added experimental 'setantialias' method to the drawing context.
- Pass in 0 to disable antialiasing, 1 to enable it. Antialiasing
- is enabled by default.
-
-- Adjust the size of filled objects (including polygons) depending
- on the pen width. If no pen is used, filled antialiased objects
- are expanded by a half pixel, to avoid banding. If a pen is used,
- the objects are shrunk by a half pen width. (experimental)
-
-(1.1b2 released; internal release only)
-
-- Fixed background color bug for non-RGBA images. The third
- argument to the Draw constructor now works properly for all
- modes.
-
-- Fixed big resource leak in the Draw(im) constructor. The alternate
- form (Draw(mode, size)) does not leak (reported by H�kan Karlsson).
-
-- Added Path object. Path objects can be used instead of coordinates
- with the 'line' and 'polygon' primitives. Path objects can also be
- used as symbols.
-
-(1.1b1 released)
-
-- Use ImageColor.getrgb to resolve colors, if available.
-
-(1.0 final released)
+# The aggdraw Library
+
+## Version 1.3.10
+
+- Fix Draw.path docstring mentioning unused x/y coordinates
+- Fix compilation on OSX 10.9+
+
+## Version 1.3.9
+
+- Add docstrings to public functions from original effbot documentation
+
+## Version 1.3.8
+
+- Force rebuild to get working linux wheels
+
+## Version 1.3.7
+
+- Add binary wheel building
+
+## Version 1.3.6
+
+- Fix Freetype linking on Linux with no freetype-config
+
+## Version 1.3.5
+
+- Fix Freetype linking on Windows by using ctypes
+
+## Version 1.3.4
+
+- Fix Freetype linking on certain systems [#27]
+
+## Version 1.3.3
+
+- Fix Windows compatibility [#25]
+
+## Version 1.3.2
+
+- Fix segmentation fault with certain compilers [#22]
+
+## Version 1.3.1
+
+- Fix Python 2 compatibility when getting RGB from string colors [#21]
+- Re-add ability to get colors from PIL [#21]
+
+## Version 1.3.0
+
+- Python 3 support added
+- Use freetype-config to find root freetype directory
+- REVIVE THE PROJECT!
+
+## Changes from release 1.1 to 1.2
+
+(1.2a3 released)
+
+- Fixed crash when using type() or help() on aggdraw objects.
+
+- Fixed crash in Path() constructor.
+
+- Fixed some build issues under recent GCC versions. The compiler
+ still issues more warnings than it should; I'll have to fix that
+ in a future release.
+
+(1.2a2 released)
+
+- Changed 'expose' method to require keyword arguments. You can
+ use 'hwnd' to pass in a window handle, or 'hdc' to pass in a
+ device context:
+
+ dib.expose(hwnd=window)
+ dib.expose(hdc=dc)
+
+- Added 'clear' method. By default, it fills the entire image to
+ the original background color. If you pass in a color name, it
+ uses the given color instead.
+
+(1.2a1 released)
+
+- Added experimental 'Dib' support (based on code from the Python
+ Imaging Library). The 'Dib' factory is similar to 'Draw', but
+ allows the drawing context to be copied to the display.
+
+ dib = Dib("RGB", size, background)
+
+ ... draw ...
+
+ dib.expose(hwnd=wnd)
+
+- Fixed a couple of gcc compiler nits.
+
+## Changes from release 1.0 to 1.1
+
+(1.1 released)
+
+- Fixed rendering of symbols containing nested polygons (broken in
+ 1.1b3).
+
+- Added 'coords' method to the Path type. This returns the current
+ path as a polyline. If the path consists of multiple path fragments,
+ the return value is undefined. (experimental)
+
+(1.1b3 released)
+
+- The Windows installer now uses Freetype 2.1.10. This seems to fix
+ the issue with irregular baselines reported for some fonts.
+
+- Performance: changes to how and when drawing adapters are created,
+ and proper clipping in the rasterizer can result in massive speedups
+ for some applications.
+
+- Added experimental 'setantialias' method to the drawing context.
+ Pass in 0 to disable antialiasing, 1 to enable it. Antialiasing
+ is enabled by default.
+
+- Adjust the size of filled objects (including polygons) depending
+ on the pen width. If no pen is used, filled antialiased objects
+ are expanded by a half pixel, to avoid banding. If a pen is used,
+ the objects are shrunk by a half pen width. (experimental)
+
+(1.1b2 released; internal release only)
+
+- Fixed background color bug for non-RGBA images. The third
+ argument to the Draw constructor now works properly for all
+ modes.
+
+- Fixed big resource leak in the Draw(im) constructor. The alternate
+ form (Draw(mode, size)) does not leak (reported by H�kan Karlsson).
+
+- Added Path object. Path objects can be used instead of coordinates
+ with the 'line' and 'polygon' primitives. Path objects can also be
+ used as symbols.
+
+(1.1b1 released)
+
+- Use ImageColor.getrgb to resolve colors, if available.
+
+(1.0 final released)
=====================================
aggdraw.cxx
=====================================
@@ -1329,7 +1329,7 @@ draw_rectangle(DrawObject* self, PyObject* args)
return Py_None;
}
-const char *draw_path_doc = "Draw a path at the given positions (experimental).\n"
+const char *draw_path_doc = "Draw the given path.\n"
"\n"
"If a brush is given, it is used to fill the path.\n"
"If a pen is given, it is used to draw an outline around the path.\n"
@@ -1337,8 +1337,6 @@ const char *draw_path_doc = "Draw a path at the given positions (experimental).\
"\n"
"Parameters\n"
"----------\n"
- "xy : iterable\n"
- " A Python sequence (x, y, x, y, …).\n"
"path : Path\n"
" Path object created by the `Path` factory.\n"
"pen : Pen\n"
=====================================
appveyor.yml
=====================================
@@ -3,15 +3,16 @@ environment:
PYTHON: "C:\\conda"
MINICONDA_VERSION: "latest"
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd"
- CONDA_DEPENDENCIES: "sphinx pillow coveralls coverage"
+ CONDA_DEPENDENCIES: "sphinx pillow coveralls coverage pytest"
CONDA_CHANNELS: "conda-forge"
+ CONDA_CHANNEL_PRIORITY: "True"
TWINE_USERNAME: "dhoese"
TWINE_PASSWORD:
secure: zws6RrJGZ5XULrqXQDF/Cw==
matrix:
- - CIBW_TEST_REQUIRES: "numpy pillow"
+ - CIBW_TEST_REQUIRES: "numpy pillow pytest"
CIBW_TEST_COMMAND: "python {project}\\selftest.py"
CIBUILDWHEEL: 1
@@ -48,7 +49,7 @@ install:
build: false # Not a C# project, build stuff at the test step instead.
build_script:
- - if [%CIBUILDWHEEL%]==[1] pip install cibuildwheel==0.10.0
+ - if [%CIBUILDWHEEL%]==[1] pip install cibuildwheel
- if [%CIBUILDWHEEL%]==[1] cibuildwheel --output-dir dist
- if [%CIBUILDWHEEL%]==[1] powershell ci/appveyor-twine.ps1
=====================================
ci/travis-install.sh
=====================================
@@ -1,16 +1,12 @@
#!/usr/bin/env bash
-if [ "${BUILDMODE}" = "ASTROPY" ]; then
-
+if [[ "${BUILDMODE}" == "ASTROPY" ]]; then
git clone --depth 1 git://github.com/astropy/ci-helpers.git
source ci-helpers/travis/setup_conda.sh
-
-elif [ "${BUILDMODE}" = "CIBUILDWHEEL" ]; then
-
+elif [[ "${BUILDMODE}" == "CIBUILDWHEEL" ]]; then
export PIP=pip
- if [ $(uname) = "Darwin" ]; then
+ if [[ $(uname) == "Darwin" ]]; then
export PIP=pip2
fi
- $PIP install cibuildwheel==0.10.0
-
+ $PIP install cibuildwheel
fi
\ No newline at end of file
=====================================
doc/Makefile
=====================================
@@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
-SOURCEDIR = .
+SOURCEDIR = source
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
=====================================
doc/index.rst deleted
=====================================
@@ -1,19 +0,0 @@
-.. aggdraw documentation master file, created by
- sphinx-quickstart on Sun Nov 25 14:38:56 2018.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-AggDraw's documentation
-=======================
-
-.. automodule:: aggdraw
- :members:
- :undoc-members:
- :show-inheritance:
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
=====================================
doc/make.bat
=====================================
@@ -7,7 +7,7 @@ REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
-set SOURCEDIR=.
+set SOURCEDIR=source
set BUILDDIR=_build
if "%1" == "" goto help
=====================================
doc/conf.py → doc/source/conf.py
=====================================
@@ -187,7 +187,7 @@ epub_exclude_files = ['search.html']
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'https://docs.python.org/': None}
+intersphinx_mapping = {'https://docs.python.org/3/': None}
# -- Options for todo extension ----------------------------------------------
=====================================
doc/source/index.rst
=====================================
@@ -0,0 +1,47 @@
+AggDraw
+=======
+
+The AggDraw library provides a python interface on top of
+`the AGG library <http://www.antigrain.com/>`_. The library was originally
+developed by Fredrik Lundh (effbot), but has since been picked up by various
+developers. It is currently maintained by the PyTroll developmer group. The
+official repository can be found on GitHub:
+
+https://github.com/pytroll/aggdraw
+
+The original documentation by effbot is
+`still available <http://effbot.org/zone/aggdraw-index.htm>`_ but may be out
+of date with the current version of the library. Original examples will be
+migrated as time is available (pull requests welcome).
+
+Installation
+============
+
+Aggdraw is available on Linux, OSX, and Windows. It can be installed from PyPI
+with pip:
+
+.. code-block:: bash
+
+ pip install aggdraw
+
+Or from conda with the conda-forge channel:
+
+.. code-block:: bash
+
+ conda install -c conda-forge aggdraw
+
+API
+===
+
+.. automodule:: aggdraw
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
=====================================
selftest.py
=====================================
@@ -1,201 +1,165 @@
-# $Id$
-# -*- coding: iso-8859-1 -*-
-# sanity check
-
-import numpy as np
-from PIL import Image
-import aggdraw
-from aggdraw import Draw, Symbol, Brush, Pen, Path
-
-
-def test_module_init():
- """
-
- >>> assert hasattr(aggdraw, 'VERSION')
- >>> assert isinstance(aggdraw.VERSION, str)
- >>> assert hasattr(aggdraw, '__version__')
- >>> assert isinstance(aggdraw.__version__, str)
-
- """
-
-
-def test_draw():
- """
-
- >>> draw = Draw("RGB")
- Traceback (most recent call last):
- AttributeError: 'str' object has no attribute 'mode'
-
- >>> draw = Draw("RGB", (800, 600))
- >>> draw.mode, draw.size
- ('RGB', (800, 600))
-
- >>> draw = Draw("RGB", (800, 600), "white")
- >>> draw.mode, draw.size
- ('RGB', (800, 600))
-
- >>> im = Image.new("RGB", (600, 800))
- >>> draw = Draw(im)
- >>> draw.mode, draw.size
- ('RGB', (600, 800))
-
-
- """
-
-def test_flush():
- """
-
- >>> im = Image.new("RGB", (600, 800))
- >>> draw = Draw(im)
- >>> draw.flush().mode
- 'RGB'
- """
-
-
-def test_pen():
- """
-
- >>> pen = Pen("black")
- >>> pen = Pen("black", 1)
- >>> pen = Pen("black", 1.5)
- >>> pen = Pen("black", 1, opacity=128)
-
- >>> pen = Pen(0)
- >>> pen = Pen((0,0,0))
- >>> pen = Pen("rgb(0,0,0)")
- >>> pen = Pen("gold")
-
- """
-
-
-def test_brush():
- """
-
- >>> brush = Brush("black")
- >>> brush = Brush("black", opacity=128)
-
- >>> brush = Brush(0)
- >>> brush = Brush((0,0,0))
- >>> brush = Brush("rgb(0,0,0)")
- >>> brush = Brush("gold")
-
- """
-
-
-def test_graphics():
- """
-
- >>> draw = Draw("RGB", (500, 500))
-
- >>> pen = Pen("black")
- >>> brush = Brush("black")
-
- >>> draw.line((50, 50, 100, 100), pen)
-
- >>> draw.rectangle((50, 150, 100, 200), pen)
- >>> draw.rectangle((50, 220, 100, 270), brush)
- >>> draw.rectangle((50, 290, 100, 340), brush, pen)
- >>> draw.rectangle((50, 360, 100, 410), pen, brush)
-
- >>> draw.ellipse((120, 150, 170, 200), pen)
- >>> draw.ellipse((120, 220, 170, 270), brush)
- >>> draw.ellipse((120, 290, 170, 340), brush, pen)
- >>> draw.ellipse((120, 360, 170, 410), pen, brush)
-
- >>> draw.polygon((190+25, 150, 190, 200, 190+50, 200), pen)
- >>> draw.polygon((190+25, 220, 190, 270, 190+50, 270), brush)
- >>> draw.polygon((190+25, 290, 190, 340, 190+50, 340), brush, pen)
- >>> draw.polygon((190+25, 360, 190, 410, 190+50, 410), pen, brush)
-
- """
-
-
-def test_graphics2():
- """See issue #14
-
- >>> symbol = Symbol("M400 200 L400 400")
- >>> pen = Pen("red")
- >>> image = Image.fromarray(np.zeros((800, 600, 3)), mode="RGB")
- >>> canvas = Draw(image)
- >>> canvas.symbol((0, 0), symbol, pen)
- >>> image_pointer = canvas.flush()
- >>> assert np.asarray(image).sum() == 50800
-
- """
-
-
-def test_graphics3():
- """See issue #22
-
- >>> main = Image.new('RGB', (480, 1024), 'white')
- >>> d = aggdraw.Draw(main)
- >>> p = aggdraw.Pen((90,) * 3, 0.5)
-
- """
-
-
-def test_path():
- """
-
- >>> p = Path()
- >>> p = Path([0,0])
- >>> p = Path([0,0,0,0])
-
- >>> p = Path()
- >>> p.moveto(0, 0)
- >>> p.lineto(1, 1)
- >>> p.coords()
- [0.0, 0.0, 1.0, 1.0]
-
- >>> p.curveto(0, 0, 0, 0, 0, 0)
- >>> p.close()
- >>> p.coords()
- [0.0, 0.0, 1.0, 1.0, 0.125, 0.125, 0.0, 0.0]
-
- >>> draw = Draw("RGB", (800, 600))
- >>> draw.line(p)
- >>> draw.polygon(p)
- >>> draw.symbol((0, 0), p)
-
- """
-
-
-def test_symbol():
- """
-
- >>> s = Symbol("M0,0L0,0L0,0L0,0Z")
- >>> s = Symbol("M0,0L0,0,0,0,0,0Z", 10)
- >>> s = Symbol("M0,0C0,0,0,0,0,0Z")
- >>> s = Symbol("M0,0S0,0,0,0,0,0Z")
-
- >>> s = Symbol("m0,0l0,0l0,0l0,0z")
- >>> s = Symbol("m0,0l0,0,0,0,0,0z", 10)
- >>> s = Symbol("m0,0c0,0,0,0,0,0z")
- >>> s = Symbol("m0,0s0,0,0,0,0,0z")
-
- """
-
-
-def test_transform():
- """
-
- >>> draw = Draw("RGB", (500, 500))
-
- >>> draw.settransform()
- >>> draw.settransform((250, 250))
- >>> draw.settransform((1, 0, 250, 0, 1, 250))
- >>> draw.settransform((2.0, 0.5, 250, 0.5, 2.0, 250))
- >>> draw.settransform()
-
- """
-
-
-if __name__ == "__main__":
- # use doctest to make sure the test program behaves as documented!
- import sys, doctest, selftest
- status = doctest.testmod(selftest)
- if status[0]:
- print("*** %s tests of %d failed." % status)
- else:
- print("%s tests passed." % status[1])
- sys.exit(int(status[0]))
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# sanity check
+
+import pytest
+
+
+def test_module_init():
+ import aggdraw
+ assert hasattr(aggdraw, 'VERSION')
+ assert isinstance(aggdraw.VERSION, str)
+ assert hasattr(aggdraw, '__version__')
+ assert isinstance(aggdraw.__version__, str)
+
+
+def test_draw():
+ from aggdraw import Draw
+ from PIL import Image
+ with pytest.raises(AttributeError) as excinfo:
+ Draw("RGB")
+ assert "'str' object has no attribute 'mode'" in str(excinfo.value)
+
+ draw = Draw("RGB", (800, 600))
+ assert draw.mode == 'RGB'
+ assert draw.size == (800, 600)
+
+ draw = Draw("RGB", (800, 600), "white")
+ assert draw.mode == 'RGB'
+ assert draw.size == (800, 600)
+
+ im = Image.new("RGB", (600, 800))
+ draw = Draw(im)
+ assert draw.mode == 'RGB'
+ assert draw.size == (600, 800)
+
+
+def test_flush():
+ from aggdraw import Draw
+ from PIL import Image
+ im = Image.new("RGB", (600, 800))
+ draw = Draw(im)
+ assert draw.flush().mode == 'RGB'
+
+
+def test_pen():
+ from aggdraw import Pen
+ Pen("black")
+ Pen("black", 1)
+ Pen("black", 1.5)
+ Pen("black", 1, opacity=128)
+
+ Pen(0)
+ Pen((0,0,0))
+ Pen("rgb(0,0,0)")
+ Pen("gold")
+
+
+def test_brush():
+ from aggdraw import Brush
+ Brush("black")
+ Brush("black", opacity=128)
+
+ Brush(0)
+ Brush((0, 0, 0))
+ Brush("rgb(0, 0, 0)")
+ Brush("gold")
+
+
+def test_graphics():
+ from aggdraw import Draw, Pen, Brush
+ draw = Draw("RGB", (500, 500))
+
+ pen = Pen("black")
+ brush = Brush("black")
+
+ draw.line((50, 50, 100, 100), pen)
+
+ draw.rectangle((50, 150, 100, 200), pen)
+ draw.rectangle((50, 220, 100, 270), brush)
+ draw.rectangle((50, 290, 100, 340), brush, pen)
+ draw.rectangle((50, 360, 100, 410), pen, brush)
+
+ draw.ellipse((120, 150, 170, 200), pen)
+ draw.ellipse((120, 220, 170, 270), brush)
+ draw.ellipse((120, 290, 170, 340), brush, pen)
+ draw.ellipse((120, 360, 170, 410), pen, brush)
+
+ draw.polygon((190+25, 150, 190, 200, 190+50, 200), pen)
+ draw.polygon((190+25, 220, 190, 270, 190+50, 270), brush)
+ draw.polygon((190+25, 290, 190, 340, 190+50, 340), brush, pen)
+ draw.polygon((190+25, 360, 190, 410, 190+50, 410), pen, brush)
+
+
+def test_graphics2():
+ """See issue #14."""
+ from aggdraw import Draw, Symbol, Pen
+ from PIL import Image
+ import numpy as np
+ symbol = Symbol("M400 200 L400 400")
+ pen = Pen("red")
+ image = Image.fromarray(np.zeros((800, 600, 3)), mode="RGB")
+ canvas = Draw(image)
+ canvas.symbol((0, 0), symbol, pen)
+ canvas.flush()
+ assert np.asarray(image).sum() == 50800
+
+
+def test_graphics3():
+ """See issue #22."""
+ from aggdraw import Draw, Pen
+ from PIL import Image
+ main = Image.new('RGB', (480, 1024), 'white')
+ d = Draw(main)
+ p = Pen((90,) * 3, 0.5)
+
+
+def test_path():
+ from aggdraw import Draw, Path
+ Path()
+ Path([0, 0])
+ Path([0, 0, 0, 0])
+
+ p = Path()
+ p.moveto(0, 0)
+ p.lineto(1, 1)
+ assert p.coords() == [0.0, 0.0, 1.0, 1.0]
+
+ p.curveto(0, 0, 0, 0, 0, 0)
+ p.close()
+ p.coords()
+ assert p.coords() == [0.0, 0.0, 1.0, 1.0, 0.125, 0.125, 0.0, 0.0]
+
+ draw = Draw("RGB", (800, 600))
+ draw.line(p)
+ draw.polygon(p)
+ draw.symbol((0, 0), p)
+
+
+def test_symbol():
+ from aggdraw import Symbol
+ Symbol("M0,0L0,0L0,0L0,0Z")
+ Symbol("M0,0L0,0,0,0,0,0Z", 10)
+ Symbol("M0,0C0,0,0,0,0,0Z")
+ Symbol("M0,0S0,0,0,0,0,0Z")
+
+ Symbol("m0,0l0,0l0,0l0,0z")
+ Symbol("m0,0l0,0,0,0,0,0z", 10)
+ Symbol("m0,0c0,0,0,0,0,0z")
+ Symbol("m0,0s0,0,0,0,0,0z")
+
+
+def test_transform():
+ from aggdraw import Draw
+ draw = Draw("RGB", (500, 500))
+
+ draw.settransform()
+ draw.settransform((250, 250))
+ draw.settransform((1, 0, 250, 0, 1, 250))
+ draw.settransform((2.0, 0.5, 250, 0.5, 2.0, 250))
+ draw.settransform()
+
+
+if __name__ == "__main__":
+ import sys
+ sys.exit(pytest.main(sys.argv))
=====================================
setup.py
=====================================
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
#
# Setup script for aggdraw
#
@@ -14,13 +15,16 @@ from __future__ import print_function
import os
import sys
import subprocess
+import platform
+from distutils.sysconfig import get_config_var
+from distutils.version import LooseVersion
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
-VERSION = "1.3.9"
+VERSION = "1.3.10"
SUMMARY = "High quality drawing interface for PIL."
@@ -34,6 +38,22 @@ with the WCK renderer.
"""
+def is_platform_mac():
+ return sys.platform == 'darwin'
+
+
+# For mac, ensure extensions are built for macos 10.9 when compiling on a
+# 10.9 system or above, overriding distuitls behaviour which is to target
+# the version that python was built for. This may be overridden by setting
+# MACOSX_DEPLOYMENT_TARGET before calling setup.py
+if is_platform_mac():
+ if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
+ current_system = LooseVersion(platform.mac_ver()[0])
+ python_target = LooseVersion(get_config_var('MACOSX_DEPLOYMENT_TARGET'))
+ if python_target < '10.9' and current_system >= '10.9':
+ os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
+
+
def _get_freetype_config():
print("Trying freetype-config to find freetype library...")
try:
@@ -150,5 +170,5 @@ setup(
)
],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
- tests_require=['pillow'],
+ tests_require=['pillow', 'pytest'],
)
View it on GitLab: https://salsa.debian.org/debian-gis-team/aggdraw/commit/87f1279a3e1642d5e061f5b1212cf640cabb7291
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/aggdraw/commit/87f1279a3e1642d5e061f5b1212cf640cabb7291
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190707/83baa24e/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list