提交 087a3dd7 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Do not add default compiledir to sys.path anymore.

This solves a problem experienced by the buildbot on ceylon. cuda_ndarray and cutils_ext seem to be the only modules that need config.compiledir in sys.path to be imported (except when they are recompiled), so we modify sys.path before trying to import them.
上级 ddd8cea9
......@@ -29,8 +29,6 @@ def is_valid_compiledir(path):
# returned -1 for an unknown reason; the alternate approach here worked
# in all cases... it was weird.
open(os.path.join(path, '__init__.py'), 'w').close()
if path not in sys.path:
sys.path.append(path)
except:
return False
......
import os
import os, sys
from compilelock import get_lock, release_lock
from theano import config
......@@ -11,6 +11,10 @@ if os.path.exists(os.path.join(config.compiledir,'cutils_ext.so')):
# directory. This is important to prevent multiple processes from trying to
# compile the cutils_ext module simultaneously.
try:
# If we load a previously-compiled version, config.compiledir should
# by in sys.path
if config.compiledir not in sys.path:
sys.path.append(config.compiledir)
from cutils_ext.cutils_ext import *
except ImportError:
import cmodule
......
......@@ -75,6 +75,10 @@ if os.path.exists(cuda_ndarray_so):
compile_cuda_ndarray = date>=os.stat(cuda_ndarray_so)[stat.ST_MTIME]
if not compile_cuda_ndarray:
try:
# If we load a previously-compiled version, config.compiledir should
# by in sys.path
if config.compiledir not in sys.path:
sys.path.append(config.compiledir)
from cuda_ndarray.cuda_ndarray import *
except ImportError:
compile_cuda_ndarray = True
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论