Bug 1319352 - Allow to run AccEventGen.py and xpild/header.py from any directory. r?mshal
--- a/accessible/xpcom/AccEventGen.py
+++ b/accessible/xpcom/AccEventGen.py
@@ -218,11 +218,11 @@ def get_conf(conf_file):
mozpath.join(buildconfig.topsrcdir, 'xpcom', 'base'),
]
return conf, inc_dir
def gen_files(fd, conf_file, xpidllex, xpidlyacc):
deps = set()
conf, inc_dir = get_conf(conf_file)
deps.update(print_header_file(fd, conf, inc_dir))
- with open('xpcAccEvents.cpp', 'w') as cpp_fd:
+ with open(os.path.join(os.path.dirname(fd.name), 'xpcAccEvents.cpp'), 'w') as cpp_fd:
deps.update(print_cpp_file(cpp_fd, conf, inc_dir))
return deps
--- a/xpcom/idl-parser/xpidl/header.py
+++ b/xpcom/idl-parser/xpidl/header.py
@@ -543,17 +543,17 @@ def write_interface(iface, fd):
'nativeName': methodNativeName(member),
'paramList': paramlistAsNative(member, empty='')})
fd.write('\n')
fd.write(iface_template_epilog)
def main(outputfile):
- cachedir = '.'
+ cachedir = os.path.dirname(outputfile.name if outputfile else '') or '.'
if not os.path.isdir(cachedir):
os.mkdir(cachedir)
sys.path.append(cachedir)
# Delete the lex/yacc files. Ply is too stupid to regenerate them
# properly
for fileglobs in [os.path.join(cachedir, f) for f in ["xpidllex.py*", "xpidlyacc.py*"]]:
for filename in glob.glob(fileglobs):