예제 #1
0
def cleanup(conffile=None, force=False):
    if not force:
        print "WARNING:"
        print "The cleanup script will delete all folders created by MCP, including the"
        print "src folder which may contain changes you made to the code."
        answer = raw_input('If you really want to clean up, enter "Yes" ')
        if answer.lower() not in ["yes"]:
            print 'You have not entered "Yes", aborting the clean up process'
            sys.exit(1)

    commands = Commands(conffile)
    commands.checkupdates()

    commands.logger.info("> Cleaning temp")
    try:
        reallyrmtree(commands.dirtemp)
    except OSError:
        commands.logger.error("failed cleaning temp")

    commands.logger.info("> Cleaning src")
    try:
        reallyrmtree(commands.dirsrc)
    except OSError:
        commands.logger.error("failed cleaning src")

    commands.logger.info("> Cleaning bin")
    try:
        reallyrmtree(commands.dirbin)
    except OSError:
        commands.logger.error("failed cleaning bin")

    commands.logger.info("> Cleaning reobf")
    try:
        reallyrmtree(commands.dirreobf)
    except OSError:
        commands.logger.error("failed cleaning reobf")

    commands.logger.info("> Cleaning jars")
    try:
        reallyrmtree(os.path.join(commands.dirjars, "saves"))
    except OSError:
        commands.logger.error("failed cleaning saves")
    try:
        reallyrmtree(os.path.join(commands.dirjars, "texturepacks"))
    except OSError:
        commands.logger.error("failed cleaning texturepacks")
    try:
        reallyrmtree(os.path.join(commands.dirjars, "world"))
    except OSError:
        commands.logger.error("failed cleaning world")
    if os.path.exists(os.path.join(commands.dirjars, "server.log")):
        os.remove(os.path.join(commands.dirjars, "server.log"))
    for txt_file in glob.glob(os.path.join(commands.dirjars, "*.txt")):
        os.remove(txt_file)

    commands.logger.info("> Cleaning logs")
    logging.shutdown()
    reallyrmtree(commands.dirlogs)
예제 #2
0
def cleanup(conffile, force, distclean):
    try:
        commands = Commands(conffile, shortstart=True)

        if not force:
            print 'WARNING:'
            print 'The cleanup script will delete all folders created by MCP, including the'
            print 'src folder which may contain changes you made to the code, along with any'
            print 'saved worlds from the client or server.'
            answer = raw_input('If you really want to clean up, enter "Yes" ')
            if answer.lower() not in ['yes']:
                print 'You have not entered "Yes", aborting the clean up process'
                sys.exit(1)

        commands.checkupdates()

        try:
            commands.logger.info('> Cleaning temp')
            reallyrmtree(commands.dirtemp)

            commands.logger.info('> Cleaning src')
            reallyrmtree(commands.dirsrc)

            commands.logger.info('> Cleaning bin')
            reallyrmtree(commands.dirbin)

            commands.logger.info('> Cleaning reobf')
            reallyrmtree(commands.dirreobf)

            if distclean:
                commands.logger.info('> Cleaning lib')
                reallyrmtree(commands.dirlib)

            commands.logger.info('> Cleaning jars')
            reallyrmtree(os.path.join(commands.dirjars, 'stats'))
            reallyrmtree(os.path.join(commands.dirjars, 'texturepacks'))
            reallyrmtree(os.path.join(commands.dirjars, 'texturepacks-mp-cache'))            
            if distclean:
                reallyrmtree(os.path.join(commands.dirjars, 'saves'))
                reallyrmtree(os.path.join(commands.dirjars, 'mcpworld'))
                reallyrmtree(os.path.join(commands.dirjars, 'versions'))                
                reallyrmtree(os.path.join(commands.dirjars, 'assets'))                                
                reallyrmtree(os.path.join(commands.dirjars, 'libraries'))                
            if os.path.exists(os.path.join(commands.dirjars, 'server.log')):
                os.remove(os.path.join(commands.dirjars, 'server.log'))
            for txt_file in glob.glob(os.path.join(commands.dirjars, '*.txt')):
                os.remove(txt_file)

            commands.logger.info('> Cleaning logs')
            logging.shutdown()
            reallyrmtree(commands.dirlogs)
        except OSError as ex:
            print >> sys.stderr, 'Cleanup FAILED'
            if hasattr(ex, 'filename'):
                print >> sys.stderr, 'Failed to remove ' + ex.filename
            sys.exit(1)
    except Exception:  # pylint: disable-msg=W0703
        logging.exception('FATAL ERROR')
        sys.exit(1)
예제 #3
0
def cleanup(conffile, force):
    try:
        commands = Commands(conffile)

        if not force:
            print 'WARNING:'
            print 'The cleanup script will delete all folders created by MCP, including the'
            print 'src folder which may contain changes you made to the code, along with any'
            print 'saved worlds from the client or server.'
            answer = raw_input('If you really want to clean up, enter "Yes" ')
            if answer.lower() not in ['yes']:
                print 'You have not entered "Yes", aborting the clean up process'
                sys.exit(1)

        commands.checkupdates()

        try:
            commands.logger.info('> Cleaning temp')
            reallyrmtree(commands.dirtemp)

            commands.logger.info('> Cleaning src')
            reallyrmtree(commands.dirsrc)

            commands.logger.info('> Cleaning bin')
            reallyrmtree(commands.dirbin)

            commands.logger.info('> Cleaning reobf')
            reallyrmtree(commands.dirreobf)

            commands.logger.info('> Cleaning jars')
            reallyrmtree(os.path.join(commands.dirjars, 'saves'))
            reallyrmtree(os.path.join(commands.dirjars, 'stats'))
            reallyrmtree(os.path.join(commands.dirjars, 'texturepacks'))
            reallyrmtree(os.path.join(commands.dirjars, 'world'))
            if os.path.exists(os.path.join(commands.dirjars, 'server.log')):
                os.remove(os.path.join(commands.dirjars, 'server.log'))
            for txt_file in glob.glob(os.path.join(commands.dirjars, '*.txt')):
                os.remove(txt_file)

            commands.logger.info('> Cleaning logs')
            logging.shutdown()
            reallyrmtree(commands.dirlogs)
        except OSError as ex:
            print >> sys.stderr, 'Cleanup FAILED'
            if hasattr(ex, 'filename'):
                print >> sys.stderr, 'Failed to remove ' + ex.filename
            sys.exit(1)
    except Exception:  # pylint: disable-msg=W0703
        logging.exception('FATAL ERROR')
        sys.exit(1)
예제 #4
0
def cleanup(conffile=None, force=False):
    if not force:
        print 'WARNING:'
        print 'The cleanup script will delete all folders created by MCP, including the'
        print 'src folder which may contain changes you made to the code.'
        answer = raw_input('If you really want to clean up, enter "Yes" ')
        if answer.lower() not in ['yes']:
            print 'You have not entered "Yes", aborting the clean up process'
            sys.exit(1)

    commands = Commands(conffile)
    commands.checkupdates()

    commands.logger.info('> Cleaning temp')
    try:
        reallyrmtree(commands.dirtemp)
    except OSError:
        commands.logger.error('failed cleaning temp')

    commands.logger.info('> Cleaning src')
    try:
        reallyrmtree(commands.dirsrc)
    except OSError:
        commands.logger.error('failed cleaning src')

    commands.logger.info('> Cleaning bin')
    try:
        reallyrmtree(commands.dirbin)
    except OSError:
        commands.logger.error('failed cleaning bin')

    commands.logger.info('> Cleaning reobf')
    try:
        reallyrmtree(commands.dirreobf)
    except OSError:
        commands.logger.error('failed cleaning reobf')

    commands.logger.info('> Cleaning jars')
    try:
        reallyrmtree(os.path.join(commands.dirjars, 'saves'))
    except OSError:
        commands.logger.error('failed cleaning saves')
    try:
        reallyrmtree(os.path.join(commands.dirjars, 'texturepacks'))
    except OSError:
        commands.logger.error('failed cleaning texturepacks')
    try:
        reallyrmtree(os.path.join(commands.dirjars, 'world'))
    except OSError:
        commands.logger.error('failed cleaning world')
    if os.path.exists(os.path.join(commands.dirjars, 'server.log')):
        os.remove(os.path.join(commands.dirjars, 'server.log'))
    for txt_file in glob.glob(os.path.join(commands.dirjars, '*.txt')):
        os.remove(txt_file)

    commands.logger.info('> Cleaning logs')
    logging.shutdown()
    reallyrmtree(commands.dirlogs)