Ejemplo n.º 1
0
    def buildPCSPipeline(self, compileInstaller=False, pyc=True, removePY=True, removePYC=True):
        """ main pipeline build and push process
			Params: 
				compileInstaller: try to compile APEinstaller.exe
				pyc: create .pyc files in source first
				removePY: remove .py files on network build location
				removePYC: remove local .pyc files in source
			Returns: True/False
		"""
        completeSuccess = True

        # TODO: run unitTself.pipeBuildself.pipeBuildself.pipeBuildests

        # 		# hack gVarInit
        # 		self.swapGVarInit(direction='REMOTE')
        #
        # 		#TODO: Compile APE
        # 		self.compileAPE()
        #
        # 		# swap back
        # 		self.p4.p4RevertFile()
        ##		self.swapGVarInit(direction='PCS')

        # create pyc
        if pyc:
            if not self.createPYCfiles(self.pipelineSourceLocation):
                completeSuccess = False

                # copy to network
        if self.remoteBuild:
            # build for remote delivery
            if not self.pushToNetwork(self.buildDest, remote=True):
                completeSuccess = False
            if removePY:
                if not _KEEP_NETWORK_PY:
                    if not self.removePYfiles(pathToScrape=self.buildDest):
                        completeSuccess = False

                        # make Mobu/Maya startup files writable
            for pyFile in Path(self.buildDest).walkfiles("*py"):
                if "pcsGlobalSetup.py" in pyFile or "gVarInit.py" in pyFile or "sysGlobalMenu.py" in pyFile:
                    # make non-readOnly
                    pyFile.makeWritable()

                    # make PCSstudio.xml writable too
            pcsStudioXML = Path("%s/installData/PCSstudio.xml" % self.buildDest)
            if pcsStudioXML.exists():
                pcsStudioXML.makeWritable(_dir=False)

                # clean
            self.clean(self.buildDest)

        else:
            # push to local network
            if not self.pushToNetwork(self.networkLoc, remote=False):
                completeSuccess = False

            if removePY:
                if not _KEEP_NETWORK_PY:
                    if not self.removePYfiles(pathToScrape=self.networkLoc):
                        completeSuccess = False

        if removePYC:
            if not self.removePYfiles(pathToScrape=self.pipelineSourceLocation, optionalExt=".pyc"):
                completeSuccess = False

                # provide reminder
        print "Remember to remove unneeded:\n./schemas/.\n\nand change:\n./installData/PCSstudio.xml\n./python/maya/maya/sysGlobalMenu.py\n./python/moBu/startup/pcsGlobalSetup.py\n./python/common/core/gVarInit.py"

        # TODO: email T.A.

        print "********************************************"
        print "*** Build complete."
        print "********************************************"
        logger.info("********************************************")
        logger.info("*** Build complete.")
        logger.info("********************************************")

        return completeSuccess
    def buildPCSPipeline(self,
                         compileInstaller=False,
                         pyc=True,
                         removePY=True,
                         removePYC=True):
        ''' main pipeline build and push process
			Params: 
				compileInstaller: try to compile APEinstaller.exe
				pyc: create .pyc files in source first
				removePY: remove .py files on network build location
				removePYC: remove local .pyc files in source
			Returns: True/False
		'''
        completeSuccess = True

        #TODO: run unitTself.pipeBuildself.pipeBuildself.pipeBuildests

        #		# hack gVarInit
        #		self.swapGVarInit(direction='REMOTE')
        #
        #		#TODO: Compile APE
        #		self.compileAPE()
        #
        #		# swap back
        #		self.p4.p4RevertFile()
        ##		self.swapGVarInit(direction='PCS')

        # create pyc
        if pyc:
            if not self.createPYCfiles(self.pipelineSourceLocation):
                completeSuccess = False

        # copy to network
        if self.remoteBuild:
            # build for remote delivery
            if not self.pushToNetwork(self.buildDest, remote=True):
                completeSuccess = False
            if removePY:
                if not _KEEP_NETWORK_PY:
                    if not self.removePYfiles(pathToScrape=self.buildDest):
                        completeSuccess = False

            # make Mobu/Maya startup files writable
            for pyFile in Path(self.buildDest).walkfiles('*py'):
                if "pcsGlobalSetup.py" in pyFile or "gVarInit.py" in pyFile or "sysGlobalMenu.py" in pyFile:
                    # make non-readOnly
                    pyFile.makeWritable()

            # make PCSstudio.xml writable too
            pcsStudioXML = Path('%s/installData/PCSstudio.xml' %
                                self.buildDest)
            if pcsStudioXML.exists():
                pcsStudioXML.makeWritable(_dir=False)

            # clean
            self.clean(self.buildDest)

        else:
            # push to local network
            if not self.pushToNetwork(self.networkLoc, remote=False):
                completeSuccess = False

            if removePY:
                if not _KEEP_NETWORK_PY:
                    if not self.removePYfiles(pathToScrape=self.networkLoc):
                        completeSuccess = False

        if removePYC:
            if not self.removePYfiles(pathToScrape=self.pipelineSourceLocation,
                                      optionalExt='.pyc'):
                completeSuccess = False

        # provide reminder
        print "Remember to remove unneeded:\n./schemas/.\n\nand change:\n./installData/PCSstudio.xml\n./python/maya/maya/sysGlobalMenu.py\n./python/moBu/startup/pcsGlobalSetup.py\n./python/common/core/gVarInit.py"

        #TODO: email T.A.

        print "********************************************"
        print "*** Build complete."
        print "********************************************"
        logger.info("********************************************")
        logger.info("*** Build complete.")
        logger.info("********************************************")

        return completeSuccess