GeoscienceAustralia / eqrm

Automatically exported from code.google.com/p/eqrm
Other
5 stars 4 forks source link

SVN revision number - excess reporting #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1.Windows PC 

2.run check_scenarios.py on a PC with TortoiseSVN installed

Everytime the code queries the SVN revision number you get the following output.
SubWCRev: 'O:\earthquake\sandpits\vanessa\eqrm'
Last committed at revision 1120
Updated to revision 1127

This is not an error. just more detail than we want.

Original issue reported on code.google.com by Vanessa....@gmail.com on 29 May 2012 at 4:56

GoogleCodeExporter commented 9 years ago
When get_version() is run on Windows it calls out to the Tortoise SVN command 
'SubWCRev.exe'. This produces the output in the description above to stdout, 
which is ignored.

Changing the call out to 'SubWCRev.exe' to use the subprocess module, which 
allows the setting of stdout to a file descriptor. In this case the file 
descriptor will be os.devnull as the output does not need to be captured.

The existing logic to check for a non-zero error code can be replicated like so:

    # Run conversion
    cmd = ['SubWCRev.exe', '.', file_in, file_out]
    fnull = open(os.devnull, 'w') 
    try:
        # Suppress stdout and stderr by piping to devnull
        subprocess.check_call(cmd, stdout=fnull, stderr=fnull)
        fnull.close()
    except:
        fnull.close()
        # Delete files

The rest of the function is the same as before.

Original comment by b...@girorosso.com on 29 May 2012 at 5:08

GoogleCodeExporter commented 9 years ago
This is implemented in revision 1132.

Original comment by b...@girorosso.com on 29 May 2012 at 5:40