Logo Search packages:      
Sourcecode: ubuntuone-dev-tools version File versions  Download package

def ubuntuone::devtools::services::dbus::DBusRunner::_find_config_file (   self,
  tempdir = None 
) [private]
Find the first appropriate dbus-session.conf to use.

Definition at line 47 of file dbus.py.

                                             :
        """Find the first appropriate dbus-session.conf to use."""
        # In case we're running from within the source tree
        path = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                            os.path.pardir, os.path.pardir,
                                            os.path.pardir,
                                            "data", "dbus-session.conf.in"))
        if not os.path.exists(path):
            # Use the installed file in $pkgdatadir as source
            for path in load_data_paths("ubuntuone-dev-tools",
                                        "dbus-session.conf.in"):
                if os.path.exists(path):
                    break

        # Check to make sure we didn't just fall out of the loop
        if not os.path.exists(path):
            raise IOError('Could not locate suitable dbus-session.conf.in')

        self.config_file = os.path.join(tempdir, 'dbus-session.conf')
        dbus_address = 'unix:tmpdir=%s' % quote(tempdir)
        with open(path) as in_file:
            content = in_file.read()
            with open(self.config_file, 'w') as out_file:
                out_file.write(content.replace('@ADDRESS@', dbus_address))
                out_file.close()
            in_file.close()


Generated by  Doxygen 1.6.0   Back to index