summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-11-05 19:36:28 +0100
committerAndrew Bartlett <abartlet@samba.org>2012-11-06 08:27:43 +1100
commitea5ef95fbebe28cca11f86a9015aab77522f5e18 (patch)
treed4406355e0661b01d56f4a8542c542fb31c22610
parent3d9361612d30725a3d14fa4d3a085256a91800db (diff)
downloadsamba-ea5ef95fbebe28cca11f86a9015aab77522f5e18.tar.gz
samba-ea5ef95fbebe28cca11f86a9015aab77522f5e18.tar.bz2
samba-ea5ef95fbebe28cca11f86a9015aab77522f5e18.zip
wafsamba.samba_abi: Refactor abi_write_vscript to take file argument.
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
-rw-r--r--buildtools/wafsamba/samba_abi.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index ed977ba4c2..d3852ea48b 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -152,22 +152,23 @@ def abi_process_file(fname, version, symmap):
symmap[symname] = version
f.close()
-def abi_write_vscript(vscript, libname, current_version, versions, symmap, abi_match):
- '''write a vscript file for a library in --version-script format
- :param vscript: Path to the vscript file
+def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match):
+ """Write a vscript file for a library in --version-script format.
+
+ :param f: File-like object to write to
:param libname: Name of the library, uppercased
:param current_version: Current version
:param versions: Versions to consider
:param symmap: Dictionary mapping symbols -> version
- :param abi_match: List of symbols considered to be public in the current version
- '''
+ :param abi_match: List of symbols considered to be public in the current
+ version
+ """
invmap = {}
for s in symmap:
invmap.setdefault(symmap[s], []).append(s)
- f = open(vscript, mode='w')
last_key = ""
versions = sorted(versions, key=version_key)
for k in versions:
@@ -197,7 +198,6 @@ def abi_write_vscript(vscript, libname, current_version, versions, symmap, abi_m
elif abi_match != ["*"]:
f.write("\tlocal: *;\n")
f.write("};\n")
- f.close()
def abi_build_vscript(task):
@@ -213,8 +213,12 @@ def abi_build_vscript(task):
version = basename[len(task.env.LIBNAME)+1:-len(".sigs")]
versions.append(version)
abi_process_file(fname, version, symmap)
- abi_write_vscript(tgt, task.env.LIBNAME, task.env.VERSION, versions, symmap,
- task.env.ABI_MATCH)
+ f = open(tgt, mode='w')
+ try:
+ abi_write_vscript(f, task.env.LIBNAME, task.env.VERSION, versions,
+ symmap, task.env.ABI_MATCH)
+ finally:
+ f.close()
def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None):