Merge lp:~zorba-coders/zorba/bug1010746 into lp:zorba/image-module

Proposed by Rodolfo Ochoa
Status: Merged
Approved by: Chris Hillery
Approved revision: 59
Merged at revision: 52
Proposed branch: lp:~zorba-coders/zorba/bug1010746
Merge into: lp:zorba/image-module
Diff against target: 117 lines (+51/-20)
3 files modified
cmake_modules/Windows/FindImageMagick.cmake (+2/-18)
src/com/zorba-xquery/www/modules/image/image_commons/image_module.cpp (+29/-0)
src/com/zorba-xquery/www/modules/image/image_commons/image_module.h (+20/-2)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug1010746
Reviewer Review Type Date Requested Status
Juan Zacarias Approve
Chris Hillery Approve
Review via email: mp+118209@code.launchpad.net

Commit message

Added code to check for ImageMagick library, with this, we don't need to ship any ImageMagick library.

Description of the change

Added code to check for ImageMagick library, with this, we don't need to ship any ImageMagick library.

To post a comment you must log in.
Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Juan Zacarias (juan457) :
review: Needs Fixing
Revision history for this message
Juan Zacarias (juan457) wrote :

The installed version of image breaks looking for image magick DLLs

Revision history for this message
Chris Hillery (ceejatec) wrote :

Beautiful change. I'll vote Approve based on a reading of the code, but I can't actually test it; hopefully Juan can verify that an appropriate pretty error is thrown on a machine without ImageMagick installer.

review: Approve
Revision history for this message
Juan Zacarias (juan457) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1010746 into lp:zorba/image-module failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug1010746-2012-09-13T21-32-37.716Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1010746 into lp:zorba/image-module failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug1010746-2012-09-14T21-48-01.898Z is finished. The
  final status was:

  2 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1010746 into lp:zorba/image-module failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug1010746-2012-09-14T22-33-43.083Z is finished. The
  final status was:

  2 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1010746 into lp:zorba/image-module failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug1010746-2012-09-14T23-37-34.118Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug1010746-2012-09-15T01-46-35.176Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake_modules/Windows/FindImageMagick.cmake'
2--- cmake_modules/Windows/FindImageMagick.cmake 2011-10-09 14:49:07 +0000
3+++ cmake_modules/Windows/FindImageMagick.cmake 2012-09-10 14:01:22 +0000
4@@ -26,23 +26,7 @@
5 )
6
7 IF (ImageMagick_FOUND)
8-
9 # find the needed DLL's
10- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_bzlib_")
11- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_jbig_")
12- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_jp2_")
13- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_jpeg_")
14- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_lcms_")
15- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_libxml_")
16- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_Magick++_")
17- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_magick_")
18- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_png_")
19- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_tiff_")
20- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_ttf_")
21- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_wand_")
22- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_xlib_")
23- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "CORE_RL_zlib_")
24-
25- FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "X11")
26-
27+ FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "msvcp100")
28+ FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "msvcr100")
29 ENDIF (ImageMagick_FOUND)
30
31=== modified file 'src/com/zorba-xquery/www/modules/image/image_commons/image_module.cpp'
32--- src/com/zorba-xquery/www/modules/image/image_commons/image_module.cpp 2011-07-09 08:55:59 +0000
33+++ src/com/zorba-xquery/www/modules/image/image_commons/image_module.cpp 2012-09-10 14:01:22 +0000
34@@ -46,4 +46,33 @@
35 }
36 delete this;
37 }
38+
39+bool
40+ImageModule::isImageMagickAvailable() {
41+ bool result = false;
42+ #ifdef WIN32
43+
44+ HKEY hKey;
45+ LONG lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\ImageMagick\\Current\\", 0, KEY_READ, &hKey);
46+ if (lRes != ERROR_SUCCESS) {
47+ lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Wow6432Node\\ImageMagick\\Current\\", 0, KEY_READ, &hKey);
48+ }
49+ if (lRes == ERROR_SUCCESS) {
50+ std::wstring strKeyDefaultValue;
51+
52+ WCHAR szBuffer[512];
53+ DWORD dwBufferSize = sizeof(szBuffer);
54+ ULONG nError = RegQueryValueExW(hKey, L"Version", NULL, NULL, (LPBYTE)szBuffer, &dwBufferSize);
55+ if (ERROR_SUCCESS == nError)
56+ {
57+ strKeyDefaultValue = szBuffer; // ImageMagick Version
58+ result = true;
59+ }
60+ RegCloseKey(hKey);
61+ }
62+ #endif //WIN32
63+ return result;
64+}
65+
66+
67 } /* namespace imagemodule */ } /* namespace zorba */
68
69=== modified file 'src/com/zorba-xquery/www/modules/image/image_commons/image_module.h'
70--- src/com/zorba-xquery/www/modules/image/image_commons/image_module.h 2011-07-09 08:55:59 +0000
71+++ src/com/zorba-xquery/www/modules/image/image_commons/image_module.h 2012-09-10 14:01:22 +0000
72@@ -17,10 +17,16 @@
73 #ifndef ZORBA_IMAGEMODULE_IMAGEMODULE_H
74 #define ZORBA_IMAGEMODULE_IMAGEMODULE_H
75
76+#ifdef WIN32
77+#include <Windows.h>
78+#undef DrawText
79+#endif //WIN32
80 #include <map>
81 #include <zorba/zorba.h>
82+#include <zorba/user_exception.h>
83+#include <zorba/diagnostic_list.h>
84 #include <zorba/external_module.h>
85-
86+#include <Magick++.h>
87
88 namespace zorba { namespace imagemodule {
89
90@@ -50,7 +56,17 @@
91 virtual String
92 getURI() const { return "http://www.zorba-xquery.com/modules/image/"; }
93
94-
95+ ImageModule()
96+ {
97+#ifdef WIN32
98+ if (ImageModule::isImageMagickAvailable()) {
99+ Magick::InitializeMagick(NULL);
100+ } else {
101+ throw USER_EXCEPTION( zerr::ZOSE0005_DLL_LOAD_FAILED, "ImageMagick is not installed" );
102+ }
103+#endif //WIN32
104+ };
105+
106 virtual ~ImageModule();
107
108 virtual ExternalFunction*
109@@ -69,6 +85,8 @@
110
111 return theFactory;
112 }
113+
114+ static bool isImageMagickAvailable();
115 };
116
117 } /* namespace imagemodule */

Subscribers

People subscribed via source and target branches

to all changes: