summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2017-04-25 12:40:46 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2017-05-01 09:14:02 +0800
commit6b703b3211ce45389a777a439ccdf8fd64ed2b30 (patch)
tree5f5d2b19f4968e8a4461eb42585c7e2ad12968ed
parente65915cd4fc6a69bd68d2193607f83f9815fe80e (diff)
downloadgobject-introspection-6b703b3211ce45389a777a439ccdf8fd64ed2b30.tar.gz
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 (<drive letter>:\ 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)/<target_gir_file_name>.[o|obj]. https://bugzilla.gnome.org/show_bug.cgi?id=781525
-rw-r--r--giscanner/ccompiler.py3
-rw-r--r--giscanner/sourcescanner.py4
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)