views:

75

answers:

1

As part of my project's setup process, I need to symlink one of the packages to a specified directory so an init.d script can find it. Is there any way to add this as a post-processing command to setup()? I would even settle for creating another file that creates the link and pass it to setup() as part of some kwarg list of "run these" (if such an option exists).

setup(
    ...
    packages = find_packages('src'),
    package_dir = {'': 'src'},
    install_requires = ...,
    data_files = [('/etc/init.d', ['scripts/foo'])],
    ...
)

that foo script expects one of the packages from src/ to be symlinked to directory elsewhere (e.g. not simply be on PYTHONPATH). Is there a way to achieve that?

A: 

Currently, only platform-specific package management tools (e.g. RPM, deb, win32 installers) have the ability to run post-install steps: the distutils, setuptools, etc. do not support this directly. (Except to the extent of allowing you to build the RPM, windows installer, etc.)

So, the simplest way to do this without a platform-specific installer, is to create a postinstall script of your own, or add a postinstall option to an existing script of yours, and tell users to run it. Otherwise, you'll have to use bdist_rpm or one of the other bdist commands to build an installer for the appropriate platform(s).

pjeby