[Distutils] Install a script to <prefix>/sbin instead of <prefix>/bin

Michael Jansen info at michael-jansen.biz
Thu Dec 5 18:37:39 CET 2013

On Tuesday, December 03, 2013 12:33:22 PM Michael Jansen wrote:
> > Changes to distutils itself are fairly pointless, since the earliest
> > possible date for publication of any such changes is now as part of
> > Python 3.5 in 2015. The sheer impracticality of that approach when
> > plenty of people are still running Python 2.6 is why we're going
> > through the somewhat painful exercise of decoupling the preferred
> > build system from the standard library :)
> > 
> > So, at this point, the appropriate place to make such a change is in
> > setuptools: https://bitbucket.org/pypa/setuptools
> > 
> > That will allow it to be made in a way that supports Python 2.6+,
> > whereas a distutils change won't really help anyone.
> A point well made :) . Will do that.

I made a proof of concept implementation (not ready to be merged) here


I did fight a bit with mercurial (we had severe philosophical disagreements) so i hope it works.

There is a new test that checks that everything works for the distutils syntax. and then one that 
tests the improvements. I implemented the flexible idea.

                scripts = [
                    ['sbin', ['sbin/sbin_script']],
                    ['bin', ['bin/bin_script2']],
                    ['srv/www/myprefix', ['bin/mymod.wsgi']]

The test is run with

$ python setup.py test --test-module setuptools.tests.test_install_scripts; 

and currently prints out the directory it used for testing and does not remove it so its possible to 
inspect the result.

test_distutils_compatibility (...) ... ###### /tmp/tmpPMKJNk

I btw. noticed that numpy overloads build_scripts itself to handle functions instead of strings. Not 
sure if my patch will break that.


Where to put the scripts in step build_scripts? For now it does this for maximum backwards 


I had to use the install_data directory to install the scripts into with copy_tree in install_scripts 
because my preferred solution install_base is not rerooted by distutils (when --root is given to 

There is currently no build-setuptools-scripts parameter for python setup.py build. We would have 
to add that. Same for build_scripts. it would be build-setuptools-dir there.

Documentation is missing too. As i said only a proof of concept for now.


> Mike

Michael Jansen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20131205/441c5312/attachment-0001.html>

More information about the Distutils-SIG mailing list