
On Fri, Jun 3, 2016 at 5:35 AM, Young Yang <afe.young@gmail.com> wrote:
my_install is a subclass of `from setuptools.command.install import install` ``` class my_install(install): def run(self): # DO something I want. Such as compiling the code of project A and copy the output of it (i.e. the .so file) to my binding folder install.run(self) ```
At last I add these options in my setup function in setup.py to include the shared library in the install package. ``` package_dir={'my_binding_package': 'my_binding_folder'}, package_data={ 'my_binding_package': ['Shared_lib.so'], }, include_package_data=True, ```
But I think there should be better ways to achieve these.
Overriding only the `install` will make bdist_wheel produce the wrong result. There's also the `develop` command. Some ideas about what commands you might need to override: https://github.com/pytest-dev/pytest-cov/blob/master/setup.py#L30-L63 An alternative approach would be to create a custom Extension class, check this https://github.com/cython/cython/tree/master/Cython/Distutils for ideas. Unfortunately the internals of distutils/setuptools aren't really well documented so you'll have to rely on examples, simply reading distutils code, coffee or even painkillers :-) Thanks, -- Ionel Cristian Mărieș, http://blog.ionelmc.ro