Re: suggestion: implicit sys.stdout.flush with :print

Scott Harrison <harris41-mhe/[email protected]> 18 Jan 2004 07:12:26 -0500
Newsgroups gmane.comp.tools.aap.devel
Organization Michigan State University
Message-ID <[email protected]>
> > Would it make sense to make an implicit
> > sys.stdout.flush() with :print commands? 
> Output to a terminal should be automatically flushed at each newline.
> In which situation do you see a problem with viewing the output?

In the example below, at the end of it where I have a commented
out sys.stdout.flush().

check { comment = Check for system dependencies necessary to run
$APPNAME }: \
  posix_check operating_system_dependencies

posix_check { comment = See if it is a posix system } :
  :print Checking for posix operating system...
  ostypevar = $OSTYPE
  expected = $EXPECTED_OSTYPE
  @if ostypevar == expected :
    :print Posix system [OK]
  @else:
    :print ERROR: $APPNAME can only be installed on posix systems
    :print $( )      such as linux, BSD, or Mac OS/X; note that
    :print $( )      $RECOMMENDED_OS are recommended (tested)
    :print Quitting on error.
    :exit

operating_system_dependencies \
  { comment = Analyze the operating system and dependencies} :
  :print Checking for recommended operating systems $(RECOMMENDED_OS)...
  recommended_os_semaphore = 0
  # Gather info regarding FreeBSD 4.9
  @ok, uname_s = redir_system("uname -s",0)
  @ok, uname_r = redir_system("uname -r",0)
  @uname_s = uname_s[:-1]
  # Gather info regarding Mandrake 9.2  
  @mdkfile = file2string("/etc/mandrake-release", {"MESSAGE" : ""})
  @macXfile =
file2string("/System/Library/CoreServices/SystemVersion.plist", \
                          {"MESSAGE" : ""})
  # Test for FreeBSD 4.9
  @if uname_s == "FreeBSD" and uname_r.find(" 4.9") :
    :print Recommended operating system FreeBSD 4.9 found [OK]
    recommended_os_semaphore = 1
  # Test for Mandrake 9.2
  @elif mdkfile.find("Mandrake") >= 0 and mdkfile.find(" 9.2 ") :
    :print Recommended operating system Mandrake 9.2 found [OK]
    recommended_os_semaphore = 1
  # Test for Mac 10.3
  @elif 1==0 and macXfile and macXfile.find("1sdfsdfsdf03") :
    :print Recommended operating system Mac 10.3 found [OK]
    :print $macXfile
    recommended_os_semaphore = 1
  @else :
    :print WARNING You are installing $APPNAME on something other than
    :print $(RECOMMENDED_OS)
    :print *********************************************************
    :print Please be advised that $APPNAME requires a significant
    :print level of dependencies and that recommended installation
    :print procedures for alternative operating systems and versions
    :print may be more difficult to follow.  You have a posix
    :print style operating system, so it is doable, but not currently
    :print recommended (or directly supported by the developers right
    :print now).
    :print *********************************************************
    :print (Press the enter key to continue)
    # Need to uncomment the line below, otherwise the user sees nothing
    # and blindly has to hit the enter key.
    # @sys.stdout.flush()
    @r = raw_input()

-- 
Scott Harrison <harris41-mhe/[email protected]>
Michigan State University



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn