I am trying to make my setup.py
install a directory to /usr/share
(or in a different prefix, or at least let my script copy it from the EGG file).
The directory structure of my project looks something like this:
- setup.py
- MANIFEST.in
- myproj
- __init__.py
- sompekg
- __init__.py
- data
- dirA
- dirB
- somefile
- somefile
I tried adding 'data' to MANIFEST.in:
recursive-include data *
recursive-include themer *
or in setup.py
:
include_package_data=True,
but because it is a nested directory structure and there are no python files there it will not include them. At the moment the "data" directory is included into the EGG, but none of the children directories are.
Alright, I ended up writing my own install
replacement that invokes the regular setuptools.commands.install
and afterwards does my file copying. Here are the relevant pieces of my setup.py
:
from setuptools.command.install import install
class new_install(install):
def run(self):
install.run(self) # invoke original install
self.mkpath('/usr/share/themer')
self.copy_tree('data/default', '/usr/share/themer/default')
self.mkpath('/usr/share/fish/completions')
self.copy_file('data/fish/themer.fish', '/usr/share/fish/completions/')
setup(
#... whatever else you got here
cmdclass=dict(install=new_install)
)