Skip to content

Commit

Permalink
replace distutils.spawn.find_executable with shutils.which
Browse files Browse the repository at this point in the history
  • Loading branch information
friday committed Jan 18, 2022
1 parent 62d674a commit 8733c41
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion lib.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import subprocess
import gi
from distutils.spawn import find_executable as find_exec

gi.require_version('Gdk', '3.0')
gi.require_version('Gtk', '3.0')
Expand Down
5 changes: 3 additions & 2 deletions managers/Clipman.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import subprocess
import json
from lib import exec_get, find_exec, pid_of
from shutil import which
from lib import exec_get, pid_of

name = 'Clipman'
client = 'clipman'
pasteAgent = "wl-paste"
copyAgent = "wl-copy"

def can_start():
return bool(find_exec(client))
return bool(which(client))

def is_running():
return bool(pid_of(pasteAgent))
Expand Down
5 changes: 3 additions & 2 deletions managers/Clipster.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import subprocess
import urllib.request
from lib import exec_get, find_exec, pid_of
from shutil import which
from lib import exec_get, pid_of


name = 'Clipster'
Expand All @@ -13,7 +14,7 @@

def can_start():
# Should always be true considering ^ but still good to test
return bool(find_exec(client))
return bool(which(client))

def is_running():
# Check if global clipster is running before the auto downloaded one
Expand Down
5 changes: 3 additions & 2 deletions managers/CopyQ.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import subprocess
import json
from lib import exec_get, find_exec, pid_of
from shutil import which
from lib import exec_get, pid_of


name = 'CopyQ'
client = 'copyq'

def can_start():
return bool(find_exec(client))
return bool(which(client))

def is_running():
return bool(pid_of(client))
Expand Down
5 changes: 3 additions & 2 deletions managers/GPaste.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import subprocess
from lib import exec_get, find_exec, pid_of
from shutil import which
from lib import exec_get, pid_of


name = 'GPaste'
client = 'gpaste-client'

def can_start():
return bool(find_exec(client))
return bool(which(client))

def is_running():
return bool(pid_of('gpaste-daemon'))
Expand Down

0 comments on commit 8733c41

Please sign in to comment.