예제 #1
0
    def onMenu(self, node):
        name = node.name
        if name == 'deploy_manager':
            self.onSetFocus()

        elif name == 'deploy_build':
            app.getProject().deploy()
예제 #2
0
파일: DeployManager.py 프로젝트: pixpil/gii
	def onMenu( self, node ):
		name = node.name
		if name == 'deploy_manager' :
			self.onSetFocus()

		elif name == 'deploy_build':
			app.getProject().deploy()
예제 #3
0
def run(target, *args, **options):
    global _terminating
    _terminating = False
    project = app.getProject()
    assert project.isLoaded()

    os.chdir(project.getBasePath())
    bin = project.getBinaryPath(app.getPlatformName() + '/moai')

    script = 'game/%s.lua' % target

    arglist = [bin, script]
    arglist += args
    returncode = 0
    try:
        pipeline = sarge.run(arglist, async=True)
        while True:
            time.sleep(0.05)
            command = pipeline.commands[0]
            returncode = command.poll()
            if returncode != None:
                break
            if _terminating:
                command.kill()
                returncode = -1
                break
        # pipeline.close()
        # returncode = command.poll()
    except Exception, e:
        logging.error('cannot start host: %s ' % e)
        return 1
예제 #4
0
def main(argv):
    interpreter = sys.executable
    args = argv[1:]
    # if len( args ) < 1:
    # 	print 'no script specified'
    # 	return 0
    cwd = os.getcwd()
    try:
        app.openProject()
        projectExtPath = app.getProject().getBinaryPath('python')
        addEnvPath('PYTHONPATH', projectExtPath, True)
        #add project binary into path
    except Exception as ex:
        pass

    os.chdir(cwd)

    l = [interpreter] + args
    if not os.path.exists(interpreter):
        print('python interperter not found')
        return -1

    try:
        code = subprocess.call(l)
    except Exception as ex:
        print(ex)
        return -1

    return code
예제 #5
0
파일: RunHost.py 프로젝트: pixpil/gii
def run( target, *args, **options ):
	global _terminating
	_terminating = False
	project = app.getProject()
	assert project.isLoaded()

	os.chdir( project.getBasePath() )
	bin = project.getBinaryPath( app.getPlatformName() + '/moai' )

	script = 'game/%s.lua' % target
	
	arglist = [
		bin,
		script
	]
	arglist += args
	returncode = 0
	try:
		pipeline = sarge.run( arglist, async = True )
		while True:
			time.sleep( 0.05 )
			command = pipeline.commands[0]
			returncode = command.poll()
			if returncode != None:
				break
			if _terminating:
				command.kill()
				returncode = -1
				break
		# pipeline.close()
		# returncode = command.poll()
	except Exception, e:
		logging.error( 'cannot start host: %s ' % e)
		return 1
예제 #6
0
def run(**option):
    FNULL = open(os.devnull, 'wb')
    project = app.getProject()
    assert project.isLoaded()
    os.chdir(project.getHostPath())
    # if option.get( 'clean-bin', False ):
    # 	if sys.platform == 'darwin':
    # 		pass
    # 	else:
    # 		pass
    # 		#TODO
    # 	return 0

    arglist = []
    arglist += [app.getPythonPath(), app.getPath('support/waf/waf')]

    #check configure
    code = subprocess.call(arglist + ['list'], stdout=FNULL, stderr=FNULL)
    if code != 0:
        code = subprocess.call(arglist + ['configure'])
        if code != 0:
            logging.error('cannot configure building ')
            return -1

    if option.get('verbose', False):
        arglist.append('-v')

    if option.get('configure', False):
        subprocess.call(arglist + ['configure'])

    elif option.get('clean', False):
        arglist.append('clean')
        code = subprocess.call(arglist)

    else:
        targets = option.get('targets', ['osx'])
        if targets == 'native':
            if sys.platform == 'darwin':
                targets = ['osx', 'python']
            else:
                targets = ['win', 'python']
        config = option.get('profile', 'debug')
        for target in targets:
            suffix = '-%s-%s' % (target, config)
            arglist += ['build' + suffix]
            arglist += ['install' + suffix]
            try:
                code = subprocess.call(arglist)
                if code != 0:
                    logging.error('abnormal return code: %d ' % code)
                    return code
                else:
                    print '%s building completed' % target
                    return 0
            except Exception, e:
                logging.error('cannot build host: %s ' % e)
                return -1
예제 #7
0
파일: Build.py 프로젝트: pixpil/gii
def run( **option ):
	FNULL = open(os.devnull, 'wb')
	project = app.getProject()
	assert project.isLoaded()
	os.chdir( project.getHostPath() )
	# if option.get( 'clean-bin', False ):
	# 	if sys.platform == 'darwin':
	# 		pass	
	# 	else:
	# 		pass
	# 		#TODO	
	# 	return 0

	arglist = []
	arglist += [ app.getPythonPath(), app.getPath( 'support/waf/waf' ) ]

	#check configure
	code = subprocess.call( arglist + ['list'], stdout = FNULL, stderr = FNULL )
	if code != 0:
		code = subprocess.call( arglist + ['configure'] )
		if code != 0:
			logging.error( 'cannot configure building ' )
			return -1

	if option.get( 'verbose', False ):
		arglist.append( '-v' )
	
	if option.get( 'configure', False ):
		subprocess.call( arglist + ['configure'] )

	elif option.get( 'clean', False ):
		arglist.append( 'clean' )
		code = subprocess.call( arglist )

	else:
		targets = option.get( 'targets', [ 'osx' ] )
		if targets == 'native':
			if sys.platform == 'darwin':
				targets = [ 'osx', 'python' ]
			else:
				targets = [ 'win', 'python' ]		
		config = option.get( 'profile', 'debug' )
		for target in targets:
			suffix = '-%s-%s' % ( target, config )
			arglist += [ 'build' + suffix ]
			arglist += [ 'install' + suffix ]
			try:
				code = subprocess.call( arglist )
				if code!=0:
					logging.error( 'abnormal return code: %d ' % code)
					return code
				else:
					print '%s building completed' % target
					return 0
			except Exception, e:
				logging.error( 'cannot build host: %s ' % e)
				return -1
예제 #8
0
	def loadRepos( self ):
		repos = {}
		reposSettingApp = app.getUserSetting( 'svn_remote', {} )
		for k,v in reposSettingApp.items():
			repos[ k ] = v

		prj = app.getProject()
		if prj:
			reposSettingPrj = prj.getUserSetting( 'svn_remote', {} )
			for k,v in reposSettingPrj.items():
				repos[ k ] = v
		self.repos = repos
예제 #9
0
파일: IOSDevice.py 프로젝트: pixpil/gii
 def __init__(self, deviceItem):
     tool = app.getPath('support/deploy/ios-deploy')
     arglist = [tool]
     localPath = app.getProject().getHostPath(
         'ios/build/Release-iphoneos/YAKA.app')
     arglist += ['--id', deviceItem.getId()]
     arglist += ['--bundle', localPath]
     arglist += ['--debug']
     try:
         code = subprocess.call(arglist)
         if code != 0: return code
     except Exception as e:
         logging.error('error in debugging device: %s ' % e)
         return -1
예제 #10
0
    def onMenu(self, node):
        name = node.name
        if name == 'deploy_manager':
            self.onSetFocus()

        elif name == 'deploy_build':
            config = app.getProject().getDeployConfig(
                self.activeDeployConfigName)
            if config:
                config.execute()

        else:
            if name.startswith('choose_deploy_target_'):
                self.selectActiveDeployConfig(node.deployConfigName)
예제 #11
0
    def loadFilters(self):
        filterConfig = {}
        reposSettingApp = app.getUserSetting('scene_group_filter', {})
        for k, v in list(reposSettingApp.items()):
            filterConfig[k] = v

        prj = app.getProject()
        if prj:
            reposSettingPrj = prj.getProjectSetting('scene_group_filter', {})
            for k, v in list(reposSettingPrj.items()):
                filterConfig[k] = v

            reposSettingPrjUser = prj.getUserSetting('scene_group_filter', {})
            for k, v in list(reposSettingPrjUser.items()):
                filterConfig[k] = v

        filters = []
        for key, config in filterConfig.items():
            name = config.get('name', None)
            if not name:
                name = key

            incStr = config.get('include', None)
            inc = False
            if incStr:
                inc = [a.strip() for a in incStr.split(',')]

            excStr = config.get('exclude', None)
            exc = False
            if excStr:
                exc = [a.strip() for a in excStr.split(',')]

            data = {
                'id': key,
                'name': name,
                'include': inc,
                'exclude': exc,
            }

            filters.append(data)

        self.filters = filters
예제 #12
0
파일: Build.py 프로젝트: pixpil/gii
def run( **option ):
	FNULL = open(os.devnull, 'wb')
	project = app.getProject()
	assert project.isLoaded()
	os.chdir( project.getHostPath() )
	# if option.get( 'clean-bin', False ):
	# 	if sys.platform == 'darwin':
	# 		pass	
	# 	else:
	# 		pass
	# 		#TODO	
	# 	return 0
	buildEnv = os.environ.copy()
	globalBuildEnv = app.getUserSetting( 'build_env', None )
	if globalBuildEnv:
		for k, v in globalBuildEnv.items():
			buildEnv[ k ] = v
	projectBuildEnv = project.getUserSetting( 'build_env', None )
	if projectBuildEnv:
		for k, v in projectBuildEnv.items():
			buildEnv[ k ] = v

	buildEnv[ 'JOBS' ] = '8'
	WAFCmd = [ app.getPythonPath(), app.getPath( 'support/common/%s/waf' % WAF_NAME ) ]
	def callWAF( cmd, *args, **kwargs ):
		kwargs[ "env" ] = buildEnv
		if isinstance( cmd, list ):
			arglist = WAFCmd + cmd + list( args )
		else:
			arglist = WAFCmd + [ cmd ] + list( args )
		return subprocess.call( arglist, **kwargs )

	#check configure
	# code = callWAF( 'list', stdout = FNULL, stderr = FNULL )
	# if code != 0:
	# 	code = callWAF( 'configure' )
	# 	if code != 0:
	# 		logging.error( 'cannot configure building ' )
	# 		return -1

	#main body
	building = True
	cmds = []
	args = []
	
	#misc settings
	if option.get( 'verbose', False ):
		args.append( '-v' )

	args.append( '-j%d' % max( 2, multiprocessing.cpu_count()) )
	#configure
	if option.get( 'configure', False ):
		return callWAF( 'configure', *args )

	#commands
	if option.get( 'clean', False ):
		cmds += [ 'clean' ]

	if option.get( 'dist', False ):
		cmds += [ 'dist' ]

	if option.get( 'project', False ):
		cmds += [ 'project' ]

	else:
		if option.get( 'build', True ):
			cmds += [ 'build' ]

		if option.get( 'install', True ):
			cmds += [ 'install' ]


	targets = option.get( 'targets', [ 'host' ] )		

	if isinstance( targets, str ):
		targets = [ targets ]

	#expand native
	if 'host' in targets:
		targets.remove( 'host' )
		if platform.system() == 'Darwin':
			if not ( 'osx' in targets ):
				targets.append( 'osx' )
				
		elif platform.system() == 'Windows':
			if not ( 'win' in targets ):
				targets.append( 'win' )

		elif platform.system() == 'Linux':
			if not ( 'linux' in targets ):
				targets.append( 'linux' )

	if 'native' in targets:
		targets.remove( 'native' )
		if platform.system() == 'Darwin':
			if not ( 'osx' in targets ):
				targets.append( 'osx' )
			if not ( 'python' in targets ):
				targets.append( 'python' )
				
		elif platform.system() == 'Windows':
			if not ( 'win' in targets ):
				targets.append( 'win' )
			if not ( 'python' in targets ):
				targets.append( 'python' )

		elif platform.system() == 'Linux':
			if not ( 'linux' in targets ):
				targets.append( 'linux' )

	build_type = option.get( 'build_type', 'debug' )

	cmdList = []
	for target in targets:
		contextName = '%s-%s' % ( target, build_type )
		suffix = '-' + contextName
		for cmd in cmds:
			cmdList += [ cmd + suffix ]
	print( cmdList )
	return callWAF( cmdList, *args )