Exemple #1
0
def get_resolver(idlequeue):
    if USE_LIBASYNCNS:
        log.info("Using LibAsyncNSResolver")
        return LibAsyncNSResolver()
    else:
        if helpers.is_in_path("host"):
            log.info("Using HostResolver")
            return HostResolver(idlequeue)
        log.info("Using NSLookupResolver")
        return NSLookupResolver(idlequeue)
Exemple #2
0
def get_resolver(idlequeue):
    if USE_LIBASYNCNS:
        log.info('Using LibAsyncNSResolver')
        return LibAsyncNSResolver()
    else:
        if helpers.is_in_path('host'):
            log.info('Using HostResolver')
            return HostResolver(idlequeue)
        log.info('Using NSLookupResolver')
        return NSLookupResolver(idlequeue)
Exemple #3
0
def get_abspath_for_script(scriptname, want_type = False):
    """
    Check if we are svn or normal user and return abspath to asked script if
    want_type is True we return 'svn' or 'install'
    """
    if os.path.isdir('.svn'): # we are svn user
        type_ = 'svn'
        cwd = os.getcwd() # it's always ending with src

        if scriptname == 'gajim-remote':
            path_to_script = cwd + '/gajim-remote.py'

        elif scriptname == 'gajim':
            script = '#!/bin/sh\n' # the script we may create
            script += 'cd %s' % cwd
            path_to_script = cwd + '/../scripts/gajim_sm_script'

            try:
                if os.path.exists(path_to_script):
                    os.remove(path_to_script)

                f = open(path_to_script, 'w')
                script += '\nexec python -OOt gajim.py $0 $@\n'
                f.write(script)
                f.close()
                os.chmod(path_to_script, 0700)
            except OSError: # do not traceback (could be a permission problem)
                #we talk about a file here
                s = _('Could not write to %s. Session Management support will '
                    'not work') % path_to_script
                print >> sys.stderr, s

    else: # normal user (not svn user)
        type_ = 'install'
        # always make it like '/usr/local/bin/gajim'
        path_to_script = helpers.is_in_path(scriptname, True)


    if want_type:
        return path_to_script, type_
    else:
        return path_to_script
Exemple #4
0
def get_abspath_for_script(scriptname, want_type=False):
    """
    Check if we are svn or normal user and return abspath to asked script if
    want_type is True we return 'svn' or 'install'
    """
    if os.path.isdir('.svn'):  # we are svn user
        type_ = 'svn'
        cwd = os.getcwd()  # it's always ending with src

        if scriptname == 'gajim-remote':
            path_to_script = cwd + '/gajim-remote.py'

        elif scriptname == 'gajim':
            script = '#!/bin/sh\n'  # the script we may create
            script += 'cd %s' % cwd
            path_to_script = cwd + '/../scripts/gajim_sm_script'

            try:
                if os.path.exists(path_to_script):
                    os.remove(path_to_script)

                f = open(path_to_script, 'w')
                script += '\nexec python -OOt gajim.py $0 $@\n'
                f.write(script)
                f.close()
                os.chmod(path_to_script, 0o700)
            except OSError:  # do not traceback (could be a permission problem)
                #we talk about a file here
                s = _('Could not write to %s. Session Management support will '
                      'not work') % path_to_script
                print(s, file=sys.stderr)

    else:  # normal user (not svn user)
        type_ = 'install'
        # always make it like '/usr/local/bin/gajim'
        path_to_script = helpers.is_in_path(scriptname, True)

    if want_type:
        return path_to_script, type_
    else:
        return path_to_script
Exemple #5
0
def get_abspath_for_script(scriptname, want_type=False):
    """checks if we are svn or normal user and returns abspath to asked script
	if want_type is True we return 'svn' or 'install' """
    if os.path.isdir(".svn"):  # we are svn user
        type = "svn"
        cwd = os.getcwd()  # it's always ending with src

        if scriptname == "gajim-remote":
            path_to_script = cwd + "/gajim-remote.py"

        elif scriptname == "gajim":
            script = "#!/bin/sh\n"  # the script we may create
            script += "cd %s" % cwd
            path_to_script = cwd + "/../scripts/gajim_sm_script"

            try:
                if os.path.exists(path_to_script):
                    os.remove(path_to_script)

                f = open(path_to_script, "w")
                script += "\nexec python -OOt gajim.py $0 $@\n"
                f.write(script)
                f.close()
                os.chmod(path_to_script, 0700)
            except OSError:  # do not traceback (could be a permission problem)
                # we talk about a file here
                s = _("Could not write to %s. Session Management support will not work") % path_to_script
                print >>sys.stderr, s

    else:  # normal user (not svn user)
        type = "install"
        # always make it like '/usr/local/bin/gajim'
        path_to_script = helpers.is_in_path(scriptname, True)

    if want_type:
        return path_to_script, type
    else:
        return path_to_script
Exemple #6
0
 def srv_available(self):
     if os.name == 'nt':
         return True
     return helpers.is_in_path('nslookup')
Exemple #7
0
 def srv_available(self):
     return helpers.is_in_path('nslookup')
Exemple #8
0
	def srv_available(self):
		return helpers.is_in_path('nslookup')
Exemple #9
0
 def srv_available(self):
     if os.name == 'nt':
         return True
     return helpers.is_in_path('nslookup')