# Path: statirator/core/utils.py
# def filesystem_changed(root_dir, ignore_dirs=None, ignore_re=None):
#     "Do we have new, changed, or deleted files under ``root_dir``"
# 
#     global _mtimes, _win
# 
#     found = {}
# 
#     if ignore_dirs is None:
#         ignore_dirs = []
# 
#     for root, dirs, files in os.walk(root_dir):
#         dirs[:] = [x for x in dirs
#                    if x[0] != '.' and
#                    os.path.abspath(os.path.join(root, x)) not in ignore_dirs]
# 
#         for resource in files:
#             full = os.path.join(root, resource)
#             if ignore_re and ignore_re.match(full):
#                 continue
# 
#             stat = os.stat(full)
#             mtime = stat.st_mtime
#             if _win:
#                 mtime -= stat.st_ctime
# 
#             found[full] = int(mtime)
# 
#     if found != _mtimes:
#         _mtimes = found.copy()
#         return True
# 
#     return False


import os
import re
import time
import threading
import BaseHTTPServer
import SimpleHTTPServer
import SocketServer
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import NoArgsCommand, BaseCommand
from optparse import make_option
from statirator.core.utils import filesystem_changed
        from django.conf import settings
                    self.shutdown()
        finally:
            os.chdir(curr_dir)

    def shutdown(self):
        print("\nShutting down")
        self._shutdown = True
        self.httpd_server.shutdown()
        self.httpd_thread.join()

    def filesystem_watcher(self):
        lock = threading.Lock()


        ignore_re = None
        to_ignore = ['\.pyc']

        pipeline_css = getattr(settings, 'PIPELINE_CSS', None)
        for k, v in pipeline_css.iteritems():
            source_filenames = v.get('source_filenames', [])
            for res in source_filenames:
                if res.endswith('.less'):
                    to_ignore.append(res.replace('.less', '\.css'))

        if to_ignore:
            ignore_re = re.compile('.*(' + '|'.join(to_ignore) + ')$')

        def watch():
            while not self._shutdown:
                with lock:

# Path: statirator/core/utils.py
# def filesystem_changed(root_dir, ignore_dirs=None, ignore_re=None):
#     "Do we have new, changed, or deleted files under ``root_dir``"
# 
#     global _mtimes, _win
# 
#     found = {}
# 
#     if ignore_dirs is None:
#         ignore_dirs = []
# 
#     for root, dirs, files in os.walk(root_dir):
#         dirs[:] = [x for x in dirs
#                    if x[0] != '.' and
#                    os.path.abspath(os.path.join(root, x)) not in ignore_dirs]
# 
#         for resource in files:
#             full = os.path.join(root, resource)
#             if ignore_re and ignore_re.match(full):
#                 continue
# 
#             stat = os.stat(full)
#             mtime = stat.st_mtime
#             if _win:
#                 mtime -= stat.st_ctime
# 
#             found[full] = int(mtime)
# 
#     if found != _mtimes:
#         _mtimes = found.copy()
#         return True
# 
#     return False


# Path: statirator/core/management/commands/serve.py
import os
import re
import time
import threading
import BaseHTTPServer
import SimpleHTTPServer
import SocketServer
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import NoArgsCommand, BaseCommand
from optparse import make_option
from statirator.core.utils import filesystem_changed
        from django.conf import settings

                    self.shutdown()
        finally:
            os.chdir(curr_dir)

    def shutdown(self):
        print("\nShutting down")
        self._shutdown = True
        self.httpd_server.shutdown()
        self.httpd_thread.join()

    def filesystem_watcher(self):
        lock = threading.Lock()


        ignore_re = None
        to_ignore = ['\.pyc']

        pipeline_css = getattr(settings, 'PIPELINE_CSS', None)
        for k, v in pipeline_css.iteritems():
            source_filenames = v.get('source_filenames', [])
            for res in source_filenames:
                if res.endswith('.less'):
                    to_ignore.append(res.replace('.less', '\.css'))

        if to_ignore:
            ignore_re = re.compile('.*(' + '|'.join(to_ignore) + ')$')

        def watch():
            while not self._shutdown:
                with lock:

                    if filesystem_changed(