[Extractor] Replace module which with twisted.python.procutils.which

This commit is contained in:
Calum Lind 2014-07-11 18:59:52 +01:00
parent 533bdd398a
commit 21691c5cc1
2 changed files with 1 additions and 18 deletions

View File

@ -41,13 +41,13 @@ import os
import logging
from twisted.internet.utils import getProcessValue
from twisted.python.procutils import which
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
import deluge.configmanager
from deluge.core.rpcserver import export
from deluge.common import windows_check
from extractor.which import which
log = logging.getLogger(__name__)

View File

@ -1,17 +0,0 @@
def which(program):
# Author Credit: Jay @ http://stackoverflow.com/a/377028
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None