def getAllIdleName(self, item_config_path=''): if item_config_path == '': proj_root = utils.getMainConfig('project_root') if proj_root == None: item_config_path = utils.getMainConfig('config_input_path') else: item_config_path = os.path.join(proj_root, "svn", "config") item_hero = os.path.join(item_config_path, "item.hero.xlsx") item_npc = os.path.join(item_config_path, "item.npc.xlsx") self.getIdleNameList(item_hero) self.getIdleNameList(item_npc) pass
def runflash_dev(options): logger.setLevel(options['debug'] and logging.DEBUG or logging.INFO) mut.dumpOptions(options, logger) input_root = mut.getProjectConfig('input_root') rtool_root = mut.getProjectConfig('rtool_root') output_root = mut.getProjectConfig('output_root') cache_dir = mut.getProjectConfig('cache_dir') if options['path'] == '': options['path'] = rtool_root if options['input'] == '': options['input'] = os.path.join(input_root) if options['output'] == '': options['output'] = os.path.join(output_root) if options['cachedir'] == '': options['cachedir'] = cache_dir if options['game'] == '': options['game'] = mut.getMainConfig('project_name') options['dev'] = True options['norc'] = True options['all'] = True tp_task_ctx = TaskContext() tp_task_ctx.setOptions(options) # tp_task = TPTask(tp_task_ctx) tf = TaskFactory(tp_task_ctx) tp_task = tf.genTask(options['game']) tp_task.preAction(options) if not options['check']: tp_task.execAction(options) tp_task.postAction(options)
def genCfg(self, option): anim_cfg_path = os.path.join(utils.getMainConfig('project_root'), 'svn', 'config') logger.debug("Gen Anim Idle List From " + anim_cfg_path) self.getAllIdleName(anim_cfg_path) self.cfg = self.idle_name_list if not option.has_key(self.cfg_name): option[self.cfg_name] = [] option[self.cfg_name] = self.cfg pass
def run(cmd_name): project_name = utils.getMainConfig('project_name') self_dir = os.path.dirname(os.path.abspath(__file__)) project_cmd_path = os.path.join(self_dir, 'projects', project_name, 'cmd_extend.py') project_cmd_dir = os.path.join(self_dir,'projects', project_name) print(project_cmd_path) # if os.path.exists(project_cmd_path): from rtool.projects.tkw import cmd_extend cmd_extend = importlib.import_module('rtool.projects.'+project_name+'.cmd_extend', package=None) if cmd_name == 'cfg': if project_name == "demos": cmd_extend.export_config_dev() else: cmd_extend.export_config() pass if cmd_name == 'checksame': if project_name == "demos": cmd_extend.check_same_filename() else: print("checksame is not implemented")
def genTask(self, project_name=None): task_name = self.ctx.taskName options = self.ctx.options if not project_name: project_name = mut.getMainConfig('project_name') if project_name: dir_list = [] pwd = os.path.dirname(os.path.abspath(__file__)) rtool_dir = os.path.dirname(pwd) project_dir = os.path.join(rtool_dir, 'projects', project_name) print("project_dir" + project_dir) dir_list.append(project_dir) file, pathname, dec = imp.find_module("task", dir_list) task_module = imp.load_module("task", file, pathname, dec) return task_module.getInstance(self.ctx) pass
options['cachedir']='' options['game']='' input_root = mut.getProjectConfig('input_root') rtool_root = mut.getProjectConfig('rtool_root') output_root = mut.getProjectConfig('output_root') cache_dir = mut.getProjectConfig('cache_dir') if options['path'] == '': options['path'] = rtool_root if options['input'] == '': options['input'] = os.path.join(input_root) if options['output'] == '': options['output'] = os.path.join(output_root) if options['cachedir'] =='': options['cachedir'] = cache_dir if options['game'] == '': options['game'] = mut.getMainConfig('project_name') svn_path = "/data/work/Assets" options['svn'] = svn_path options['svn_commit'] = '33734' options['last_svn_commit'] = '33733' options['target']='iOS' blc = BaseLocalChange(options) # blc.diff_dict = all_file_as_added_dict # print blc.getYamlDiffDict() # print blc.getResDiffDict() blc.processDiff() print("diff list") print(blc.diff_list) print("modified dir list") print(blc.modified_dir_list) # print "modified ncfg list"
import tempfile import pymysql import json import shutil import sqlite3 from rtool.tasks.Base import Base from rtool.tasks.BasePostAction import output_to_temp from rtool.tasks.BaseStatus import BaseStatus from rtool import utils from rtool.pcutils.md5sum_of_path import md5_for_str from rtool.pcutils.md5sum_of_path import md5_for_file from rtool.pcutils.md5sum_of_path import md5sum_of_path from rtool.pcutils.md5sum_of_path import md5sum_of_dir from rtool.pcutils.md5sum_of_path import uni_id_for_res RC_ADDRESS = utils.getMainConfig().get("RC_ADDRESS", "") RC_ROOT = utils.getMainConfig().get( "RC_ROOT", "/data/home/user00/service/resource_center") # SECRETS_FILE = "/etc/rsyncd.secrets" # WORKER_USER = "******" logger = utils.getLogger("BaseSync") RSYNC_TEMPLATE = "rsync -avzP $src $dst " RSYNC_TEMPLATE_WITH_EXCLUDE = "rsync -avzP --exclude $exclude $src $dst " MAKE_RC_DIR_TMEPLATE = "ssh $rc_address 'mkdir -p $rc_dir'" DB_CONFIG = { "host": "172.16.153.49", "port": 51000, "user": "******", "password": "******", "db": "asset_vega" }
def get_config(self, key): return get_options or utils.getProjectConfig(key) or utils.getMainConfig(key)
CONTEXT_SETTINGS = dict(auto_envvar_prefix='RESLIB', help_option_names=['-h', '--help']) @click.group(context_settings=CONTEXT_SETTINGS) def main(**options): """rtool 工具集""" print(sys.version) print(sys.version_info) pass from rtool import utils import os import sys import importlib # import project's cmd_extend project_name = utils.getMainConfig('project_name') self_dir = os.path.dirname(os.path.abspath(__file__)) project_cmd_path = os.path.join(self_dir, 'projects', project_name, 'cmd_extend.py') if os.path.exists(project_cmd_path): cmd_extend = importlib.import_module('rtool.projects.' + project_name + '.cmd_extend', package=None) cmd_extend.run(main) if __name__ == '__main__': main()