Beispiel #1
0
def start_task(command):
  # Check if we are using windows API, and if it is windows mobile
  if windowsAPI != None and windowsAPI.MobileCE:
    windowsAPI.launchPythonScript(command[0], command[1])

  # If not, use the portable_popen.Popen interface.
  else:
    portable_popen.Popen(command)
Beispiel #2
0
def exec_repy_script(filename, restrictionsfile, arguments={}, script_args=''):
    global mobileNoSubprocess

    if script_args != '':
        script_args = ' ' + script_args

    if not mobileNoSubprocess:
        # Convert arguments
        arg_string = arguments_to_string(arguments)

        return exec_command('python repy.py ' + arg_string + restrictionsfile +
                            ' ' + filename + script_args)
    else:
        if os.path.isfile(repy_constants.PATH_SEATTLE_INSTALL +
                          "execlog.out.old"):
            os.remove(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.old")
        if os.path.isfile(repy_constants.PATH_SEATTLE_INSTALL +
                          "execlog.out.new"):
            os.remove(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.new")

        # Set default values
        arguments.setdefault("logfile", "execlog.out")
        arguments.setdefault("cwd",
                             "\"" + repy_constants.PATH_SEATTLE_INSTALL + "\"")

        # Convert arguments
        arg_string = arguments_to_string(arguments)

        repy_path = "\"" + repy_constants.PATH_SEATTLE_INSTALL + "repy.py" + "\""
        cmd = arg_string + restrictionsfile + " \"" + repy_constants.PATH_SEATTLE_INSTALL + filename + "\"" + script_args
        #print cmd
        childpid = windowsAPI.launchPythonScript(repy_path, cmd)

        # Wait for Child to finish execution
        windowsAPI.waitForProcess(childpid)

        time.sleep(5)

        if os.path.isfile(repy_constants.PATH_SEATTLE_INSTALL +
                          "execlog.out.old"):
            theout = file(
                repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.old", "r")
            output = theout.read()
            theout.close()
        else:
            output = ''

        return (output, '')
Beispiel #3
0
def exec_repy_script(filename, restrictionsfile, arguments={}, script_args=''):
  global mobileNoSubprocess
  
  if script_args != '':
    script_args = ' ' + script_args
  
  if not mobileNoSubprocess:
    # Convert arguments
    arg_string = arguments_to_string(arguments)
    
    return exec_command('python repy.py ' + arg_string + restrictionsfile + ' ' + filename + script_args)
  else:
    if os.path.isfile(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.old"):
      os.remove(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.old")
    if os.path.isfile(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.new"):
      os.remove(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.new")      

    # Set default values
    arguments.setdefault("logfile", "execlog.out")
    arguments.setdefault("cwd", "\"" + repy_constants.PATH_SEATTLE_INSTALL + "\"")
    
    # Convert arguments
    arg_string = arguments_to_string(arguments)
      
    repy_path =  "\"" + repy_constants.PATH_SEATTLE_INSTALL + "repy.py" + "\""
    cmd = arg_string + restrictionsfile + " \"" + repy_constants.PATH_SEATTLE_INSTALL + filename + "\"" + script_args
    #print cmd
    childpid = windowsAPI.launchPythonScript(repy_path, cmd)
    
    # Wait for Child to finish execution
    windowsAPI.waitForProcess(childpid)
    
    time.sleep(5)

    if os.path.isfile(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.old"):
        theout = file(repy_constants.PATH_SEATTLE_INSTALL + "execlog.out.old", "r")
        output = theout.read()
        theout.close()
    else:
        output = ''
    
    return (output, '')