How to include post install script in python setuptools

Viewed 2699
import os
from setuptools import setup
from distutils.command.install import install as _install
def _post_install(dir):
    from subprocess import call
    call([sys.executable, 'post_script.py'],
    cwd=os.path.join(dir, 'script_folder'))


class install(_install):
    def run(self):
        _install.run(self)
        self.execute(_post_install, (self.install_lib,),
                     msg="Running post install task")


VERSION = '123'
setup(name='XXXX',
      description='hello',
      url='http://giturl.com',
      packages=['package_folder'],
      cmdclass={'install': install},
      package_data={
              'package_folder': [
              '*.py',
              'se/*pp'
          ],
      },
)

# Basically the postscript should execute once I install the rpm that is being built. Its not working. Any other method as this is not working?

1 Answers
Related