summaryrefslogtreecommitdiff
path: root/Tools/gtk/common.py
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Tools/gtk/common.py
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Tools/gtk/common.py')
-rw-r--r--Tools/gtk/common.py52
1 files changed, 45 insertions, 7 deletions
diff --git a/Tools/gtk/common.py b/Tools/gtk/common.py
index f53cc95aa..02f8b6541 100644
--- a/Tools/gtk/common.py
+++ b/Tools/gtk/common.py
@@ -24,7 +24,8 @@ import sys
top_level_dir = None
build_dir = None
library_build_dir = None
-binary_build_dir = None
+tests_library_build_dir = None
+is_cmake = None
build_types = ('Release', 'Debug')
@@ -40,18 +41,41 @@ def set_build_types(new_build_types):
build_types = new_build_types
+def is_cmake_build():
+ global is_cmake
+ if is_cmake is None:
+ is_cmake = os.path.exists(build_path('CMakeCache.txt'))
+ return is_cmake
+
+
def library_build_path(*args):
global library_build_dir
if not library_build_dir:
- library_build_dir = build_path('lib', *args)
+ if is_cmake_build():
+ library_build_dir = build_path('lib', *args)
+ else:
+ library_build_dir = build_path('.libs', *args)
return library_build_dir
+def tests_library_build_path(*args):
+ if is_cmake_build():
+ return library_build_path(*args)
+
+ global tests_library_build_dir
+ if not tests_library_build_dir:
+ tests_library_build_dir = build_path('Libraries', *args)
+ return tests_library_build_dir
+
+
def binary_build_path(*args):
- global binary_build_dir
- if not binary_build_dir:
- binary_build_dir = build_path('bin', *args)
- return binary_build_dir
+ global library_build_dir
+ if not library_build_dir:
+ if is_cmake_build():
+ library_build_dir = build_path('bin', *args)
+ else:
+ library_build_dir = build_path('Programs', *args)
+ return library_build_dir
def get_build_path(fatal=True):
@@ -60,7 +84,11 @@ def get_build_path(fatal=True):
return build_dir
def is_valid_build_directory(path):
- return os.path.exists(os.path.join(path, 'CMakeCache.txt')) or \
+ return os.path.exists(os.path.join(path, 'GNUmakefile')) or \
+ os.path.exists(os.path.join(path, 'Programs', 'GtkLauncher')) or \
+ os.path.exists(os.path.join(path, 'Programs', 'MiniBrowser')) or \
+ os.path.exists(os.path.join(path, 'CMakeCache.txt')) or \
+ os.path.exists(os.path.join(path, 'bin/GtkLauncher')) or \
os.path.exists(os.path.join(path, 'bin/MiniBrowser'))
if len(sys.argv[1:]) > 1 and os.path.exists(sys.argv[-1]) and is_valid_build_directory(sys.argv[-1]):
@@ -116,6 +144,16 @@ def prefix_of_pkg_config_file(package):
return pkg_config_file_variable(package, 'prefix')
+def gtk_version_of_pkg_config_file(pkg_config_path):
+ process = subprocess.Popen(['pkg-config', pkg_config_path, '--print-requires'],
+ stdout=subprocess.PIPE)
+ stdout = process.communicate()[0].decode("utf-8")
+
+ if 'gtk+-3.0' in stdout:
+ return 3
+ return 2
+
+
def parse_output_lines(fd, parse_line_callback):
output = ''
read_set = [fd]