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.

3
  • This doesn't make your prospects sound good: stackoverflow.com/a/1621540/63225 Commented Jul 22, 2012 at 21:03
  • 1
    Does the accepted answer to How can I add post-install scripts to easy_install / setuptools / distutils? help? Commented Jul 22, 2012 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. Commented Jul 23, 2012 at 8:30

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.