def smac_classpath():
"""
Small function gathering all information to build the java class path.
:returns: string representing the Java classpath for SMAC
"""
import multiprocessing
from pkg_resources import resource_filename
logger = multiprocessing.get_logger()
smac_folder = resource_filename("ac_pysmac", 'smac/%s' % ac_pysmac.remote_smac.SMAC_VERSION)
smac_conf_folder = os.path.join(smac_folder, "conf")
smac_patches_folder = os.path.join(smac_folder, "patches")
smac_lib_folder = os.path.join(smac_folder, "lib")
classpath = [fname for fname in os.listdir(smac_lib_folder) if fname.endswith(".jar")]
classpath = [os.path.join(smac_lib_folder, fname) for fname in classpath]
classpath = [os.path.abspath(fname) for fname in classpath]
classpath.append(os.path.abspath(smac_conf_folder))
classpath.append(os.path.abspath(smac_patches_folder))
# For Windows compability
classpath = (os.pathsep).join(classpath)
logger.debug("SMAC classpath: %s", classpath)
return classpath
评论列表
文章目录