From 1327edb1ed936859d3e4122c3119e560ce79fc3b Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sun, 1 May 2011 21:22:19 +0200 Subject: [PATCH] add script to install xdg --- tools/install_xdg.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 tools/install_xdg.py diff --git a/tools/install_xdg.py b/tools/install_xdg.py new file mode 100755 index 00000000..dc5d46b2 --- /dev/null +++ b/tools/install_xdg.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +import glob +import subprocess +import os +import sys + +def check_executable(executable): + with open('/dev/null', 'w') as devnull: + process = subprocess.Popen(['which', executable], stdout=devnull) + return_code = process.wait() + if return_code == 0: + return True + else: + print >>sys.stderr, 'Error: %s is not installed on your system.' % executable + sys.exit(1) + +def install_xdg(): + print 'installing desktop menu files' + check_executable('xdg-desktop-menu') + + os.system('xdg-desktop-menu install --novendor desktop/*.desktop') + for filepath in glob.glob('icons/*'): + print 'installing icon %s' % filepath + os.system('xdg-icon-resource install --size 64 --novendor %s' % filepath) + +install_xdg()