4
我有一個setup.py看起來是這樣的:使用的distutils這裏痛飲接口文件是在src文件夾
from setuptools import setup, Extension
import glob
sources = glob.glob('src/*.cpp') + glob.glob('src/*.i')
# this is ugly, but otherwise I get the wrapper included twice
sources = [source for source in sources if '_wrap' not in source]
setup(
name = 'engine',
ext_modules = [
Extension(
'_engine',
sources = sources,
swig_opts = ['-c++'],
include_dirs = ['src']
)
],
py_modules = ['engine']
package_dir = {'' : 'src'}
)
現在我跑install
兩次這種工作方式長。第一次,swig在src目錄中創建engine.py。但它不會被複制到目標。第二次運行setup.py文件時,發現並安裝了engine.py。有沒有辦法讓這一切都第一次工作?
我有一個比你更簡單的設置,但我發現我必須這樣做。一個「解決方法」是首先運行構建,然後安裝,但所有這些都會生成swig包裝器,以便安裝可以看到它。它會在安裝階段被複制,而不是構建。 –