From 090b1fc85df4cd5db8ed19395554af773e7c3164 Mon Sep 17 00:00:00 2001 From: Dmitry Litvinenko Date: Tue, 17 Feb 2015 17:14:47 +0300 Subject: [PATCH 1/3] Fixed build errors on MacOS setup.py now detects proper include dir for ImageMagick. Using subprocess instead of deprecated os.popen. Fixed c++ build errors according to this issue https://github.com/ricardocabral/iskdaemon/issues/66 Tested on 10.9.5 with Homebrew ImageMagick, swig and pkg-config. --- .gitignore | 1 + src/core/imgdbapi.py | 2 +- src/imgSeekLib/imgdb.cpp | 4 ++-- src/setup.py | 34 ++++++++++++++++++++-------------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 5b31450..3d6084a 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ classes deploy Iskdaemon_admin gwt-unitCache +.idea \ No newline at end of file diff --git a/src/core/imgdbapi.py b/src/core/imgdbapi.py index f1af144..bf303d0 100644 --- a/src/core/imgdbapi.py +++ b/src/core/imgdbapi.py @@ -42,7 +42,7 @@ pbFactory = None # perspective factory daemonStartTime = time.time() hasShutdown = False -iskVersion = "0.9.3" +iskVersion = "0.9.5" # misc daemon inits rootLog = logging.getLogger('imgdbapi') diff --git a/src/imgSeekLib/imgdb.cpp b/src/imgSeekLib/imgdb.cpp index 96c7021..dba2fd1 100755 --- a/src/imgSeekLib/imgdb.cpp +++ b/src/imgSeekLib/imgdb.cpp @@ -990,7 +990,7 @@ std::vector queryImgID(const int dbId, long int id, int numres, int sket long int sz = dbSpace[dbId]->sigs.size(); int_hashset includedIds; sigIterator it = dbSpace[dbId]->sigs.begin(); - for (int var = 0; var < min(sz, numres); ) { // var goes from 0 to numres + for (int var = 0; var < min(sz, numres); ) { // var goes from 0 to numres long int rint = rand()%(sz); for(int pqp =0; pqp < rint; pqp++) { it ++; @@ -1313,7 +1313,7 @@ std::vector queryImgIDKeywords(const int dbId, long int id, int numres, vector Vres; - for (int var = 0; var < min(V.size()/2, numres); ) { // var goes from 0 to numres + for (int var = 0; var < min(V.size()/2, numres); ) { // var goes from 0 to numres int rint = rand()%(V.size()/2); if (V[rint*2] > 0) { // havent added this random result yet Vres.insert(Vres.end(), V[rint*2] ); diff --git a/src/setup.py b/src/setup.py index 1e187d2..469b842 100755 --- a/src/setup.py +++ b/src/setup.py @@ -4,6 +4,7 @@ # win/linux diffs import os +import subprocess # reuse README as package long description with open('README.txt') as file: @@ -46,28 +47,33 @@ # extra_compile_args += ["-DNeedFunctionPrototypes"] # extra_compile_args += ["-D_DLL"] extra_compile_args += ["-D_MAGICKMOD_"] -else: # *nix +else: # *nix hasIMagick=0 extra_compile_args += [ "-DLinuxBuild","-g"] extra_link_args += ["-g"] print "#################################### Check ImageMagick" try: - fnd=0 - pathvar=os.environ["PATH"] - for pv in split(pathvar,':'): - if os.path.exists(pv+'/Magick++-config') or os.path.exists(pv+'Magick++-config'): - fnd=1 + fnd = False + pathvar = os.environ["PATH"] + for pv in split(pathvar, ':'): + if os.path.exists(pv + '/Magick++-config') or os.path.exists(pv + 'Magick++-config'): + fnd = True + break # pv now holds directory in which Magick++-config was found if fnd: - IMagCFlag=os.popen("Magick++-config --cxxflags --cppflags").read() - if find(IMagCFlag,"-I") != -1: - IMagCFlag=replace(IMagCFlag,"\n"," ") - IMagCFlag=split(IMagCFlag,' ') - IMagCLib=os.popen("Magick++-config --ldflags --libs").read() - IMagCLib=replace(IMagCLib,"\n"," ") - IMagCLib=split(IMagCLib,' ') - hasIMagick=1 + #IMagCFlag = os.popen("Magick++-config --cxxflags --cppflags").read() # That's deprecated now + IMagCFlag = subprocess.check_output(["Magick++-config", "--cxxflags", "--cppflags"]) + if find(IMagCFlag, "-I") != -1: + if len(include_dirs) == 0: # Extract include dir from latter command output and append to include_dirs + include_dirs.append([i[2:] for i in IMagCFlag.split(' ') if i.startswith("-I")][0]) + IMagCFlag = replace(IMagCFlag, "\n", " ") + IMagCFlag = split(IMagCFlag, ' ') + IMagCLib = subprocess.check_output(["Magick++-config", "--ldflags", "--libs"]) + IMagCLib = replace(IMagCLib, "\n", " ") + IMagCLib = split(IMagCLib, ' ') + hasIMagick = 1 else: print "--- WARNING ---\nUnable to find Magick++-config. Are you sure you have ImageMagick and it's development files installed correctly?" + except: traceback.print_exc() From c2d3d80db52e823c386a3d45cc52b11606590018 Mon Sep 17 00:00:00 2001 From: Dmitry Litvinenko Date: Tue, 17 Feb 2015 17:51:40 +0300 Subject: [PATCH 2/3] Added installation quick starts to README --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b22e8c6..6de2dc4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,31 @@ Key features: # Install instructions -Installation, usage instructions and more details are available online at http://www.imgseek.net/isk-daemon/documents-1/install-and-usage +Installation, usage instructions and more details are available online at http://www.imgseek.net/isk-daemon/documents-1/install-and-usage [dead link] + +Here are quick guide to build from cloned repo. You may want to ``sudo`` all this commands if you have permission errors. + +##Ubuntu Quick Start + +This one is tested with Ubuntu 14.12 + +1. Install prerequisited if they're not on your system already: + + ``apt-get install swig ImageMagick libmagick++-dev python-dev`` + +2. cd to ./src and run: ``python setup.py install`` + +##MacOS Quick Start + +1. Go to http://brew.sh and install Homebrew + +2. Install swig: ``brew install swig`` + +3. Install ImageMagick: ``brew install ImageMagick`` + +4. Install pkg-config: ``brew install pkg-config`` + +5. Cd to ./iskdaemon/src/ and run ``python setup.py install`` # Credits From cfa22c4bddb4bbd6c8e12d0ac851dd935ee292d0 Mon Sep 17 00:00:00 2001 From: Dmitry Litvinenko Date: Tue, 17 Feb 2015 18:18:52 +0300 Subject: [PATCH 3/3] Updated version to 0.9.5 in number of places --- README.md | 5 ++++- src/installer.nsi | 2 +- src/test/test_api.py | 1 + .../src/net/imgseek/server/admin/client/Iskdaemon_admin.java | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6de2dc4..4ed9ca5 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Key features: Installation, usage instructions and more details are available online at http://www.imgseek.net/isk-daemon/documents-1/install-and-usage [dead link] Here are quick guide to build from cloned repo. You may want to ``sudo`` all this commands if you have permission errors. +I assume you know how to build from source and have all build tools and libraries installed for your system. ##Ubuntu Quick Start @@ -35,7 +36,7 @@ This one is tested with Ubuntu 14.12 ##MacOS Quick Start -1. Go to http://brew.sh and install Homebrew +1. Go to http://brew.sh and install ``Homebrew`` 2. Install swig: ``brew install swig`` @@ -45,6 +46,8 @@ This one is tested with Ubuntu 14.12 5. Cd to ./iskdaemon/src/ and run ``python setup.py install`` +Alternatively, you can try it with ``macports``. + # Credits imgSeek and isk-daemon portions copyright Ricardo Niederberger Cabral (ricardo.cabral at imgseek.net). diff --git a/src/installer.nsi b/src/installer.nsi index 4e2bb83..2c1409e 100644 --- a/src/installer.nsi +++ b/src/installer.nsi @@ -2,7 +2,7 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "isk-daemon" -!define PRODUCT_VERSION "0.9.3" +!define PRODUCT_VERSION "0.9.5" !define PRODUCT_PUBLISHER "imgSeek" !define PRODUCT_WEB_SITE "http://server.imgseek.net/" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\isk-daemon.exe" diff --git a/src/test/test_api.py b/src/test/test_api.py index c212e52..37767da 100644 --- a/src/test/test_api.py +++ b/src/test/test_api.py @@ -23,6 +23,7 @@ ############################################################################### import xmlrpclib +import os from optparse import OptionParser parser = OptionParser() diff --git a/src/ui/admin-gwt/src/net/imgseek/server/admin/client/Iskdaemon_admin.java b/src/ui/admin-gwt/src/net/imgseek/server/admin/client/Iskdaemon_admin.java index 7d51b34..4e7b8bd 100644 --- a/src/ui/admin-gwt/src/net/imgseek/server/admin/client/Iskdaemon_admin.java +++ b/src/ui/admin-gwt/src/net/imgseek/server/admin/client/Iskdaemon_admin.java @@ -33,8 +33,8 @@ public class Iskdaemon_admin implements EntryPoint, ValueChangeHandler { private static final String SERVER_ERROR = "An error occurred while " + "attempting to contact the server. Please check your network " + "connection and try again."; - public static final String VERSION = "0.9.3"; - public static final String RELEASEDATE = "Jan 2012"; + public static final String VERSION = "0.9.5"; + public static final String RELEASEDATE = "Mar 2014"; protected static String WEB_ENDPOINT = "/"; public static final String XMLRPC_BACKEND = WEB_ENDPOINT + "RPC"; protected static SinkList list = new SinkList();