more python fixes.
This commit is contained in:
parent
0caac30c11
commit
d2da55463f
@ -61,14 +61,26 @@ def _findYap():
|
|||||||
:raises ImportError: If we cannot guess the name of the library
|
:raises ImportError: If we cannot guess the name of the library
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Now begins the guesswork
|
||||||
|
platform = sys.platform[:3]
|
||||||
|
|
||||||
|
# use YAPLIBDIR first
|
||||||
|
path=os.getenv('YAPLIBDIR')
|
||||||
|
if path is not None:
|
||||||
|
if platform == 'lin':
|
||||||
|
name = 'libYap.so'
|
||||||
|
elif platform == 'dar':
|
||||||
|
name = 'libYap.dylib'
|
||||||
|
path = os.path.join(path, name)
|
||||||
|
if os.path.exists(path):
|
||||||
|
return path
|
||||||
|
|
||||||
# No matter what the platform is, the first try should alway be
|
# No matter what the platform is, the first try should alway be
|
||||||
# find_library.
|
# find_library.
|
||||||
path = find_library('Yap') # or find_library('swipl') or find_library('pl')
|
path = find_library('Yap') # or find_library('swipl') or find_library('pl')
|
||||||
if path is not None:
|
if path is not None:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
# Now begins the guesswork
|
|
||||||
platform = sys.platform[:3]
|
|
||||||
if platform == 'win': # In Windows, we have the default installer path and
|
if platform == 'win': # In Windows, we have the default installer path and
|
||||||
# the registry to look
|
# the registry to look
|
||||||
|
|
||||||
@ -140,12 +152,6 @@ def _findYap():
|
|||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
# unix in general
|
|
||||||
path=os.getenv('YAPLIBDIR')
|
|
||||||
path = os.path.join(path, name)
|
|
||||||
if os.path.exists(path):
|
|
||||||
return path
|
|
||||||
|
|
||||||
# Last resource: see if executable is on the path
|
# Last resource: see if executable is on the path
|
||||||
try: # try to get library path from swipl executable.
|
try: # try to get library path from swipl executable.
|
||||||
cmd = Popen(['yap', '-dump-runtime-variables'], stdout=PIPE)
|
cmd = Popen(['yap', '-dump-runtime-variables'], stdout=PIPE)
|
||||||
@ -196,6 +202,7 @@ c_void_p = POINTER(c_void)
|
|||||||
# Load the library
|
# Load the library
|
||||||
path = _findYap()
|
path = _findYap()
|
||||||
_fixWindowsPath(path)
|
_fixWindowsPath(path)
|
||||||
|
print path
|
||||||
_lib = CDLL(path)
|
_lib = CDLL(path)
|
||||||
|
|
||||||
# PySWIP constants
|
# PySWIP constants
|
||||||
|
@ -46,7 +46,11 @@ python_command(Cmd) :-
|
|||||||
|
|
||||||
start_python :-
|
start_python :-
|
||||||
use_foreign_library(foreign(python)),
|
use_foreign_library(foreign(python)),
|
||||||
init_python.
|
init_python,
|
||||||
|
python_command('import sys'),
|
||||||
|
unix(getcwd(Dir)),
|
||||||
|
atom_concat(['sys.path.append(\"',Dir,'\")'], Command),
|
||||||
|
python_command(Command).
|
||||||
% done
|
% done
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user