3
# Copyright (C) 2007-2008 Luca Falavigna
5
# Author: Luca Falavigna <dktrkranz@ubuntu.com>
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; version 3 of the License.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
21
from time import sleep
22
from Debomatic import globals
23
from Debomatic import build
27
from re import findall
28
from pyinotify import WatchManager, Notifier, EventsCodes, ProcessEvent
30
class PE(ProcessEvent):
31
def process_IN_CLOSE_WRITE(self, event):
32
if findall('source.changes$', event.name):
33
threading.Thread(None, build.build_process).start()
35
def launcher_inotify():
36
if globals.Options.getint('default', 'inotify'):
38
notifier = Notifier(wm, PE())
39
wm.add_watch(globals.Options.get('default', 'packagedir'), EventsCodes.IN_CLOSE_WRITE, rec=True)
42
notifier.process_events()
43
if notifier.check_events():
44
notifier.read_events()
45
except KeyboardInterrupt:
49
def launcher_inotify():
54
threading.Thread(None, build.build_process).start()
55
sleep(globals.Options.getint('default', 'sleep'))
58
threading.Thread(None, launcher_inotify).start()
59
threading.Thread(None, launcher_timer).start()