Ticket #505: twistd_exe.patch

File twistd_exe.patch, 1.0 KB (added by cgalvan, at 2008-09-01T22:32:42Z)

Patch to fall back on finding twisted executables in source/bin.

  • startstop_node.py

     
    5454
    5555    cmd = find_exe.find_exe('twistd')
    5656    if not cmd:
    57         print "Can't find twistd (it comes with Twisted).  Aborting."
    58         sys.exit(1)
     57        # If the 'twistd' executable can't be found, we have to do some PATH
     58        # manipluations so that the executable can be found.
     59        from pkg_resources import require
     60        twisted_dir = require("Twisted")[0].location
     61        pp = os.path.dirname(twisted_dir)
     62        if os.environ.get('PYTHONPATH', []):
     63            os.environ['PYTHONPATH'] += os.pathsep + pp
     64        else:
     65            os.environ['PYTHONPATH'] = pp
     66        support_bin = os.path.join(os.path.dirname(os.path.dirname( \
     67            os.path.dirname(os.path.dirname(os.path.abspath(__file__))))),
     68            'support', 'bin')
     69        sys.path.append(support_bin)
     70        cmd = [os.path.join(support_bin, 'twistd')]
    5971
    6072    cmd.extend(["-y", tac])
    6173    if nodetype in ("client", "introducer"):