]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fix tahoe script installation logic
authorrobk-tahoe <robk-tahoe@allmydata.com>
Thu, 24 Jan 2008 01:05:56 +0000 (18:05 -0700)
committerrobk-tahoe <robk-tahoe@allmydata.com>
Thu, 24 Jan 2008 01:05:56 +0000 (18:05 -0700)
refine the logic in the .app which tries to install the 'tahoe' script.

now it will do nothing if 'tahoe' is found anywhere on the user's path,
and only if it's not present will it try to install it in each of the
candidate paths (/usr/local/bin ~/bin ~/Library/bin) which are on the
user's path

mac/allmydata_tahoe.py

index 5cdad83267c89a9d605c8f6046d28617d1b3f349..3e29238ac1fcc7b9c4d2648b5b38923ebbf2f3e9 100644 (file)
@@ -87,15 +87,17 @@ def run_default_node():
         if not sys.executable.endswith('/python'):
             print 'not installing tahoe script: unexpected sys.exe "%s"' % (sys.executable,)
             return
+        for path_candidate in map(os.path.expanduser, env_path):
+            tahoe_path = path_candidate + '/tahoe'
+            if os.path.exists(tahoe_path):
+                print 'not installing "tahoe": it already exists at "%s"' % (tahoe_path,)
+                return
         for path_candidate in map(os.path.expanduser, path_candidates):
             if path_candidate not in env_path:
                 print path_candidate, 'not in', env_path
                 continue
             tahoe_path = path_candidate + '/tahoe'
             try:
-                if os.path.exists(tahoe_path):
-                    print 'not installing "%s": it already exists' % (tahoe_path,)
-                    return
                 print 'trying to install "%s"' % (tahoe_path,)
                 bin_path = (sys.executable[:-6] + 'Allmydata Tahoe').replace(' ', '\\ ')
                 script = TAHOE_SCRIPT % { 'exe': bin_path }