[gobject-introspection] giscanner: Update location of temp sources and objects



commit 6b703b3211ce45389a777a439ccdf8fd64ed2b30
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Apr 25 12:40:46 2017 +0800

    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

 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 7c1895d..155b61d 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 049ae16..30fa75f 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)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]