devserver: remove relative path
The dev server should be able to be run from any directory, so
relative paths need to be removed.
BUG=chromium-os:12242
TEST=gmerge from device
Change-Id: Ia6c696a7d687a9f09e3c22850fed98603d5046cb
Review URL: http://codereview.chromium.org/6532014
diff --git a/builder.py b/builder.py
index 6d627fd..e7bccae 100644
--- a/builder.py
+++ b/builder.py
@@ -7,6 +7,7 @@
"""Package builder for the dev server."""
import os
import subprocess
+import sys
import cherrypy
@@ -26,7 +27,8 @@
"""
scripts = 'scripts/'
if command[0].find(scripts) == 0:
- command[0] = command[0].replace(scripts, '../../' + scripts)
+ server_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
+ command[0] = command[0].replace(scripts, server_dir + '/../../' + scripts)
command_name = ' '.join(command)
cherrypy.log('Executing: ' + command_name, 'BUILD')