| 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')] |