123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- """
- 用于python源码打包成so文件,python解释器运行main.py
- """
- from distutils.core import setup
- from Cython.Build import cythonize
- import os
- py_dir = [
- '/home/server/projects/taiwuict/cscec-8bur-vms/build/component-interface',
- '/home/server/projects/taiwuict/cscec-8bur-vms/build/supplement-python',
- ]
- def get_file_path_list(dir_path, path_list=None):
- if not path_list:
- path_list = []
- for path, folders, files in os.walk(dir_path):
- for file_name in files:
- if file_name[-2:] != 'py':
- continue
- if 'cythonize' in file_name:
- continue
- # if '__init__' in file_name:
- # continue
- file_path = os.path.join(path, file_name)
- if file_path in path_list:
- continue
- path_list.append(file_path)
- for folder_name in folders:
- get_file_path_list(os.path.join(path, folder_name), path_list)
- return path_list
- py_list = []
- for dir in py_dir:
- py_list += get_file_path_list(dir)
- print(py_list)
- # setup(ext_modules=cythonize(module_list=py_list,
- # compiler_directives=dict(c_string_encoding="utf-8", language_level=3)))
- # --- one by one ---
- for py_file in py_list:
- setup(
- name='fra',
- package_dir={
- 'v3': '',
- 'base_original': '',
- },
- ext_modules=cythonize(module_list=[py_file],
- compiler_directives=dict(c_string_encoding="utf-8", language_level=3)))
|