1

I am interested in building a Windows distribution for my application.

The application requires that a number of environmental variables and/or registry entries be set for the software to function properly. Supposing I write a script 'set_vars.py' to create and set these entries, is there a way to call this script when the application is installed via

python setup.py install

From the documentation detailing 'setup.py', I did not see an obvious way to call pre-install or post-install scripts.

I would rather not have set_vars.py called from an init.py in the distribution because the variables only really need to be set up once at install time.

sblom
  • 26,911
  • 4
  • 71
  • 95
cytochrome
  • 549
  • 1
  • 4
  • 16
  • This doesn't make your prospects sound good: http://stackoverflow.com/a/1621540/63225 – sblom Jul 22 '12 at 21:03
  • 1
    Does the accepted answer to [How can I add post-install scripts to easy_install / setuptools / distutils?](http://stackoverflow.com/a/253103/355230) help? – martineau Jul 22 '12 at 22:00
  • 1
    Despite searching for some time, I completely missed those two previous questions/answers. The comment "You can add your subcommand to install.sub_commands, and pass the command into setup()." from the latter question may do the trick. Thank you very much. – cytochrome Jul 23 '12 at 08:30

1 Answers1

0

Assuming you already have the needed action scripted, you could just --install-script=set_vars.py to your call to setup.py, or, even better (for convenience), add the option to your setup.cfg file.

BrokenPhysics
  • 63
  • 1
  • 8