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)
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)
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
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
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
def srv_available(self): if os.name == 'nt': return True return helpers.is_in_path('nslookup')
def srv_available(self): return helpers.is_in_path('nslookup')