[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Move nyx bin script creation to a install_bin_script() helper



commit 565b9c42af0d80a1b678b7b10e856e0a68558564
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Jun 9 08:27:23 2015 -0700

    Move nyx bin script creation to a install_bin_script() helper
    
    Lets keep our run() method trivial. The script installation is becoming
    complicated enough to warrant a helper anyway.
---
 setup.py |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/setup.py b/setup.py
index e0cd84f..b07995f 100644
--- a/setup.py
+++ b/setup.py
@@ -45,16 +45,7 @@ class NyxInstaller(install):
   def run(self):
     install.run(self)
 
-    # Install our bin script. We do this ourselves rather than with the setup()
-    # method's scripts argument because we want to call the script 'nyx' rather
-    # than 'run_nyx'.
-
-    bin_dest = os.path.join(self.install_scripts, 'nyx')
-    self.mkpath(self.install_scripts)
-    shutil.copyfile('run_nyx', bin_dest)
-    mode = ((os.stat(bin_dest)[stat.ST_MODE]) | 0o555) & 0o7777
-    os.chmod(bin_dest, mode)
-    log.info("installed bin script to '%s'" % bin_dest)
+    self.install_bin_script('run_nyx', os.path.join(self.install_scripts, 'nyx'))
 
     if self.man_page:
       self.install_man_page(os.path.join('nyx', 'resources', 'nyx.1'), self.man_page)
@@ -62,6 +53,17 @@ class NyxInstaller(install):
     if self.sample_path:
       self.install_sample('nyxrc.sample', self.sample_path)
 
+  def install_bin_script(self, source, dest):
+    # Install our bin script. We do this ourselves rather than with the setup()
+    # method's scripts argument because we want to call the script 'nyx' rather
+    # than 'run_nyx'.
+
+    self.mkpath(os.path.dirname(dest))
+    shutil.copyfile(source, dest)
+    mode = ((os.stat(dest)[stat.ST_MODE]) | 0o555) & 0o7777
+    os.chmod(dest, mode)
+    log.info("installed bin script to '%s'" % dest)
+
   def install_man_page(self, source, dest):
     if not os.path.exists(source):
       raise OSError(None, "man page doesn't exist at '%s'" % source)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits