python distutils not include the SWIG generated module

后端 未结 3 1970
余生分开走
余生分开走 2021-02-18 17:52

I am using distutils to create an rpm from my project. I have this directory tree:

project/
        my_module/
                 data/file.dat
                 my         


        
3条回答
  •  长发绾君心
    2021-02-18 18:47

    It looks like you have to add a py_modules option, e.g.:

    setup(...,
      ext_modules=[Extension('_foo', ['foo.i'],
                             swig_opts=['-modern', '-I../include'])],
      py_modules=['foo'],
    )
    

    Using rpm to Install System Scripts in Linux, you'll have to modify your spec file. The %files section tells rpm where to put the files, which you can move or link to in %post, but such can be defined in setup.py using:

    options = {'bdist_rpm':{'post_install':'post_install', 'post_uninstall':'post_uninstall'}},
    

    Running Python scripts in Bash can be done with the usual first line as #!/usr/bin/python and executable bit on the file using chmod +x filename.

提交回复
热议问题