Beispiel #1
0
    def GetPinTool(self, pinball):
        """
        Get the path to the pintool for the required architecture.

        If a pinball is given to the method, figures out the correct
        architecture for the pintool from the pinball.

        @param pinball Pinball kit is processing

        @return Path to the pintool for this kit
        """

        # import pdb;  pdb.set_trace()
        if os.path.isfile(os.path.realpath(self.pintool)):
            # If the pintool already has an explicit path, possible if the user has defined the pintool,
            # then just use it as is.
            #
            pintool_path = self.pintool
        else:
            # Otherwise, assume the tool is in the architecture dependent pintool directory.
            #
            if pinball:
                arch = util.FindArchitecture(pinball)
            else:
                arch = self.binary_type
            pintool_path = os.path.join(self.ArchSpecificDir(arch),
                                        self.pintool)

        return pintool_path
Beispiel #2
0
    def SetPinTool(self, user_pintool, pinball=''):
        """
        Set the pintool to the users tool instead of the default for this kit.

        User can give either an explicit path to the tool or put the tool in
        the architecture dependent directory.  In either case, check to make
        sure the pintool exists.

        @param user_pintool User defined pintool to use in this kit
        @param pinball Optional - pinball kit is processing

        @return
        """

        if os.path.isfile(os.path.realpath(user_pintool)):
            self.pintool = user_pintool
        else:
            # If pinball is given, use it to find the architecture specific directory,
            # othwise just use the parameter 'binary_type'.
            #
            if pinball:
                arch = util.FindArchitecture(pinball)
                tool = os.path.join(self.ArchSpecificDir(arch), user_pintool)
            else:
                tool = os.path.join(self.ArchSpecificDir(self.binary_type),
                                    user_pintool)
            if not os.path.isfile(os.path.realpath(tool)):
                msg.PrintAndExit('Could not find user defined pintool: ' +
                                 user_pintool)
            self.pintool = user_pintool
Beispiel #3
0
    def GetNullapp(self, basename):
        """
        Get the path to the nullapp for the required platform and architecture.

        @param basename Basename (file name w/o extension) of pinball to process

        @return Explicit path to nullapp
        """

        # Get explicit path to the correct nullapp for this arch.
        #
        arch = util.FindArchitecture(basename)
        nullapp_path = os.path.join(self.ArchSpecificDir(arch), self.nullapp)

        # import pdb;  pdb.set_trace()
        platform = util.Platform()
        if platform == config.WIN_CYGWIN:
            # Need to get path to nullapp using Windows format.  This is required
            # because SDE is a native Windows app and requires the path to be
            # in Windows format.  However, the path set above is in Cygwin format,
            # hence it must be converted.
            #
            try:
                nullapp_path = subprocess.check_output(
                    ['cygpath', '-w', nullapp_path])
            except (subprocess.CalledProcessError, OSError):
                msg.PrintAndExit(
                    'Could not get a valid Windows path from the Cygwin path to nullapp'
                )

            # Use forward slashes for the directory separator in the Windows path
            # (which is acceptable) because backslashes are treated as the escape character.
            #
            nullapp_path = nullapp_path.replace('\\', '/')
            nullapp_path = nullapp_path.rstrip()

        # Final check to ensure it's a valid nullapp binary
        #
        if not os.path.isfile(nullapp_path):
            msg.PrintAndExit('Unable to find valid nullapp')

        return nullapp_path