Commits

elbaschid committed b91b01f

derived install command and added schema setup

  • Participants
  • Parent commits 89ae747

Comments (0)

Files changed (1)

 
 import os
 import sys
+import pwd
 import glob
 import subprocess
 
 from distutils.core import setup
+from distutils.command.install_data import install_data
+
 from DistUtilsExtra.command import *
 
+class post_install(install_data):
+
+    def run(self):
+        # Call parent 
+        install_data.run(self)
+
+        if pwd.getpwuid(os.getuid()).pw_name == 'root':
+            # Execute commands
+            config_source = subprocess.check_output([
+                'gconftool-2',
+                '--get-default-source'
+            ]).strip()
+            for schema_file in [os.path.basename(f) for f in schema_files]:
+                cmd = ' '.join([
+                    "GCONF_CONFIG_SOURCE=%s" % config_source,
+                    "gconftool-2",
+                    "--makefile-install-rule",
+                    sys.prefix+'/share/gconf/schemas/'+schema_file
+                ])
+                output = subprocess.check_output(cmd, shell=True)
+
+
 schema_files = glob.glob('data/gconf/*.schemas')
 
 setup(
 
     description = '',
     #long_description = revelation_indicator.__doc__,
+    license = 'GNU General Public License (GPL)',
 
     scripts = ['revelation_indicator'],
     packages = [],
-
     provides = [],
-    license = 'GNU General Public License (GPL)',
 
     data_files = [
         (sys.prefix+'/share/gconf/schemas', schema_files),
+        (sys.prefix+'/share/applications', glob.glob('data/applications/*.desktop')),
     ],
-
-    cmdclass = { 
-        "build" : build_extra.build_extra,
-        "build_i18n" :  build_i18n.build_i18n,
-        "build_help" :  build_help.build_help,
-        "build_icons" :  build_icons.build_icons
-    },
-
     classifiers = [
         'Development Status :: 4 - Beta',
         'License :: OSI Approved :: GNU General Public License (GPL)',
         'Operating System :: Linux',
         'Programming Language :: Python',
     ]
+    cmdclass = { 
+        "build" : build_extra.build_extra,
+        "install_data": post_install,
+        "build_i18n" :  build_i18n.build_i18n,
+        "build_help" :  build_help.build_help,
+        "build_icons" :  build_icons.build_icons
+    },
 )
 
-
-config_source = subprocess.check_output([
-    'gconftool-2',
-    '--get-default-source'
-]).strip()
-for schema_file in [os.path.basename(f) for f in schema_files]:
-    cmd = ' '.join([
-        "GCONF_CONFIG_SOURCE=%s" % config_source,
-        "gconftool-2",
-        "--makefile-install-rule",
-        sys.prefix+'/share/gconf/schemas/'+schema_file
-    ])
-    output = subprocess.check_output(cmd, shell=True)