~ubuntu-branches/debian/experimental/kopete/experimental

« back to all changes in this revision

Viewing changes to protocols/jabber/googletalk/libjingle/talk/site_scons/site_tools/talk_libjingle.py

  • Committer: Package Import Robot
  • Author(s): Maximiliano Curia
  • Date: 2015-02-24 11:32:57 UTC
  • mfrom: (1.1.41 vivid)
  • Revision ID: package-import@ubuntu.com-20150224113257-gnupg4v7lzz18ij0
Tags: 4:14.12.2-1
* New upstream release (14.12.2).
* Bump Standards-Version to 3.9.6, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2010 Google Inc.
2
 
# All Rights Reserved.
3
 
# Author: thaloun@google.com (Tim Haloun)
4
 
 
5
 
"""Tools that we need to include with libjingle."""
6
 
 
7
 
import subprocess
8
 
 
9
 
 
10
 
# We need this in libjingle because main.scons depends on it and
11
 
# libjingle depends on main.scons.
12
 
def EnableFeatureWherePackagePresent(env, bit, cpp_flag, package):
13
 
  """Enable a feature if a required pkg-config package is present.
14
 
 
15
 
  Args:
16
 
    env: The current SCons environment.
17
 
    bit: The name of the Bit to enable when the package is present.
18
 
    cpp_flag: The CPP flag to enable when the package is present.
19
 
    package: The name of the package.
20
 
  """
21
 
  if not env.Bit('host_linux'):
22
 
    return
23
 
  if _HavePackage(package):
24
 
    env.SetBits(bit)
25
 
    env.Append(CPPDEFINES = [cpp_flag])
26
 
  else:
27
 
    print ('Warning: Package \"%s\" not found. Feature \"%s\" will not be '
28
 
           'built. To build with this feature, install the package that '
29
 
           'provides the \"%s.pc\" file.') % (package, bit, package)
30
 
 
31
 
 
32
 
def _HavePackage(package):
33
 
  """Whether the given pkg-config package name is present on the build system.
34
 
 
35
 
  Args:
36
 
    package: The name of the package.
37
 
 
38
 
  Returns:
39
 
    True if the package is present, else False
40
 
  """
41
 
  return subprocess.call(['pkg-config', '--exists', package]) == 0
42
 
 
43
 
 
44
 
def generate(env):  # pylint: disable-msg=C6409
45
 
  env.AddMethod(EnableFeatureWherePackagePresent)
46
 
 
47
 
 
48
 
def exists(env):  # pylint: disable-msg=C6409,W0613
49
 
  return 1