Title: [161243] trunk/Tools
Revision
161243
Author
[email protected]
Date
2014-01-02 17:19:50 -0800 (Thu, 02 Jan 2014)

Log Message

[GTK] fixing ycm_extra_conf.py file
https://bugs.webkit.org/show_bug.cgi?id=126371

It's an attempt to fix three problems with the current ycm_extra_conf file.
The current implementation assumes that it's a symlink, which is not true.
Usually python creates a pyc file, and this is what you get in __file__.
the .pyc is not a symlink, and the current implementation doesn't work
if that's the case.

It also assumes that the user is in the root folder.
If the user is in WebkitBuild/Debug and open a file as ../../Source/* it won't work.

Last but not least, "elif flag in FLAGS_PRECEDING_PATHS" emits an
exception since "flag" doesn't exists.

All those things were fixed.

Patch by Danilo Cesar Lemes de Paula <[email protected]> on 2014-01-02
Reviewed by Martin Robinson.

* gtk/ycm_extra_conf.py:
(transform_relative_paths_to_absolute_paths):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (161242 => 161243)


--- trunk/Tools/ChangeLog	2014-01-03 01:18:29 UTC (rev 161242)
+++ trunk/Tools/ChangeLog	2014-01-03 01:19:50 UTC (rev 161243)
@@ -1,3 +1,27 @@
+2014-01-02  Danilo Cesar Lemes de Paula  <[email protected]>
+
+        [GTK] fixing ycm_extra_conf.py file
+        https://bugs.webkit.org/show_bug.cgi?id=126371
+
+        It's an attempt to fix three problems with the current ycm_extra_conf file.
+        The current implementation assumes that it's a symlink, which is not true.
+        Usually python creates a pyc file, and this is what you get in __file__.
+        the .pyc is not a symlink, and the current implementation doesn't work
+        if that's the case.
+
+        It also assumes that the user is in the root folder.
+        If the user is in WebkitBuild/Debug and open a file as ../../Source/* it won't work.
+
+        Last but not least, "elif flag in FLAGS_PRECEDING_PATHS" emits an
+        exception since "flag" doesn't exists.
+
+        All those things were fixed.
+
+        Reviewed by Martin Robinson.
+
+        * gtk/ycm_extra_conf.py:
+        (transform_relative_paths_to_absolute_paths):
+
 2014-01-02  Alexey Proskuryakov  <[email protected]>
 
         Bindings tests results links are broken at build.webkit.org/dashboard

Modified: trunk/Tools/gtk/ycm_extra_conf.py (161242 => 161243)


--- trunk/Tools/gtk/ycm_extra_conf.py	2014-01-03 01:18:29 UTC (rev 161242)
+++ trunk/Tools/gtk/ycm_extra_conf.py	2014-01-03 01:19:50 UTC (rev 161243)
@@ -23,10 +23,14 @@
 # It's very likely that this script is a symlink somewhere in the WebKit directory,
 # so we try to find the actual script location so that we can locate the tools
 # directory.
-if os.path.islink(__file__):
-    __tools_directory = os.path.dirname(os.readlink(__file__))
+original_file = __file__[:-1] if __file__.endswith(".pyc") else __file__
+if os.path.islink(original_file):
+    parent_folder = os.path.abspath(os.path.dirname(original_file))
+    link_file = os.path.join(parent_folder, os.readlink(original_file))
+    __tools_directory = os.path.dirname(link_file)
 else:
-    __tools_directory = os.path.dirname(__file__)
+    __tools_directory = os.path.dirname(original_file)
+
 sys.path.insert(0, os.path.abspath(__tools_directory))
 import common
 
@@ -43,7 +47,7 @@
             make_next_absolute = False
             if not argument.startswith('/'):
                 argument = os.path.join(build_path, argument)
-        elif flag in FLAGS_PRECEDING_PATHS:
+        elif argument in FLAGS_PRECEDING_PATHS:
             # Some flags precede the path in the list. For those we make the
             # next argument absolute.
             if argument == flag:
@@ -103,7 +107,7 @@
 
     basename = os.path.basename(filename)
     for line in lines:
-        if line.find(basename) != -1 and line.find("CC") != -1 or line.find("CXX") != -1:
+        if line.find(basename) != -1 and (line.find("CC") != -1 or line.find("CXX") != -1):
             return get_compilation_flags_from_build_commandline(line, build_path)
 
     print "Could not find flags for %s" % filename
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to