diff --git a/lite/api/python/setup.py.in b/lite/api/python/setup.py.in index 884266a12dc911f6e642518b169370d7aeb83cca..596369f299308dda72896e07d475772373769fe7 100644 --- a/lite/api/python/setup.py.in +++ b/lite/api/python/setup.py.in @@ -33,11 +33,17 @@ else: PADDLELITE_VERSION = PADDLELITE_TAG # core lib of paddlelite is stored as lite.so -LITE_PATH = '${PADDLE_BINARY_DIR}/inference_lite_lib/python/install/lite' +files = os.listdir('${PADDLE_BINARY_DIR}') +INFERENCE_LITE_LIB_PATH = '' +for file in files: + if file.find('inference_lite_lib') == 0: + INFERENCE_LITE_LIB_PATH = '${PADDLE_BINARY_DIR}/' + file + break +LITE_PATH = INFERENCE_LITE_LIB_PATH + '/python/install/lite' PACKAGE_DATA = {'paddlelite': ['lite.so' if os.name!='nt' else 'lite.pyd']} # put all thirdparty libraries in paddlelite.libs PACKAGE_DATA['paddlelite.libs'] = [] -LIB_PATH = '${PADDLE_BINARY_DIR}/inference_lite_lib/python/install/libs' +LIB_PATH = INFERENCE_LITE_LIB_PATH + '/python/install/libs/' if '${WITH_MKL}' == 'ON': shutil.copy('${MKLML_SHARED_IOMP_LIB}', LIB_PATH) shutil.copy('${MKLML_SHARED_LIB}', LIB_PATH) @@ -49,8 +55,7 @@ if '${WITH_MKL}' == 'ON': PACKAGE_DATA['paddlelite.libs'] += ['msvcr120.dll'] # link lite.so to paddlelite.libs if os.name != 'nt': - COMMAND = "patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}\ -/inference_lite_lib/python/install/lite/lite.so" + COMMAND = "patchelf --set-rpath '$ORIGIN/../libs/' " + LITE_PATH + "/lite.so" if os.system(COMMAND) != 0: raise Exception("patch third_party libs failed, command: %s" % COMMAND)