From: Zooko O'Whielacronx Date: Thu, 5 Feb 2009 01:06:20 +0000 (-0700) Subject: setup: add a case to execute "python .../twistd.py" if "twistd" is not found X-Git-Tag: allmydata-tahoe-1.3.0~81 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/%22doc.html/%3C?a=commitdiff_plain;h=9ba5f9347d22a4814032989e9e32da32fdd7ff8e;p=tahoe-lafs%2Ftahoe-lafs.git setup: add a case to execute "python .../twistd.py" if "twistd" is not found --- diff --git a/src/allmydata/scripts/startstop_node.py b/src/allmydata/scripts/startstop_node.py index e27749a3..d23ad39e 100644 --- a/src/allmydata/scripts/startstop_node.py +++ b/src/allmydata/scripts/startstop_node.py @@ -59,10 +59,15 @@ def do_start(basedir, opts, out=sys.stdout, err=sys.stderr): # If 'twistd' wasn't on $PATH, maybe we're running from source and # Twisted was built as one of our dependencies. If so, we're at # BASEDIR/src/allmydata/scripts/startstop_node.py, and it's at - # BASEDIR/support/bin/twistd + # BASEDIR/support/$BINDIR/twistd up = os.path.dirname TAHOEDIR = up(up(up(up(os.path.abspath(__file__))))) - bindir = os.path.join(TAHOEDIR, "support/bin") + if sys.platform == "win32": + bin_dir = "Scripts" + else: + bin_dir = "bin" + bindir = os.path.join(TAHOEDIR, "support", bin_dir) + maybe = os.path.join(bindir, "twistd") if os.path.exists(maybe): cmd = [maybe] @@ -70,6 +75,15 @@ def do_start(basedir, opts, out=sys.stdout, err=sys.stderr): os.environ["PATH"] = os.pathsep.join(oldpath + [bindir]) # sys.path and $PYTHONPATH are taken care of by the extra code in # 'setup.py trial' + else: + maybe = maybe+'.py' + if os.path.exists(maybe): + cmd = [sys.executable, maybe] + oldpath = os.environ.get("PATH", "").split(os.pathsep) + os.environ["PATH"] = os.pathsep.join(oldpath + [bindir]) + # sys.path and $PYTHONPATH are taken care of by the extra code in + # 'setup.py trial' + if not cmd: print "Can't find twistd (it comes with Twisted). Aborting." sys.exit(1)