summaryrefslogtreecommitdiff
path: root/Tools/jhbuild
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Tools/jhbuild
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Tools/jhbuild')
-rwxr-xr-xTools/jhbuild/jhbuild-wrapper35
-rw-r--r--Tools/jhbuild/jhbuildutils.py53
2 files changed, 61 insertions, 27 deletions
diff --git a/Tools/jhbuild/jhbuild-wrapper b/Tools/jhbuild/jhbuild-wrapper
index 8f852f73d..390fc7821 100755
--- a/Tools/jhbuild/jhbuild-wrapper
+++ b/Tools/jhbuild/jhbuild-wrapper
@@ -17,38 +17,20 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+import jhbuildutils
import os
import shlex
import subprocess
import sys
-
-top_level_dir = None
-
-
-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)
-
-
jhbuild_revision = '1eedc423f75c605224b430579e4c303292199507'
-if os.environ.has_key('WEBKITOUTPUTDIR'):
- dependencies_path = os.path.abspath(os.path.join(os.environ['WEBKITOUTPUTDIR'], 'Dependencies'))
-else:
- dependencies_path = os.path.abspath(top_level_path('WebKitBuild', 'Dependencies'))
-
+dependencies_path = jhbuildutils.get_dependencies_path()
installation_prefix = os.path.abspath(os.path.join(dependencies_path, 'Root'))
source_path = os.path.abspath(os.path.join(dependencies_path, 'Source'))
jhbuild_source_path = os.path.join(source_path, 'jhbuild')
jhbuild_path = os.path.join(installation_prefix, 'bin', 'jhbuild')
-
-platform = None;
-
-
def jhbuild_installed():
return os.path.exists(jhbuild_path)
@@ -108,8 +90,8 @@ def install_jhbuild():
raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
-def update_webkit_libs_jhbuild():
- process = subprocess.Popen([top_level_path('Tools', 'Scripts', 'update-webkit-libs-jhbuild'), '--' + platform])
+def update_webkit_libs_jhbuild(platform):
+ process = subprocess.Popen([jhbuildutils.top_level_path('Tools', 'Scripts', 'update-webkit-libs-jhbuild'), '--' + platform])
process.wait()
if process.returncode != 0:
raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
@@ -123,12 +105,12 @@ def determine_platform():
raise ValueError('No platform specified for jhbuild-wrapper.')
-def ensure_jhbuild():
+def ensure_jhbuild(platform):
if not jhbuild_cloned():
clone_jhbuild()
update_jhbuild()
install_jhbuild()
- update_webkit_libs_jhbuild()
+ update_webkit_libs_jhbuild(platform)
elif not jhbuild_installed() \
or not jhbuild_at_expected_revision():
update_jhbuild()
@@ -143,7 +125,6 @@ try:
platform = determine_platform()
except ValueError as e:
sys.exit(e)
-ensure_jhbuild()
-
-os.execve(jhbuild_path, [jhbuild_path, '--no-interact', '-f', top_level_path('Tools', platform, 'jhbuildrc')] + sys.argv[2:], os.environ)
+ensure_jhbuild(platform)
+os.execve(jhbuild_path, [jhbuild_path, '--no-interact', '-f', jhbuildutils.get_config_file_for_platform(platform)] + sys.argv[2:], os.environ)
diff --git a/Tools/jhbuild/jhbuildutils.py b/Tools/jhbuild/jhbuildutils.py
new file mode 100644
index 000000000..c9972b85a
--- /dev/null
+++ b/Tools/jhbuild/jhbuildutils.py
@@ -0,0 +1,53 @@
+import glob
+import os.path
+import sys
+import __builtin__
+
+top_level_dir = None
+
+
+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 get_dependencies_path():
+ if 'WEBKITOUTPUTDIR' in os.environ:
+ return os.path.abspath(os.path.join(os.environ['WEBKITOUTPUTDIR'], 'Dependencies'))
+ else:
+ return os.path.abspath(top_level_path('WebKitBuild', 'Dependencies'))
+
+
+def get_config_file_for_platform(platform):
+ return top_level_path('Tools', platform, 'jhbuildrc')
+
+
+def enter_jhbuild_environment_if_available(platform):
+ if not os.path.exists(get_dependencies_path()):
+ return False
+
+ # Sometimes jhbuild chooses to install in a way that reads the library from the source directory, so fall
+ # back to that method.
+ source_path = os.path.join(get_dependencies_path(), "Source", "jhbuild")
+ sys.path.insert(0, source_path)
+
+ # When loading jhbuild from the source checkout it fails if the SRCDIR variable is not set.
+ __builtin__.__dict__['SRCDIR'] = source_path
+
+ # We don't know the Python version, so we just assume that we can safely take the first one in the list.
+ site_packages_path = glob.glob(os.path.join(get_dependencies_path(), "Root", "lib", "*", "site-packages"))
+ if len(site_packages_path):
+ site_packages_path = site_packages_path[0]
+ sys.path.insert(0, site_packages_path)
+
+ try:
+ import jhbuild.config
+ from jhbuild.errors import FatalError
+ config = jhbuild.config.Config(get_config_file_for_platform(platform))
+ except FatalError, exception:
+ sys.stderr.write('Could not load jhbuild config file: %s\n' % exception.args[0])
+ return False
+
+ return True