Skip to content

Commit

Permalink
Merge 164739 - [GTK] Reduplicate common.top_level_path in scripts
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=129291

Reviewed by Philippe Normand.

Duplicate common.top_level_path and avoid polluting many scripts with awkward system
path manipulation and weird dependencies on the jhbuild infrastructure.

* Scripts/run-gtk-tests: Use common again.
(TestRunner._setup_testing_environment): Ditto.
* gtk/check-gdom-symbols: Ditto.
* gtk/common.py:
(top_level_path): Re-add top_level_path..
(get_build_path): Use the builtin top_level_path again.
* gtk/find-make-dist-errors: Use common again.
(get_missing_headers): Ditto.
* gtk/generate-inspector-gresource-manifest.py: Ditto.


Conflicts:
	Tools/ChangeLog
  • Loading branch information
kov committed May 13, 2014
1 parent 70d2af0 commit 9e5bac7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
5 changes: 1 addition & 4 deletions Tools/Scripts/run-gtk-tests
Expand Up @@ -31,9 +31,6 @@ sys.path.append(os.path.join(top_level_directory, "Tools", "gtk"))
import common
import jhbuildutils

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../jhbuild"))
import jhbuildrc_common

class SkippedTest:
ENTIRE_SUITE = None

Expand Down Expand Up @@ -198,7 +195,7 @@ class TestRunner:
def _setup_testing_environment(self):
self._test_env = os.environ
self._test_env['GSETTINGS_BACKEND'] = 'memory'
self._test_env["TEST_WEBKIT_API_WEBKIT2_RESOURCES_PATH"] = jhbuildrc_common.top_level_path("Tools", "TestWebKitAPI", "Tests", "WebKit2")
self._test_env["TEST_WEBKIT_API_WEBKIT2_RESOURCES_PATH"] = common.top_level_path("Tools", "TestWebKitAPI", "Tests", "WebKit2")
self._test_env["TEST_WEBKIT_API_WEBKIT2_INJECTED_BUNDLE_PATH"] = common.tests_library_build_path()
self._test_env["WEBKIT_EXEC_PATH"] = self._programs_path

Expand Down
5 changes: 1 addition & 4 deletions Tools/gtk/check-gdom-symbols
Expand Up @@ -22,9 +22,6 @@ import subprocess
import sys
import tempfile

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../jhbuild"))
import jhbuildrc_common

def should_update_symbols_file(new, old):
if not os.path.exists(old):
return False
Expand Down Expand Up @@ -52,7 +49,7 @@ if __name__ == '__main__':
tmp.write(file_handle.read())
tmp.flush()

gdom_source_path = jhbuildrc_common.top_level_path('Source', 'WebCore', 'bindings')
gdom_source_path = common.top_level_path('Source', 'WebCore', 'bindings')
api_break_test_path = os.path.join(gdom_source_path, 'scripts', 'gobject-run-api-break-test')
subprocess.call([sys.executable, api_break_test_path, os.path.join(gdom_source_path, 'gobject', 'webkitdom.symbols'), tmp.name])

Expand Down
19 changes: 12 additions & 7 deletions Tools/gtk/common.py
Expand Up @@ -21,16 +21,21 @@
import subprocess
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../jhbuild"))
import jhbuildrc_common

top_level_dir = None
build_dir = None
library_build_dir = None
tests_library_build_dir = None
is_cmake = None
build_types = ('Release', 'Debug')


def top_level_path(*args):
global top_level_dir
if not top_level_dir:
top_level_dir = os.path.join(os.path.dirname(__file__), '..', '..')
return os.path.join(*(top_level_dir,) + args)


def set_build_types(new_build_types):
global build_types
build_types = new_build_types
Expand Down Expand Up @@ -100,20 +105,20 @@ def is_valid_build_directory(path):

global build_types
for build_type in build_types:
build_dir = jhbuildrc_common.top_level_path('WebKitBuild', build_type)
build_dir = top_level_path('WebKitBuild', build_type)
if is_valid_build_directory(build_dir):
return build_dir

# distcheck builds in a directory named _build in the top-level path.
build_dir = jhbuildrc_common.top_level_path("_build")
build_dir = top_level_path("_build")
if is_valid_build_directory(build_dir):
return build_dir

build_dir = jhbuildrc_common.top_level_path()
build_dir = top_level_path()
if is_valid_build_directory(build_dir):
return build_dir

build_dir = jhbuildrc_common.top_level_path("WebKitBuild")
build_dir = top_level_path("WebKitBuild")
if is_valid_build_directory(build_dir):
return build_dir

Expand Down
5 changes: 1 addition & 4 deletions Tools/gtk/find-make-dist-errors
Expand Up @@ -20,9 +20,6 @@ import os
import subprocess
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../jhbuild"))
import jhbuildrc_common

def is_source_file_listing(line):
return line.strip().startswith('Source')

Expand Down Expand Up @@ -89,7 +86,7 @@ def get_unlisted_headers(listed_makefile_headers):
def get_missing_headers(listed_makefile_headers):
missing = set()
for header in listed_makefile_headers:
if not os.path.exists(jhbuildrc_common.top_level_path(header)):
if not os.path.exists(common.top_level_path(header)):
missing.add(header)
return missing

Expand Down
5 changes: 1 addition & 4 deletions Tools/gtk/generate-inspector-gresource-manifest.py
Expand Up @@ -20,10 +20,7 @@
import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../jhbuild"))
import jhbuildrc_common

resources_path = jhbuildrc_common.top_level_path() + "/Source/WebInspectorUI/"
resources_path = common.top_level_path() + "/Source/WebInspectorUI/"
inspector_files = \
glob.glob(resources_path + 'UserInterface/*.html') + \
glob.glob(resources_path + 'UserInterface/*.js') + \
Expand Down

0 comments on commit 9e5bac7

Please sign in to comment.