[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Use the imp module to import from the facilitator program.



commit dc8144fde50574faeece00fbe63798beb039ad08
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Wed Oct 16 23:47:27 2013 -0700

    Use the imp module to import from the facilitator program.
---
 facilitator/facilitator-test |   13 ++++++++++++-
 facilitator/facilitator.py   |    1 -
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/facilitator/facilitator-test b/facilitator/facilitator-test
index 040d4d4..fc4d513 100755
--- a/facilitator/facilitator-test
+++ b/facilitator/facilitator-test
@@ -4,13 +4,24 @@ from cStringIO import StringIO
 import socket
 import subprocess
 import tempfile
+import sys
 import time
 import unittest
 
-from facilitator import Endpoints, parse_relay_file
 import fac
 from fac import Transport, Endpoint
 
+# Import the facilitator program as a module.
+import imp
+dont_write_bytecode = sys.dont_write_bytecode
+sys.dont_write_bytecode = True
+facilitator = imp.load_source("facilitator", "facilitator")
+Endpoints = facilitator.Endpoints
+parse_relay_file = facilitator.parse_relay_file
+sys.dont_write_bytecode = dont_write_bytecode
+del dont_write_bytecode
+del facilitator
+
 FACILITATOR_HOST = "127.0.0.1"
 FACILITATOR_PORT = 39002 # diff port to not conflict with production service
 FACILITATOR_ADDR = (FACILITATOR_HOST, FACILITATOR_PORT)
diff --git a/facilitator/facilitator.py b/facilitator/facilitator.py
deleted file mode 120000
index 28e5e91..0000000
--- a/facilitator/facilitator.py
+++ /dev/null
@@ -1 +0,0 @@
-facilitator
\ No newline at end of file



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits