Make setup.py install the iotop script in sbin/ instead of bin/.
authorGuillaume Chazarain <guichaz@gmail.com>
Sun, 26 May 2013 16:29:43 +0000 (26 18:29 +0200)
committerGuillaume Chazarain <guichaz@gmail.com>
Sun, 26 May 2013 16:31:09 +0000 (26 18:31 +0200)
setup.py

index fdfbe00..cd639ca 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -1,8 +1,16 @@
 #!/usr/bin/env python
 
 from distutils.core import setup
+from distutils.command import install as distutils_install
 from iotop.version import VERSION
 
+# Dirty hack to make setup.py install the iotop script to sbin/ instead of bin/
+# while still honoring the choice of installing into local/ or not.
+if hasattr(distutils_install, 'INSTALL_SCHEMES'):
+    for d in distutils_install.INSTALL_SCHEMES.itervalues():
+        if d.get('scripts', '').endswith('/bin'):
+            d['scripts'] = d['scripts'][:-len('/bin')] + '/sbin'
+
 setup(name='iotop',
       version=VERSION,
       description='Per process I/O bandwidth monitor',