mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Python executable name
This commit is contained in:
parent
a5c193f0ee
commit
8ea9456550
3 changed files with 19 additions and 8 deletions
|
|
@ -37,7 +37,7 @@ var
|
|||
implementation
|
||||
|
||||
uses
|
||||
uDCUtils, uGlobs, uGlobsPaths, uOSUtils, uTrash;
|
||||
uDCUtils, uGlobs, uGlobsPaths, uOSUtils, uTrash, uPython;
|
||||
|
||||
var
|
||||
PythonScript: UTF8String = 'scripts/doublecmd-kde.py';
|
||||
|
|
@ -50,7 +50,7 @@ begin
|
|||
Args := ' openwith';
|
||||
for I := 0 to FileList.Count - 1 do
|
||||
Args+= ' ' + QuoteStr(FileList[I]);
|
||||
Result:= ExecCmdFork('python ' + PythonScript + Args);
|
||||
Result:= ExecCmdFork(PythonExe + ' ' + PythonScript + Args);
|
||||
end;
|
||||
|
||||
function FileTrash(const FileName: UTF8String): Boolean;
|
||||
|
|
@ -65,7 +65,7 @@ begin
|
|||
begin
|
||||
PythonScript:= gpExePath + PythonScript;
|
||||
if ExecutableInSystemPath('kioclient') then FileTrashUtf8:= @FileTrash;
|
||||
UseKde:= (fpSystemStatus('python ' + PythonScript + ' > /dev/null 2>&1') = 0);
|
||||
UseKde:= (fpSystemStatus(PythonExe + ' ' + PythonScript + ' > /dev/null 2>&1') = 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
-------------------------------------------------------------------------
|
||||
Simple interface to the Python language
|
||||
|
||||
Copyright (C) 2014 Alexander Koblov (alexx2000@mail.ru)
|
||||
Copyright (C) 2014-2015 Alexander Koblov (alexx2000@mail.ru)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
}
|
||||
|
||||
unit uPython;
|
||||
|
|
@ -87,12 +87,13 @@ function PythonRunFunction(Module: PPyObject; const FunctionName, FunctionArg:
|
|||
function PythonRunFunction(Module: PPyObject; const FunctionName: UTF8String; FileList: TStrings): PPyObject; overload;
|
||||
|
||||
var
|
||||
PythonExe: String;
|
||||
HasPython: Boolean = False;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
dynlibs, dl;
|
||||
dynlibs, dl, uMyUnix;
|
||||
|
||||
procedure Py_DECREF(op: PPyObject);
|
||||
begin
|
||||
|
|
@ -194,11 +195,21 @@ begin
|
|||
Result:= PythonCallFunction(Module, FunctionName, pyArgs);
|
||||
end;
|
||||
|
||||
function FindPythonExecutable: String;
|
||||
begin
|
||||
if ExecutableInSystemPath('python2') then
|
||||
Result:= 'python2'
|
||||
else begin
|
||||
Result:= 'python';
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
libpython: TLibHandle;
|
||||
|
||||
procedure Initialize;
|
||||
begin
|
||||
PythonExe:= FindPythonExecutable;
|
||||
libpython:= TLibHandle(dlopen('libpython2.7.so.1.0', RTLD_NOW or RTLD_GLOBAL));
|
||||
HasPython:= libpython <> NilHandle;
|
||||
if HasPython then
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ var
|
|||
implementation
|
||||
|
||||
uses
|
||||
dbus, unixtype, fpjson, jsonparser, unix,
|
||||
dbus, fpjson, jsonparser, unix,
|
||||
uGlobs, uGlobsPaths, uMyUnix, uPython;
|
||||
|
||||
const
|
||||
|
|
@ -112,7 +112,7 @@ begin
|
|||
Print('Service found running.')
|
||||
else
|
||||
begin
|
||||
Result:= fpSystemStatus('python ' + PythonScript) = 0;
|
||||
Result:= fpSystemStatus(PythonExe + ' ' + PythonScript) = 0;
|
||||
if Result then
|
||||
Print('Service successfully started.');
|
||||
end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue