summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/idl_schema.py
diff options
context:
space:
mode:
authorcduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 17:38:57 +0000
committercduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 17:38:57 +0000
commit1686480f454eb6855810b69c0f9484233ba15313 (patch)
tree56275db3edf462bef74007f3c28bc28df34b88d4 /tools/json_schema_compiler/idl_schema.py
parentd23a00cc195e92c4799afedbc0da5877f37cfe6c (diff)
downloadchromium_src-1686480f454eb6855810b69c0f9484233ba15313.zip
chromium_src-1686480f454eb6855810b69c0f9484233ba15313.tar.gz
chromium_src-1686480f454eb6855810b69c0f9484233ba15313.tar.bz2
Extensions Docs Server: Fix tests so they work from any directory
Tests now can be run from any directory. Review URL: https://chromiumcodereview.appspot.com/10916217 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/idl_schema.py')
-rw-r--r--tools/json_schema_compiler/idl_schema.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 393887b..6693ed4 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -20,11 +20,16 @@ import schema_util
# idl_parser expects to be able to import certain files in its directory,
# so let's set things up the way it wants.
-idl_generators_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- os.pardir, os.pardir, 'ppapi', 'generators')
-if idl_generators_path not in sys.path:
- sys.path.insert(0, idl_generators_path)
-import idl_parser
+_idl_generators_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ os.pardir, os.pardir, 'ppapi', 'generators')
+if _idl_generators_path in sys.path:
+ import idl_parser
+else:
+ sys.path.insert(0, _idl_generators_path)
+ try:
+ import idl_parser
+ finally:
+ sys.path.pop(0)
def ProcessComment(comment):
'''