[Extractor] Replace module which with twisted.python.procutils.which
This commit is contained in:
parent
533bdd398a
commit
21691c5cc1
|
@ -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__)
|
||||
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue