setup.py,Makefile: move the 'chmod +x bin/tahoe' into setup.py
authorBrian Warner <warner@lothar.com>
Wed, 17 Sep 2008 23:07:56 +0000 (16:07 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 17 Sep 2008 23:07:56 +0000 (16:07 -0700)
Makefile
setup.py

index 18a5f5ee4067321d6d5ce4c80c990a70f4168da4..09a98ad8c463d3ce83bbb405e07402870e33eece 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,6 @@ build: src/allmydata/_version.py
 # setuptools.
 build-once:
        $(PYTHON) setup.py build_tahoe
-       chmod +x bin/tahoe
        touch .built
 
 # 'make install' will do the following:
index 2aff99fc71a967215dffa249b091e985275750f3..825760a6b36048bf01c207e5d86fcf492edcefbe 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@
 #
 # See the docs/about.html file for licensing information.
 
-import os, re, sys, subprocess
+import os, re, sys, stat, subprocess
 
 ##### sys.path management
 
@@ -284,6 +284,14 @@ class BuildTahoe(Command):
     def finalize_options(self):
         pass
     def run(self):
+        # chmod +x bin/tahoe
+        bin_tahoe = os.path.join("bin", "tahoe")
+        old_mode = stat.S_IMODE(os.stat(bin_tahoe)[stat.ST_MODE])
+        new_mode = old_mode | (stat.S_IXUSR | stat.S_IRUSR |
+                               stat.S_IXGRP | stat.S_IRGRP |
+                               stat.S_IXOTH | stat.S_IROTH )
+        os.chmod(bin_tahoe, new_mode)
+
         # 'setup.py develop --prefix SUPPORT' will complain if SUPPORTLIB is
         # not on PYTHONPATH, because it thinks you are installing to a place
         # that will not be searched at runtime (which is true, except that we