Exemple #1
0
 def __init__(self, prefix, plugin_dir):
     Thread.__init__(self, name='StdInCauldronServer')
     self.daemon = True
     self.cauldronserver = CauldronServer(prefix)
     self.plugin_dir = plugin_dir
     self.wm = pyinotify.WatchManager()
     self.notifier = pyinotify.Notifier(self.wm, self)
     self.watch = self.wm.add_watch(plugin_dir,
                                    pyinotify.IN_DELETE
                                    | pyinotify.IN_CLOSE_WRITE,
                                    rec=True)
     self.boiling = {}
Exemple #2
0
	def __init__(self,prefix,plugin_dir):
		Thread.__init__(self,name='StdInCauldronServer')
		self.daemon=True
		self.cauldronserver=CauldronServer(prefix)
		self.plugin_dir=plugin_dir
		self.wm=pyinotify.WatchManager()
		self.notifier=pyinotify.Notifier(self.wm,self)
		self.watch=self.wm.add_watch(plugin_dir,pyinotify.IN_DELETE|pyinotify.IN_CLOSE_WRITE,rec=True)
		self.boiling={}
Exemple #3
0
class StdInCauldronServer(Thread, pyinotify.ProcessEvent):
    def __init__(self, prefix, plugin_dir):
        Thread.__init__(self, name='StdInCauldronServer')
        self.daemon = True
        self.cauldronserver = CauldronServer(prefix)
        self.plugin_dir = plugin_dir
        self.wm = pyinotify.WatchManager()
        self.notifier = pyinotify.Notifier(self.wm, self)
        self.watch = self.wm.add_watch(plugin_dir,
                                       pyinotify.IN_DELETE
                                       | pyinotify.IN_CLOSE_WRITE,
                                       rec=True)
        self.boiling = {}

    def run(self):
        self.cauldronserver.start()
        self.notifier.loop()

    def process_IN_DELETE(self, event):
        print("Removing:", event.pathname)
        self.stopProcess(event.pathname)

    def process_IN_CLOSE_WRITE(self, event):
        print("Edited:", event.pathname)
        self.stopProcess(event.pathname)
        self.startProcess(event.pathname)

    def stopProcess(self, path):
        try:
            process = self.boiling[path]
            process.stop()
        except KeyError:
            pass

    def startProcess(self, path):
        process = StdInCauldronRequestHandler(self.cauldronserver, path)
        self.boiling[path] = process
        process.start()

    def write(self, data):
        self.cauldronserver.write(data)
Exemple #4
0
class StdInCauldronServer(Thread,pyinotify.ProcessEvent):
	def __init__(self,prefix,plugin_dir):
		Thread.__init__(self,name='StdInCauldronServer')
		self.daemon=True
		self.cauldronserver=CauldronServer(prefix)
		self.plugin_dir=plugin_dir
		self.wm=pyinotify.WatchManager()
		self.notifier=pyinotify.Notifier(self.wm,self)
		self.watch=self.wm.add_watch(plugin_dir,pyinotify.IN_DELETE|pyinotify.IN_CLOSE_WRITE,rec=True)
		self.boiling={}

	def run(self):
		self.cauldronserver.start()
		self.notifier.loop()

	def process_IN_DELETE(self, event):
		print("Removing:", event.pathname)
		self.stopProcess(event.pathname)

	def process_IN_CLOSE_WRITE(self, event):
		print("Edited:", event.pathname)
		self.stopProcess(event.pathname)
		self.startProcess(event.pathname)

	def stopProcess(self,path):
		try:
			process=self.boiling[path]
			process.stop()
		except KeyError:
			pass

	def startProcess(self,path):
		process=StdInCauldronRequestHandler(self.cauldronserver,path)
		self.boiling[path]=process
		process.start()
	
	def write(self,data):
		self.cauldronserver.write(data)
	def __init__(self,listen,prefix):
		self.allow_reuse_address=True
		ThreadingTCPServer.__init__(self,listen, TCPCauldronRequestHandler)
		CauldronServer.__init__(self, prefix)
	def __init__(self,listen,prefix):
		HTTPServer.__init__(self,listen, HTTPCauldronRequestHandler)
		CauldronServer.__init__(self, prefix)
 def __init__(self, listen, prefix):
     HTTPServer.__init__(self, listen, HTTPCauldronRequestHandler)
     CauldronServer.__init__(self, prefix)
Exemple #8
0
 def __init__(self, listen, prefix):
     self.allow_reuse_address = True
     ThreadingTCPServer.__init__(self, listen, TCPCauldronRequestHandler)
     CauldronServer.__init__(self, prefix)