(self, src, dst)
Sort contents of src file, write them to dst file.
Sort contents of src file, write them to dst file.
Sort contents of src file write them to dst file .
def do_sort(self, src, dst):
        """ Sort contents of src file, write them to dst file. """

        p = subprocess.Popen(["sort", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        s_ver = p.communicate()[0]
        del p

        xenv = os.environ.copy()
        xenv['LANG'] = 'C'
        xenv['LC_ALL'] = 'C'

        cmdline = ['sort', '-T', '.']
        if s_ver.find("coreutils") > 0:
            cmdline.append('-S')
            cmdline.append('30%')
        cmdline.append('-o')
        cmdline.append(dst)
        cmdline.append(src)
        p = subprocess.Popen(cmdline, env = xenv)
        if p.wait() != 0:
            raise Exception('sort failed')
def do_sort ( self , src , dst ) : p = subprocess . Popen ( [ "sort" , "--version" ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) s_ver = p . communicate ( ) [ 0 ] del p xenv = os . environ . copy ( ) xenv [ 'LANG' ] = 'C' xenv [ 'LC_ALL' ] = 'C' cmdline = [ 'sort' , '-T' , '.' ] if s_ver . find ( "coreutils" ) > 0 : cmdline . append ( '-S' ) cmdline . append ( '30%' ) cmdline . append ( '-o' ) cmdline . append ( dst ) cmdline . append ( src ) p = subprocess . Popen ( cmdline , env = xenv ) if p . wait ( ) != 0 : raise Exception ( 'sort failed' )