mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont try to start VMs if already running
This commit is contained in:
parent
e545b5eb36
commit
5cc583c3bd
@ -67,6 +67,7 @@ class VMInstaller(Command):
|
|||||||
INSTALLER_EXT = None
|
INSTALLER_EXT = None
|
||||||
VM = None
|
VM = None
|
||||||
VM_NAME = None
|
VM_NAME = None
|
||||||
|
VM_CHECK = None
|
||||||
FREEZE_COMMAND = None
|
FREEZE_COMMAND = None
|
||||||
FREEZE_TEMPLATE = 'python setup.py {freeze_command}'
|
FREEZE_TEMPLATE = 'python setup.py {freeze_command}'
|
||||||
SHUTDOWN_CMD = ['sudo', 'poweroff']
|
SHUTDOWN_CMD = ['sudo', 'poweroff']
|
||||||
@ -117,6 +118,13 @@ class VMInstaller(Command):
|
|||||||
|
|
||||||
|
|
||||||
def run_vm(self):
|
def run_vm(self):
|
||||||
|
pat = '/%s/'%(self.VM_CHECK or self.VM_NAME)
|
||||||
|
pids= [pid for pid in os.listdir('/proc') if pid.isdigit()]
|
||||||
|
for pid in pids:
|
||||||
|
cmdline = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
|
||||||
|
if 'vmware-vmx' in cmdline and pat in cmdline:
|
||||||
|
return
|
||||||
|
|
||||||
self.__p = subprocess.Popen([self.vm])
|
self.__p = subprocess.Popen([self.vm])
|
||||||
|
|
||||||
def start_vm(self, sleep=75):
|
def start_vm(self, sleep=75):
|
||||||
|
@ -28,6 +28,7 @@ class Win32(VMInstaller):
|
|||||||
INSTALLER_EXT = 'exe'
|
INSTALLER_EXT = 'exe'
|
||||||
VM_NAME = 'xp_build'
|
VM_NAME = 'xp_build'
|
||||||
VM = '/vmware/bin/%s'%VM_NAME
|
VM = '/vmware/bin/%s'%VM_NAME
|
||||||
|
VM_CHECK = 'calibre_windows_xp_home'
|
||||||
FREEZE_COMMAND = 'win32_freeze'
|
FREEZE_COMMAND = 'win32_freeze'
|
||||||
FREEZE_TEMPLATE = 'python -OO setup.py {freeze_command} --no-ice'
|
FREEZE_TEMPLATE = 'python -OO setup.py {freeze_command} --no-ice'
|
||||||
INSTALLER_EXT = 'msi'
|
INSTALLER_EXT = 'msi'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user