pakhandler.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import piksemel
  4. import os
  5. def installGconfSchemas(filepath):
  6. os.environ['GCONF_CONFIG_SOURCE'] = 'xml:merged:/etc/gconf/gconf.xml.defaults'
  7. parse = piksemel.parse(filepath)
  8. schemas = []
  9. for schema in parse.tags("File"):
  10. path = schema.getTagData("Path")
  11. if path.startswith("etc/gconf/schemas"):
  12. schemas.append("/"+path)
  13. if schemas:
  14. os.system("/usr/bin/gconftool-2 --makefile-install-rule %s" % " ".join(schemas))
  15. def uninstallGconfSchemas(filepath):
  16. os.environ['GCONF_CONFIG_SOURCE'] = 'xml:merged:/etc/gconf/gconf.xml.defaults'
  17. parse = piksemel.parse(filepath)
  18. schemas = []
  19. for schema in parse.tags("File"):
  20. path = schema.getTagData("Path")
  21. if path.startswith("etc/gconf/schemas"):
  22. schemas.append("/"+path)
  23. if schemas:
  24. os.system("/usr/bin/gconftool-2 --makefile-uninstall-rule %s" % " ".join(schemas))
  25. def setupPackage(metapath, filepath):
  26. installGconfSchemas(filepath)
  27. def cleanupPackage(metapath, filepath):
  28. uninstallGconfSchemas(filepath)
  29. def postCleanupPackage(metapath, filepath):
  30. pass