[Python-modules-commits] [python-pgmagick] 01/07: New upstream version 0.6.5
Takaki Taniguchi
takaki at moszumanska.debian.org
Thu Jun 29 04:29:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
takaki pushed a commit to branch master
in repository python-pgmagick.
commit 339bd933b6a7f73d87fcc1c9f19ca8068d5a37a7
Author: TANIGUCHI Takaki <takaki at asis.media-as.org>
Date: Mon Jun 26 18:46:34 2017 +0900
New upstream version 0.6.5
---
LICENSE | 2 +-
PKG-INFO | 4 ++--
pgmagick.egg-info/PKG-INFO | 4 ++--
pgmagick.egg-info/SOURCES.txt | 3 ++-
pgmagick/__init__.py | 5 ++++-
pgmagick/_version.py | 2 +-
setup.py | 39 ++++++++++++++++-----------------------
src/_Blob.cpp | 21 +++++++++++++++++----
src/_Image.cpp | 7 +++++++
src/_Pixels.cpp | 7 +++++++
test/test_pgmagick_api.py | 2 +-
test/test_pgmagick_image.py | 12 ++++++++++++
test/test_pgmagick_pixel.py | 6 ++++++
13 files changed, 78 insertions(+), 36 deletions(-)
diff --git a/LICENSE b/LICENSE
index eb2326c..45ef07d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2012 Hideo Hattori
+Copyright (c) 2010-2017 Hideo Hattori
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/PKG-INFO b/PKG-INFO
index cff799c..c0ea39e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,8 +1,8 @@
Metadata-Version: 1.1
Name: pgmagick
-Version: 0.6
+Version: 0.6.5
Summary: Yet Another Python wrapper for GraphicsMagick
-Home-page: http://bitbucket.org/hhatto/pgmagick
+Home-page: https://github.com/hhatto/pgmagick
Author: Hideo Hattori
Author-email: hhatto.jp at gmail.com
License: MIT
diff --git a/pgmagick.egg-info/PKG-INFO b/pgmagick.egg-info/PKG-INFO
index cff799c..c0ea39e 100644
--- a/pgmagick.egg-info/PKG-INFO
+++ b/pgmagick.egg-info/PKG-INFO
@@ -1,8 +1,8 @@
Metadata-Version: 1.1
Name: pgmagick
-Version: 0.6
+Version: 0.6.5
Summary: Yet Another Python wrapper for GraphicsMagick
-Home-page: http://bitbucket.org/hhatto/pgmagick
+Home-page: https://github.com/hhatto/pgmagick
Author: Hideo Hattori
Author-email: hhatto.jp at gmail.com
License: MIT
diff --git a/pgmagick.egg-info/SOURCES.txt b/pgmagick.egg-info/SOURCES.txt
index 10169f3..6e43536 100644
--- a/pgmagick.egg-info/SOURCES.txt
+++ b/pgmagick.egg-info/SOURCES.txt
@@ -128,4 +128,5 @@ test/test_pgmagick_geometry.py
test/test_pgmagick_image.py
test/test_pgmagick_imagelist.py
test/test_pgmagick_libinfo.py
-test/test_pgmagick_montage.py
\ No newline at end of file
+test/test_pgmagick_montage.py
+test/test_pgmagick_pixel.py
\ No newline at end of file
diff --git a/pgmagick/__init__.py b/pgmagick/__init__.py
index 574d9b8..4ad5390 100644
--- a/pgmagick/__init__.py
+++ b/pgmagick/__init__.py
@@ -9,7 +9,7 @@ __init()
class Blob(_pgmagick.Blob):
def __init__(self, *args):
- if len(args) == 1 and isinstance(args[0], str):
+ if len(args) == 1 and isinstance(args[0], (str, bytes)):
_pgmagick.Blob.__init__(self)
self.update(args[0])
else:
@@ -407,6 +407,9 @@ class PathSmoothQuadraticCurvetoRel(_pgmagick.PathSmoothQuadraticCurvetoRel):
class Pixels(_pgmagick.Pixels):
pass
+class PixelPacket(_pgmagick.PixelPacket):
+ pass
+
if hasattr(_pgmagick, "SparseColorMethod"):
SparseColorMethod = _pgmagick.SparseColorMethod
diff --git a/pgmagick/_version.py b/pgmagick/_version.py
index 27fda16..e2f45ae 100644
--- a/pgmagick/_version.py
+++ b/pgmagick/_version.py
@@ -1 +1 @@
-__version__ = '0.6'
+__version__ = '0.6.5'
diff --git a/setup.py b/setup.py
index c7102ca..00a1bde 100644
--- a/setup.py
+++ b/setup.py
@@ -58,7 +58,7 @@ def get_version_from_pc(search_dirs, target):
for root, dirs, files in os.walk(dirname):
for f in files:
if f == target:
- _tmp = _grep("\Version: ", os.path.join(root, target))
+ _tmp = _grep("Version: ", os.path.join(root, target))
return _tmp.split()[1]
@@ -125,9 +125,9 @@ library_dirs.append(lib_path)
# get version and extra compile argument
ext_compile_args = []
if LIBRARY == 'GraphicsMagick':
- _version = get_version_from_pc(search_include_dirs + search_pkgconfig_dirs, GMCPP_PC)
+ _version = get_version_from_pc(search_pkgconfig_dirs + search_include_dirs, GMCPP_PC)
else:
- _version = get_version_from_pc(search_include_dirs + search_pkgconfig_dirs, IMCPP_PC)
+ _version = get_version_from_pc(search_pkgconfig_dirs + search_include_dirs, IMCPP_PC)
if not _version:
_version = get_version_from_devheaders(include_dirs)
if _version:
@@ -138,28 +138,21 @@ if _version:
# ex) 1.2 -> 1.2.0
_version.append(0)
if LIBRARY == 'GraphicsMagick':
+ ext_compile_args = []
+ if _version[0] == 1 and _version[1] == 3 and _version[2] >= 24:
+ ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_24")
if _version[0] == 1 and _version[1] == 3 and _version[2] >= 22:
- ext_compile_args = ["-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_20",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_22"]
- elif _version[0] == 1 and _version[1] == 3 and _version[2] >= 20:
- ext_compile_args = ["-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_20"]
- elif _version[0] == 1 and _version[1] == 3 and _version[2] == 19:
- ext_compile_args = ["-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19"]
- elif _version[0] == 1 and _version[1] == 3 and _version[2] >= 6:
+ ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_22")
+ if _version[0] == 1 and _version[1] == 3 and _version[2] >= 20:
+ ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_20")
+ if _version[0] == 1 and _version[1] == 3 and _version[2] == 19:
+ ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_19")
+ if _version[0] == 1 and _version[1] == 3 and _version[2] >= 6:
# for not Ubuntu10.04
- ext_compile_args = ["-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6",
- "-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x"]
- elif not (_version[0] == 1 and _version[1] == 1):
+ ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_6")
+ if not (_version[0] == 1 and _version[1] == 1):
# for GM version 1.3.x and higher
- ext_compile_args = ["-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x"]
+ ext_compile_args.append("-DPGMAGICK_LIB_GRAPHICSMAGICK_1_3_x")
elif LIBRARY == 'ImageMagick':
ext_compile_args = ["-DPGMAGICK_LIB_IMAGEMAGICK"]
ext_compile_args.append("-D_LIBRARY_VERSION=\"%s\"" % (_str_version))
@@ -180,7 +173,7 @@ setup(name='pgmagick',
long_description=open('README.rst').read(),
author='Hideo Hattori',
author_email='hhatto.jp at gmail.com',
- url='http://bitbucket.org/hhatto/pgmagick',
+ url='https://github.com/hhatto/pgmagick',
license='MIT',
packages=find_packages(),
ext_modules=[
diff --git a/src/_Blob.cpp b/src/_Blob.cpp
index 3cba944..c5be322 100644
--- a/src/_Blob.cpp
+++ b/src/_Blob.cpp
@@ -5,31 +5,44 @@
using namespace boost::python;
-namespace {
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Magick_Blob_updateNoCopy_overloads_2_3, updateNoCopy, 2, 3)
+static void updateNoCopy_wrapper(Magick::Blob& blob, std::string& data) {
+ // NOTE: this is valid?
+ std::string str;
+ char* w = new char[data.size() + 1];
+ std::copy(str.begin(), str.end(), w);
+ w[str.size()] = '\0';
+ blob.updateNoCopy(w,data.size(),Magick::Blob::NewAllocator);
}
static void update_wrapper(Magick::Blob& blob, const std::string& data) {
blob.update(data.c_str(),data.size());
}
+#if PY_MAJOR_VERSION >= 3
+static object get_blob_data(const Magick::Blob& blob) {
+ const char* data = static_cast<const char*>(blob.data());
+ size_t length = blob.length();
+ return object(handle<>(PyBytes_FromStringAndSize(data, length)));
+}
+#else
static std::string get_blob_data(const Magick::Blob& blob) {
const char* data = static_cast<const char*>(blob.data());
size_t length = blob.length();
return std::string(data,data+length);
}
+#endif
void __Blob()
{
scope* Magick_Blob_scope = new scope(
class_< Magick::Blob >("Blob", init< >())
- .def(init< const void*, size_t >())
+ .def("__init__", &update_wrapper) // NOTE: valid?
.def(init< const Magick::Blob& >())
.def("base64", (void (Magick::Blob::*)(const std::string) )&Magick::Blob::base64)
.def("base64", (std::string (Magick::Blob::*)() )&Magick::Blob::base64)
.def("update", &update_wrapper)
- .def("updateNoCopy", &Magick::Blob::updateNoCopy, Magick_Blob_updateNoCopy_overloads_2_3())
+ .def("updateNoCopy", &updateNoCopy_wrapper)
.def("length", &Magick::Blob::length)
);
diff --git a/src/_Image.cpp b/src/_Image.cpp
index 5270dc9..21a4e70 100644
--- a/src/_Image.cpp
+++ b/src/_Image.cpp
@@ -526,8 +526,15 @@ void __Image()
#endif
.def("x11Display", (void (Magick::Image::*)(const std::string&) )&Magick::Image::x11Display)
.def("x11Display", (std::string (Magick::Image::*)() const)&Magick::Image::x11Display)
+#if defined(PGMAGICK_LIB_GRAPHICSMAGICK_1_3_24)
+ .def("xResolution", (void (Magick::Image::*)(const double) )&Magick::Image::xResolution)
+ .def("xResolution", (double (Magick::Image::*)() const)&Magick::Image::xResolution)
+ .def("yResolution", (void (Magick::Image::*)(const double) )&Magick::Image::yResolution)
+ .def("yResolution", (double (Magick::Image::*)() const)&Magick::Image::yResolution)
+#else
.def("xResolution", &Magick::Image::xResolution)
.def("yResolution", &Magick::Image::yResolution)
+#endif
#if 0
.def("getConstPixels",)
.def("getIndexes",)
diff --git a/src/_Pixels.cpp b/src/_Pixels.cpp
index 68525c3..f5b797b 100644
--- a/src/_Pixels.cpp
+++ b/src/_Pixels.cpp
@@ -15,4 +15,11 @@ void __Pixels()
.def("columns", &Magick::Pixels::columns)
.def("rows", &Magick::Pixels::rows)
;
+
+ class_< Magick::PixelPacket, boost::noncopyable >("PixelPacket", no_init)
+ .def_readwrite("red", &Magick::PixelPacket::red)
+ .def_readwrite("green", &Magick::PixelPacket::green)
+ .def_readwrite("blue", &Magick::PixelPacket::blue)
+ .def_readwrite("opacity", &Magick::PixelPacket::opacity)
+ ;
}
diff --git a/test/test_pgmagick_api.py b/test/test_pgmagick_api.py
index 8e5ed12..ab4ca94 100644
--- a/test/test_pgmagick_api.py
+++ b/test/test_pgmagick_api.py
@@ -341,7 +341,7 @@ class DrawTestCase(unittest.TestCase):
self.im.draw(self.d)
self.im.write('t.png')
- @unittest.skipIf(libgm_version <= [1, 3, 12], "bug in gm version: %s" % str(libgm_version))
+ @unittest.skipIf(libgm_version <= [1, 3, 18], "bug in gm version: %s" % str(libgm_version))
def test_stroke_linejoin(self):
self.d.stroke_color('lime')
self.d.stroke_linejoin('round')
diff --git a/test/test_pgmagick_image.py b/test/test_pgmagick_image.py
index 5c562ad..7e06432 100644
--- a/test/test_pgmagick_image.py
+++ b/test/test_pgmagick_image.py
@@ -96,4 +96,16 @@ class TestIMImage(unittest.TestCase):
self.assertEqual(type(ret),
type(pgmagick._pgmagick.VirtualPixelMethod()))
+
+class TestImageWithBlob(unittest.TestCase):
+
+ def test_fromblob(self):
+ with open('../example/X.jpg', 'rb') as f:
+ data = f.read()
+ b = Blob(data)
+ img = Image(b)
+ img.write('X2.jpg')
+ self.assertEqual(type(img), Image)
+
+
unittest.main()
diff --git a/test/test_pgmagick_pixel.py b/test/test_pgmagick_pixel.py
new file mode 100644
index 0000000..b592cf3
--- /dev/null
+++ b/test/test_pgmagick_pixel.py
@@ -0,0 +1,6 @@
+import sys
+sys.path.append('../')
+sys.path.append('./')
+from pgmagick import Pixels
+from pgmagick import PixelPacket
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pgmagick.git
More information about the Python-modules-commits
mailing list