From 6b703b3211ce45389a777a439ccdf8fd64ed2b30 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 25 Apr 2017 12:40:46 +0800 Subject: giscanner: Update location of temp sources and objects For preprocessing, when we create the temp file for preprocessing, make the temp file be stored in CWD instead of the system's temp directory; and when we compile the dumper program, set the output_dir to be the root directory (:\ on Windows and / otherwise). This is because distutils insists on using the full path from the root directory to compile sources, so that if we set the output_dir as we now do we will get $(abs_srcdir)/$(tmpdir)/<$(abs_srcdir)_minus_rootdir>/$(tmpdir)/.[o|obj]. https://bugzilla.gnome.org/show_bug.cgi?id=781525 --- giscanner/ccompiler.py | 3 +-- giscanner/sourcescanner.py | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py index 7c1895da..155b61d4 100644 --- a/giscanner/ccompiler.py +++ b/giscanner/ccompiler.py @@ -238,8 +238,7 @@ class CCompiler(object): macros=macros, include_dirs=includes, extra_postargs=extra_postargs, - output_dir=str(source_str[tmpdir_idx + 1: - source_str.rfind(os.sep)])) + output_dir=os.path.abspath(os.sep)) def link(self, output, objects, lib_args): # Note: This is used for non-libtool builds only! diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py index 049ae162..30fa75f0 100644 --- a/giscanner/sourcescanner.py +++ b/giscanner/sourcescanner.py @@ -290,7 +290,9 @@ class SourceScanner(object): cc = CCompiler() - tmp_fd_cpp, tmp_name_cpp = tempfile.mkstemp(prefix='g-ir-cpp-', suffix='.c') + tmp_fd_cpp, tmp_name_cpp = tempfile.mkstemp(prefix='g-ir-cpp-', + suffix='.c', + dir=os.getcwd()) with os.fdopen(tmp_fd_cpp, 'wb') as fp_cpp: self._write_preprocess_src(fp_cpp, defines, undefs, filenames) -- cgit v1.2.1