[Q] How to specify options for 'setup.py install' by environment variable?

Ned Deily nad at acm.org
Sun Jun 10 02:51:56 EDT 2012


In article 
<CAFTm5Rs18QJskcvMiEWyOsbifBDi6wrpuA9kKC_1t_C2t57R=A at mail.gmail.com>,
 Makoto Kuwata <kwa at kuwata-lab.com> wrote:
> On Sun, Jun 10, 2012 at 11:55 AM, Ned Deily <nad at acm.org> wrote:
> > In article
> > <CAFTm5RucOAztp89MBpW4UtiSKa8zq58q9evJeL1oFuLBc-p69g at mail.gmail.com>,
> >  Makoto Kuwata <kwa at kuwata-lab.com> wrote:
> >> "setup.py install" command supports options such as --prefix,
> >> --install-scripts, and so on.
> >> For example:
> >>
> >>   $ python setup.py install --prefix=$PWD/local --install-scripts=$PWD/bin
> >>
> >> Question: is it possible to specify these options by environment variable?
> >> I want to specify --prefix or --install-scripts options, but it is
> >> too troublesome for me to specify them in command line every time.
> > There are some environment variable options for Distutils-based (i.e.
> > with setup.py) installations.  The supported method is to put
> > frequently-used preferences into one of several configuration files.
> > See
> > http://docs.python.org/install/index.html#inst-config-fileshttp://docs.py
> > thon.org/install/index.html#inst-config-files
> 
> Thank you Ned,
> but I can't find environment variable name on that page which is
> equivarent to '--install-scripts' or other options.

Sorry, I wasn't clear.  Using the Distutils config files would be 
instead of setting environment variables.  For example, you could do 
something like this:

$ cat >$HOME/.pydistutils.cfg <<EOF
[install]
prefix = local
install-scripts = local/bin
EOF

That will apply globally whenever you run a Distutils script, unless it 
is overridden by a $PWD/setup.cfg file with an [install] section.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list