Created
August 31, 2010 12:54
-
-
Save systempuntoout/558970 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fsevents import Observer | |
from fsevents import Stream | |
from datetime import datetime | |
import subprocess | |
import os | |
import time | |
PROJECT_PATH = '/Users/.../Project/GoogleAppEngine/stackprinter/' | |
TEMPLATE_COMPILE_PATH = os.path.join(PROJECT_PATH,'web','template.py') | |
VIEWS_PATH = os.path.join(PROJECT_PATH,'app','views') | |
def callback(event): | |
if event.name.endswith('.html'): | |
subprocess.Popen('python2.5 %s %s %s' % ( TEMPLATE_COMPILE_PATH ,'--compile', VIEWS_PATH) , shell=True) | |
print '%s - %s compiled!' % (datetime.now(), event.name.split('/')[-1]) | |
observer = Observer() | |
observer.start() | |
stream = Stream(callback, VIEWS_PATH, file_events=True) | |
observer.schedule(stream) | |
while not observer.isAlive(): | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment