[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] psiphon: use the python provided by sys.executable
commit 4b7f72746a10c1e48df93a3c62c84fcb1d6f2bb2
Author: Simone Basso <bassosimone@xxxxxxxxx>
Date: Sat Oct 10 11:06:11 2015 +0200
psiphon: use the python provided by sys.executable
There may be more than one Python (for example on MacOS I have both
the system Python and the one installed with brew).
Make sure we use the same Python with which ooni-probe was started
such that modules installed with pip are found.
Updated to avoid setting the temporary file executable and to avoid
removing my Python interpreter :).
---
ooni/nettests/third_party/psiphon.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ooni/nettests/third_party/psiphon.py b/ooni/nettests/third_party/psiphon.py
index 8ac287d..6a2e08e 100644
--- a/ooni/nettests/third_party/psiphon.py
+++ b/ooni/nettests/third_party/psiphon.py
@@ -1,6 +1,7 @@
import tempfile
import stat
import os
+import sys
from twisted.internet import defer, reactor
from twisted.internet.endpoints import TCP4ClientEndpoint
@@ -76,15 +77,14 @@ class PsiphonTest(httpt.HTTPTest, process.ProcessTest):
'psiphon-circumvention-system/pyclient')
log.debug('psiphon path: %s' % self.psiphonpath)
- x = """#!/usr/bin/env python
+ x = """
from psi_client import connect
connect(False)
"""
f = tempfile.NamedTemporaryFile(delete=False)
f.write(x)
f.close()
- os.chmod(f.name, os.stat(f.name).st_mode | stat.S_IEXEC)
- self.command = [f.name]
+ self.command = [sys.executable, f.name]
log.debug('command: %s' % ''.join(self.command))
def handleRead(self, stdout, stderr):
@@ -119,7 +119,7 @@ connect(False)
def cleanup(_):
log.debug('PsiphonTest:cleanup')
self.processDirector.transport.signalProcess('INT')
- os.remove(self.command[0])
+ os.remove(self.command[1])
return finished
self.bootstrapped.addBoth(cleanup)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits