Ejemplo n.º 1
0
    def locate_directory( self, arg_cmd_switch, arg_envar, arg_default ):

        Msg.dbg( "arg_cmd_switch[%s], arg_envar[%s], arg_default[%s]" % (str(arg_cmd_switch), str(arg_envar), arg_default))
        my_tmp = self.option_def( arg_cmd_switch, None)
        # Msg.user( "Result Path: %s" % ( str( my_tmp )))

        if my_tmp is None:
            if arg_envar is not None:
                # Not passed on the command line check for envar and the default
                my_tmp = SysUtils.envar( arg_envar, arg_default, False )
            else:
                my_tmp = arg_default
            # If a relative path has been provided either in the environmental var or as the default that path needs
            # to be appended to the module path. Since all full paths begin with a path delimiter this is a valid test
            if my_tmp[0] != "/":
                my_tmp = PathUtils.include_trailing_path_delimiter( self.module_dir ) + my_tmp

        # OK here is where it gets a bit tricky, when passed on the command line the path is calculated from the
        # current directory, in all other cases from the module path. Since the app should be in the initial directory
        # calculating the real path should resolve to a fully qualified path. To remove all indirection use real path
        my_tmp = PathUtils.real_path( my_tmp )

        # At this point the path should be a fully qualified path
        # Msg.user( "Result Path: %s" % ( str( my_tmp )))
        #
        Msg.user( "Result Path: %s" % ( str( my_tmp )))
        if not PathUtils.valid_path( my_tmp ):
            raise FileNotFoundError( "Initial Directory for %s Resolution Failed[%s] could not be located" % ( arg_cmd_switch, my_tmp ))

        if not PathUtils.check_exe( my_tmp ):
            my_tmp = PathUtils.include_trailing_path_delimiter( my_tmp )

        return my_tmp
Ejemplo n.º 2
0
    def __init__(self, aCmdLineOptions):
        super().__init__(FpixCmdLineOptions.cOptions, aCmdLineOptions)

        fpix_path = self.mAppParameters.parameter("fpix_path")
        if not PathUtils.check_exe(fpix_path):
            raise Exception(
                fpix_path +
                " does not exist or is not executable, condirm valid exe")
Ejemplo n.º 3
0
    def __init__(self, aCmdLineOptions):
        super().__init__(FpixCmdLineOptions.cOptions, aCmdLineOptions)

        #TODO add checks for ISS so file as well as for Fpix executable
        fpix_path = self.mAppParameters.parameter('fpix_path')
        if not PathUtils.check_exe(fpix_path):
            raise Exception(
                fpix_path +
                " does not exist or is not executable, condirm valid exe")
Ejemplo n.º 4
0
    def initialize_processor_cmd( self ):

        # the default task processor is "forrest_run.py"
        # the default directory is the same directory as the master_run
        # the processor can be replaced with a command line argument which may or may not contain a path
        # if it does not contain a path then the default path will be used
        # if a directory is passed on the command line in all cases that will be the location of the processor
        my_run_dir  = None
        my_run_name = None
        my_tmp_name = None
        my_tmp_path = None

        my_run_path = self.option_def( CmdLine.Switches[CmdLine.run_name], None )

        if my_run_path is not None:
            my_run_dir, my_run_name = PathUtils.split_path( my_run_path )
            Msg.user( "Client Dir: %s, Client Name: %s (1)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )

        if my_run_dir is None:
            my_tmp_path = self.locate_directory( CmdLine.Switches[CmdLine.run_dir], EnVars.run_path, self.module_dir)
            # Msg.user( "Temp Path: [%s] (1)" % (str(my_tmp_path)), "PROCESS_CMD" )

            if PathUtils.check_exe( my_tmp_path ):
                my_run_dir, my_tmp_name = PathUtils.split_path( my_tmp_path )
                # Msg.user( "Client Dir: %s, Client Name: %s (2)" % (str(my_run_dir), str(my_tmp_name)), "PROCESS_CMD" )
            else:
                my_run_dir = my_tmp_path
                # Msg.user( "Client Dir: %s, Client Name: %s (3)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )

        if my_run_name is None:
            my_run_name = my_tmp_name if my_tmp_name is not None else Defaults.run_name

        # Msg.user( "Client Dir: %s, Client Name: %s (4)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )
        my_process_cmd = PathUtils.real_path( PathUtils.append_path( PathUtils.include_trailing_path_delimiter( my_run_dir ), my_run_name  ))
        Msg.user( "Process Cmd: %s (1)" % (str(my_process_cmd)), "PROCESS_CMD" )

        my_msg_lev = self.option_def( CmdLine.Switches[CmdLine.client_lev], None)

        if my_msg_lev is not None :
            if my_msg_lev == True:
                my_process_cmd += Msg.get_level_as_str()
                # Msg.user( "Process Cmd: %s (2)" % (str(my_process_cmd)), "PROCESS_CMD" )

            else :
                my_process_cmd += " -l " + my_msg_lev
                Msg.user( "Process Cmd: %s" % (str(my_process_cmd)), "PROCESS_CMD" )

        if self._mAppsInfo.mConfigPath is not None:
            my_process_cmd += " -w %s" % self._mAppsInfo.mConfigPath
        my_process_cmd += " -f %s"

        self.processor_name = my_run_name.replace( ".py", "" ).replace( "_run", "" )
        self.process_cmd = my_process_cmd

        Msg.dbg( "Process Cmd: %s" % (str(self.process_cmd)))
Ejemplo n.º 5
0
    def __init__(self, aCmdLineOptions):
        super().__init__(FrunToCtrlCmdLineOptions.cOptions, aCmdLineOptions)

        if self.mAppParameters.parameter('frun-to-ctrl'):
            frun_to_ctrl_path = PathUtils.include_trailing_path_delimiter(
                aCmdLineOptions.mProgramPath
            ) + "../frun_to_ctrl/frun_to_ctrl.py"

            if not PathUtils.check_exe(frun_to_ctrl_path):
                raise Exception(
                    frun_to_ctrl_path +
                    " does not exist or is not executable, confirm valid exe")
            frun_to_ctrl_path = PathUtils.real_path(frun_to_ctrl_path)
            self.mAppParameters.setParameter('path', frun_to_ctrl_path)
Ejemplo n.º 6
0
    def __init__(self, aCmdLineOptions):
        super().__init__(ForceCmdLineOptions.cOptions, aCmdLineOptions)

        force_path = self.mAppParameters.parameter("path")
        force_bin_dir, _ = PathUtils.split_path(force_path)
        force_dir = PathUtils.real_path(
            PathUtils.include_trailing_path_delimiter(force_bin_dir) + "../"
        )

        if not PathUtils.check_exe(force_path):
            raise Exception(force_path + " does not exist or is not executable, confirm valid exe")

        # determine svn revision information and store as a parameter
        version_data = VersionCtrlUtils.get_scm_revisions(force_dir)
        version_output = VersionCtrlUtils.get_version_output(version_data)

        Msg.info("Force Version Data:\n%s" % version_output)

        self.mAppParameters.setParameter("version", version_data)
        self.mAppParameters.setParameter("version_dir", force_dir)
Ejemplo n.º 7
0
    def __init__(self, aCmdLineOptions):
        super().__init__(ForceCmdLineOptions.cOptions, aCmdLineOptions)

        force_path = self.mAppParameters.parameter('path')
        force_bin_dir, _ = PathUtils.split_path(force_path)
        force_dir = PathUtils.real_path(
            PathUtils.include_trailing_path_delimiter(force_bin_dir) + '../')

        if not PathUtils.check_exe(force_path):
            raise Exception(
                force_path +
                " does not exist or is not executable, confirm valid exe")

        #determine svn revision information and store as a parameter
        version_info = VersionCtrlUtils.get_svn_revision(force_dir)
        if version_info[1] is not None:
            Msg.info("Failed to determine Force svn version: " +
                     version_info[1])
            self.mAppParameters.setParameter("version", -1)
        else:
            self.mAppParameters.setParameter("version", version_info[0])
        self.mAppParameters.setParameter("version_dir", force_dir)