#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The Purity library for Pure Data dynamic patching.
#
# Copyright 2009 Alexandre Quessy
# <alexandre@quessy.net>
# http://alexandre.quessy.net
#
# Purity is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Purity is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the gnu general public license
# along with Purity.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Starts Pure Data with the Purity dynamic patching patch. 

Blocking.
"""
from rats.purity import server
from optparse import OptionParser
from twisted.internet import reactor

if __name__ == "__main__":
    parser = OptionParser(usage="%prog [options]")
    # parser.add_option("-p", "--patch", type="string", help="Pure Data Patch to open.", default=default_patch)
    (options, args) = parser.parse_args()
    # patch = options.patch
    pd = server.PureData()
    success = pd.start()
    try:
        reactor.run()
    except KeyboardInterrupt, e:
        print "Bye."

