Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/run.py
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-12-03 19:21:27 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-12-03 19:21:27 (GMT)
commit6f323c4988558ed05f1425a736d4145bb154ad69 (patch)
tree47d7eb9409e8963d68f5a0c54a0d2db52af78a05 /devbot/run.py
parent9d0dad7b15f9052e712794bc3193b4dff05214ea (diff)
Read env from a file
Diffstat (limited to 'devbot/run.py')
-rw-r--r--devbot/run.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/devbot/run.py b/devbot/run.py
index a0fc444..8733c10 100644
--- a/devbot/run.py
+++ b/devbot/run.py
@@ -6,6 +6,7 @@ import random
import shutil
import subprocess
import time
+import tempfile
from devbot import environ
from devbot import config
@@ -28,17 +29,28 @@ def run(command):
def run_test(command, test_path, virtual=False):
environ.setup()
- args = [command]
+ temp_dir = tempfile.mkdtemp("sugar-build-test")
+ env_path = os.path.join(temp_dir, "environment")
+
+ args = [command, "--env-path", env_path]
if virtual:
args.append("--virtual")
command_process = subprocess.Popen(args, stdout=subprocess.PIPE)
- for i in range(0, 2):
- line = command_process.stdout.readline()
- name, value = line.split("=", 1)
- os.environ[name.strip()] = value.strip()
- time.sleep(5)
+ while True:
+ if not os.path.exists(env_path):
+ time.sleep(1)
+ else:
+ break
+
+ with open(env_path) as f:
+ for line in f.readlines():
+ name, value = line.split("=", 1)
+ os.environ[name.strip()] = value.strip()
+
+ os.unlink(env_path)
+ os.rmdir(temp_dir)
try:
subprocess.check_call(["python", test_path])