# -*- coding: utf-8 -*-

# Copyright (c) 2007 Stas Zykiewicz <stas.zytkiewicz@gmail.com>
#
#           install.py
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License
# as published by the Free Software Foundation.  A copy of this license should
# be included in the file GPL-3.
#
# This program 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 Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Script to install childsplay
try:
    import sys,os,shutil,compileall,fnmatch
except RuntimeError,info:
    print "Trouble with standard python stuff, wicked"
    print "I'm gone..."
    sys.exit(1)
    
def check_versions():
    print " Checking pygame version..."
    try:
        import pygame
    except ImportError,info:
        print info
        print "Can't find pygame, you should first install pygame\nbefore installing childsplay"
        sys.exit(1)
    if  pygame.version.ver < '1.5.6':
        print "Your version of pygame is",pygame.version.ver
        print "This version of Childplay depends on pygame >= 1.5.6 and"
        print "will crash with lower versions of pygame."
        sys.exit(1)
    print " Pygame version ",pygame.version.ver
    del(pygame)
#    print " Checking for assetml..."
#    try:
#        import pyassetml
#    except ImportError,info:
#        print info
#        print "Can't find assetml, this version of childsplay depends on assetml."
#        print "You can get assetml at: http://ofset.org/assetml"
#        sys.exit(1)

    
#print sys.argv
if len(sys.argv) == 3:
    if sys.argv[1] == '--compile':
        try:
            compileall.compile_dir(sys.argv[2],quiet=1)
        except TypeError:
            compileall.compile_dir(sys.argv[2])
elif sys.argv[1] == '--checkversion':
    check_versions()

    


