Back to index

enigmail  1.4.3
Functions | Variables
libstdcxx Namespace Reference

Functions

def parse_readelf_line
def parse_ld_line
def split_ver
def cmp_ver
def encode_ver
def find_version

Variables

tuple re_for_ld = re.compile('.*\((.*)\).*')
list sdk_dir = os.environ['MACOS_SDK_DIR']
int target_ver = 0
int host_ver = 0
list cxx_env = os.environ['CXX']
tuple host_cxx_env = os.environ.get('HOST_CXX', cxx_env)

Function Documentation

def libstdcxx.cmp_ver (   a,
  b 
)
Compare versions in the form 'a.b.c'

Definition at line 39 of file libstdcxx.py.

00039 
00040 def cmp_ver(a, b):
00041     """Compare versions in the form 'a.b.c'
00042     """
00043     for (i, j) in zip(split_ver(a), split_ver(b)):
00044         if i != j:
00045             return i - j
00046     return 0

Here is the call graph for this function:

def libstdcxx.encode_ver (   v)
Encode the version as a single number.

Definition at line 47 of file libstdcxx.py.

00047 
00048 def encode_ver(v):
00049     """Encode the version as a single number.
00050     """
00051     t = split_ver(v)
00052     return t[0] << 16 | t[1] << 8 | t[2]

Here is the call graph for this function:

Here is the caller graph for this function:

Given the value of environment variable CXX or HOST_CXX, find the
version of the libstdc++ it uses.

Definition at line 53 of file libstdcxx.py.

00053 
00054 def find_version(e):
00055     """Given the value of environment variable CXX or HOST_CXX, find the
00056     version of the libstdc++ it uses.
00057     """
00058     args = e.split()
00059     args +=  ['-shared', '-Wl,-t']
00060     p = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
00061     candidates = [x for x in p.stdout if 'libstdc++.so' in x]
00062     assert len(candidates) == 1
00063     libstdcxx = parse_ld_line(candidates[-1])
00064 
00065     p = subprocess.Popen(['readelf', '-V', libstdcxx], stdout=subprocess.PIPE)
00066     versions = [parse_readelf_line(x)
00067                 for x in p.stdout.readlines() if 'Name: GLIBCXX' in x]
00068     last_version = sorted(versions, cmp = cmp_ver)[-1]
00069     return encode_ver(last_version)

Here is the call graph for this function:

Parse a line from the output of ld -t. The output of gold is just
the full path, gnu ld prints "-lstdc++ (path)".

Definition at line 25 of file libstdcxx.py.

00025 
00026 def parse_ld_line(x):
00027     """Parse a line from the output of ld -t. The output of gold is just
00028     the full path, gnu ld prints "-lstdc++ (path)".
00029     """
00030     t = re_for_ld.match(x)
00031     if t:
00032         return t.groups()[0].strip()
00033     return x.strip()

Here is the caller graph for this function:

Return the version from a readelf line that looks like:
0x00ec: Rev: 1  Flags: none  Index: 8  Cnt: 2  Name: GLIBCXX_3.4.6

Definition at line 19 of file libstdcxx.py.

00019 
00020 def parse_readelf_line(x):
00021     """Return the version from a readelf line that looks like:
00022     0x00ec: Rev: 1  Flags: none  Index: 8  Cnt: 2  Name: GLIBCXX_3.4.6
00023     """
00024     return x.split(':')[-1].split('_')[-1].strip()

Here is the caller graph for this function:

def libstdcxx.split_ver (   v)
Covert the string '1.2.3' into the list [1,2,3]

Definition at line 34 of file libstdcxx.py.

00034 
00035 def split_ver(v):
00036     """Covert the string '1.2.3' into the list [1,2,3]
00037     """
00038     return [int(x) for x in v.split('.')]

Here is the caller graph for this function:


Variable Documentation

list libstdcxx.cxx_env = os.environ['CXX']

Definition at line 80 of file libstdcxx.py.

tuple libstdcxx.host_cxx_env = os.environ.get('HOST_CXX', cxx_env)

Definition at line 82 of file libstdcxx.py.

tuple libstdcxx.host_ver = 0

Definition at line 75 of file libstdcxx.py.

tuple libstdcxx.re_for_ld = re.compile('.*\((.*)\).*')

Definition at line 17 of file libstdcxx.py.

list libstdcxx.sdk_dir = os.environ['MACOS_SDK_DIR']

Definition at line 72 of file libstdcxx.py.

Definition at line 74 of file libstdcxx.py.