#!/usr/bin/python # # /usr/lib/zypp/plugins/commit/texlive.py # # The substitute for the %posttrans scriptlets used by rpm. # Make sure that the update script does its work only once after # an installation/update transaction as zypper executes rpm for # each single texlive package. # # Copyright (c) 2012 SuSE LINUX Products GmbH, Nuernberg, Germany. # # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # Author: Werner Fink, 2012 # from os import listdir, path, access, F_OK,R_OK,X_OK from subprocess import call from zypp_plugin import Plugin global update, tagdir update = "%{_texmfmaindir}/texconfig/update" tagdir = "/var/run/texlive" class MyPlugin(Plugin): def PLUGINBEGIN(self, headers, body): self.ack() def PLUGINEND(self, headers, body): if access(update, F_OK|X_OK): if path.isdir(tagdir) and listdir(tagdir): call("VERBOSE=false " + update + " 2>&1 || :", shell=True) self.ack() plugin = MyPlugin() plugin.main()