diff --git a/.gitignore b/.gitignore index fee8b0ef..f0931d38 100644 --- a/.gitignore +++ b/.gitignore @@ -79,4 +79,6 @@ urbackup/clientlist_*.ub version_new.txt urbackup/sqlite3.exe urbackup/doc/* -!urbackup/doc/admin_guide.tex \ No newline at end of file +!urbackup/doc/admin_guide.tex +pychart/build/* +pychart/dist/* \ No newline at end of file diff --git a/main.cpp b/main.cpp index e9f32283..5031f9b4 100644 --- a/main.cpp +++ b/main.cpp @@ -242,6 +242,7 @@ int my_init_fcn_t(int argc, char *argv[]) wchar_t buf[MAX_PATH+1]; GetModuleFileNameW(NULL, buf, MAX_PATH); Server->setServerWorkingDir(ExtractFilePath(buf)); + SetCurrentDirectory(ExtractFilePath(buf).c_str()); } #endif #else diff --git a/pychart/Pychart.cpp b/pychart/Pychart.cpp index eda17e54..eda0a484 100644 --- a/pychart/Pychart.cpp +++ b/pychart/Pychart.cpp @@ -1,21 +1,21 @@ -/************************************************************************* -* UrBackup - Client/Server backup system -* Copyright (C) 2011 Martin Raiber -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -**************************************************************************/ - +/************************************************************************* +* UrBackup - Client/Server backup system +* Copyright (C) 2011 Martin Raiber +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +**************************************************************************/ + #include "Pychart.h" #include "../Interface/Server.h" #include "../stringtools.h" @@ -94,9 +94,18 @@ void Pychart::operator()(void) static int t_num=0; if(t_num==0) + { +#ifdef _WIN32 + std::string *prg_name=new std::string; + *prg_name=Server->ConvertToUTF8(Server->getServerWorkingDir()); + Py_SetPythonHome((char*)prg_name->c_str()); +#endif Py_Initialize(); + } else + { Py_NewInterpreter(); + } ++t_num; @@ -109,7 +118,7 @@ void Pychart::operator()(void) } catch(error_already_set const &) { - Server->Log("Error while inizializing Python occured. Did you install numpy and matplotlib?", LL_ERROR); + Server->Log("Error while inizializing Python occured. Did you install numpy and matplotlib?", LL_ERROR); PyErr_Print(); } diff --git a/pychart/pychart.vcxproj b/pychart/pychart.vcxproj index ed910a03..3fcdf93a 100644 --- a/pychart/pychart.vcxproj +++ b/pychart/pychart.vcxproj @@ -81,7 +81,7 @@ Level3 Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;PYCHART_EXPORTS;BOOST_PYTHON_STATIC_LIB;%(PreprocessorDefinitions) - C:\Program Files\Python27\include + C:\Program Files\Python27\include;D:\boost Windows diff --git a/pychart/setup_pychart.py b/pychart/setup_pychart.py new file mode 100644 index 00000000..d274a5de --- /dev/null +++ b/pychart/setup_pychart.py @@ -0,0 +1,23 @@ +from distutils.core import setup +import matplotlib as mpl +import py2exe +import sys + +sys.argv.append('py2exe') + +opts = { + 'py2exe': {"bundle_files" : 3, + "includes" : [ "socket", "sysconfig", "matplotlib.backends", + "matplotlib.backends.backend_qt4agg", + "pylab", "numpy", + "matplotlib.backends.backend_tkagg"], + 'excludes': ['tcl', 'tcl8.5', 'tk8.5', '_gtkagg', '_tkagg', + '_cairo', '_cocoaagg', + '_fltkagg', '_gtk', '_gtkcairo', ], + 'dll_excludes': ['libgdk-win32-2.0-0.dll', + 'libgobject-2.0-0.dll'] + } + } + +setup(console=[{"script" : "pychart.py"}],data_files=mpl.get_py2exe_datafiles(), + options=opts) diff --git a/urbackup/client.cpp b/urbackup/client.cpp index 3f92d440..a1c04eb5 100644 --- a/urbackup/client.cpp +++ b/urbackup/client.cpp @@ -44,7 +44,9 @@ const unsigned short tcpport=35621; const unsigned short udpport=35622; const unsigned int shadowcopy_timeout=24*60*60*1000; +#ifndef SERVER_ONLY #define ENABLE_VSS +#endif #define CHECK_COM_RESULT_RELEASE(x) { HRESULT r; if( (r=(x))!=S_OK ){ Server->Log( #x+(std::string)" failed: EC="+GetErrorHResErrStr(r), LL_ERROR); if(backupcom!=NULL){backupcom->AbortBackup();backupcom->Release();} return false; }} #define CHECK_COM_RESULT_RELEASE_S(x) { HRESULT r; if( (r=(x))!=S_OK ){ Server->Log( #x+(std::string)" failed: EC="+GetErrorHResErrStr(r), LL_ERROR); if(backupcom!=NULL){backupcom->AbortBackup();backupcom->Release();} return ""; }} @@ -143,9 +145,11 @@ void IndexThread::updateDirs(void) void IndexThread::operator()(void) { #ifdef _WIN32 +#ifndef SERVER_ONLY CHECK_COM_RESULT(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)); CHECK_COM_RESULT(CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_IMP_LEVEL_IDENTIFY, NULL, EOAC_NONE, NULL)); #endif +#endif #ifdef _WIN32 #ifdef THREAD_MODE_BACKGROUND_BEGIN SetThreadPriority( GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN); @@ -864,6 +868,7 @@ bool IndexThread::release_shadowcopy(SCDirs &dir) } #ifndef VSS_XP #ifndef VSS_S03 +#ifndef SERVER_ONLY if(dir.fileserv) { filesrv->shareDir(dir.dir, dir.orig_target); @@ -884,6 +889,7 @@ bool IndexThread::release_shadowcopy(SCDirs &dir) } #endif #endif +#endif #if defined(VSS_XP) || defined(VSS_S03) ok=true; #endif @@ -917,6 +923,7 @@ bool IndexThread::release_shadowcopy(SCDirs &dir) #ifndef VSS_XP #ifndef VSS_S03 +#ifndef SERVER_ONLY if(found) { IVssBackupComponents *backupcom=NULL; @@ -953,6 +960,7 @@ bool IndexThread::release_shadowcopy(SCDirs &dir) } #endif #endif +#endif #if defined(VSS_XP) || defined(VSS_S03) if(found) { @@ -1051,6 +1059,7 @@ std::string IndexThread::GetErrorHResErrStr(HRESULT res) std::string IndexThread::lookup_shadowcopy(int sid) { #ifdef _WIN32 +#ifndef SERVER_ONLY std::vector scs=cd->getShadowcopies(); for(size_t i=0;i MaxSpeed true - WIN32;NDEBUG;_WINDOWS;_USRDLL;URBACKUP_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;URBACKUP_EXPORTS;SERVER_ONLY;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -339,7 +339,7 @@ ProgramDatabase - ws2_32.lib;VssApi.Lib;%(AdditionalDependencies) + ws2_32.lib;%(AdditionalDependencies) true Console true @@ -378,7 +378,7 @@ MaxSpeed true - WIN32;NDEBUG;_WINDOWS;_USRDLL;URBACKUP_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;URBACKUP_EXPORTS;SERVER_ONLY;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -387,7 +387,7 @@ ProgramDatabase - ws2_32.lib;VssApi.Lib;%(AdditionalDependencies) + ws2_32.lib;%(AdditionalDependencies) true Console true diff --git a/zero.hash b/zero.hash new file mode 100644 index 00000000..6c87ec2e --- /dev/null +++ b/zero.hash @@ -0,0 +1 @@ +M/)zh^f 3-m]F}0ڭmA \ No newline at end of file