1#!/usr/bin/env python 2 3# -*- coding: utf-8 -*- 4 5# #################################################################### 6# Copyright (C) 2005-2019 by the FIFE team 7# http://www.fifengine.net 8# This file is part of FIFE. 9# 10# FIFE is free software; you can redistribute it and/or 11# modify it under the terms of the GNU Lesser General Public 12# License as published by the Free Software Foundation; either 13# version 2.1 of the License, or (at your option) any later version. 14# 15# This library is distributed in the hope that it will be useful, 16# but WITHOUT ANY WARRANTY; without even the implied warranty of 17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18# Lesser General Public License for more details. 19# 20# You should have received a copy of the GNU Lesser General Public 21# License along with this library; if not, write to the 22# Free Software Foundation, Inc., 23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24# #################################################################### 25 26from __future__ import print_function 27import os 28import sys 29 30fife_path = os.path.join('..','..','engine','python','fife') 31if os.path.isdir(fife_path) and fife_path not in sys.path: 32 sys.path.insert(0,fife_path) 33 34from fife import fife 35print("Using the FIFE python module found here: ", os.path.dirname(fife.__file__)) 36 37from fife.extensions.fife_settings import Setting 38 39from scripts.fife_test import FifeTestApplication 40 41TDS = Setting(app_name="fife_test", settings_file="./settings.xml") 42 43def main(): 44 app = FifeTestApplication(TDS) 45 app.run() 46 47 48if __name__ == '__main__': 49 if TDS.get("FIFE", "ProfilingOn"): 50 import hotshot 51 import hotshot.stats 52 print("Starting profiler") 53 prof = hotshot.Profile("fife.prof") 54 prof.runcall(main) 55 prof.close() 56 print("analysing profiling results") 57 stats = hotshot.stats.load("fife.prof") 58 stats.strip_dirs() 59 stats.sort_stats('time', 'calls') 60 stats.print_stats(20) 61 else: 62 main() 63