Skip to content

Commit

Permalink
Merge pull request #100 from pytroll/doc-tostring-dep
Browse files Browse the repository at this point in the history
Fix documentation referring to deprecated tostring method
  • Loading branch information
djhoese authored Sep 11, 2024
2 parents d2d8d7c + 8eba0c1 commit b8c836b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
python-version: ${{ matrix.python-version }}
environment-file: ci/environment.yaml
activate-environment: test-environment
mamba-version: "*"
channels: conda-forge

- name: Run tests
shell: bash -l {0}
Expand All @@ -38,8 +38,6 @@ jobs:
include:
- os: windows-2019
cibw_archs: "AMD64 ARM64"
- os: macos-11
cibw_archs: "x86_64"
- os: macos-14 # The macos-14 runner is arm64, while up until macos-13 the runners are x86_64.
cibw_archs: "arm64"
- os: "ubuntu-20.04"
Expand All @@ -64,7 +62,7 @@ jobs:
pipx ensurepath
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_TEST_COMMAND: python {project}/selftest.py
CIBW_BEFORE_BUILD_LINUX: yum install -y freetype-devel
Expand All @@ -74,6 +72,9 @@ jobs:
CIBW_ARCHS: "${{ matrix.cibw_archs }}"
# disable finding unintended freetype installations
CIBW_ENVIRONMENT_WINDOWS: "AGGDRAW_FREETYPE_ROOT=''"
# we use libpng/libfreetype from homebrew which has a current limit of
# macos 14
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=14
- name: upload
uses: actions/upload-artifact@v3
with:
Expand Down
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,14 @@ ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Additional Patches
------------------

The AGG C++ vendored source code in this repository is no longer compatible
with some modern compilers and coding styles. The aggdraw project has had to
apply additional patches over time to fix compatibility or to retain backwards
compatibility with previous versions of AGG to get the same end result. Some
patches may be documented in README files, but all future patches should appear
in the `patches/` directory in the root of this repository and were applied with
commands such as `patch -p0 patches/tags_pointer_type_fix.patch`.
2 changes: 1 addition & 1 deletion agg2/font_freetype/agg_font_freetype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace agg
v_control = v_start;

point = outline.points + first;
tags = outline.tags + first;
tags = (char *)outline.tags + first;
tag = FT_CURVE_TAG(tags[0]);

// A contour cannot start with a cubic control point!
Expand Down
4 changes: 2 additions & 2 deletions aggdraw.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ const char *draw_frombytes_doc = "Copies data from a string buffer to the drawin
"Parameters\n"
"----------\n"
"data : bytes\n"
" A string containing packed image data, compatible with PIL’s tostring method.\n";
" A string containing packed image data, compatible with PIL’s tobytes method.\n";

static PyObject*
draw_frombytes(DrawObject* self, PyObject* args)
Expand Down Expand Up @@ -2587,7 +2587,7 @@ const char *mod_doc = "Python interface to the Anti-Grain Graphics Drawing libra
" >>> p = aggdraw.Pen(\"black\", 0.5)\n"
" >>> d.line((0, 0, 500, 500), p)\n"
" >>> d.line((0, 500, 500, 0), p)\n"
" >>> s = d.tostring()\n";
" >>> s = d.tobytes()\n";

#ifdef IS_PY3K
static struct PyModuleDef moduledef = {
Expand Down
11 changes: 11 additions & 0 deletions patches/tags_pointer_type_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- agg2/font_freetype/agg_font_freetype.cpp.orig 2024-03-06 10:16:58
+++ agg2/font_freetype/agg_font_freetype.cpp 2024-09-10 21:13:37
@@ -171,7 +171,7 @@
v_control = v_start;

point = outline.points + first;
- tags = outline.tags + first;
+ tags = (char *)outline.tags + first;
tag = FT_CURVE_TAG(tags[0]);

// A contour cannot start with a cubic control point!
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ def _get_freetype_with_pkgconfig():
Extension("aggdraw", ["aggdraw.cxx"] + sources,
define_macros=defines,
include_dirs=include_dirs,
library_dirs=library_dirs, libraries=libraries
library_dirs=library_dirs, libraries=libraries,
)
],
python_requires='>=3.9',
tests_require=['pillow', 'pytest'],
)

0 comments on commit b8c836b

Please sign in to comment.