Changeset a35b458 in mainline for tools/mktmpfs.py


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/mktmpfs.py

    r3061bc1 ra35b458  
    6969def recursion(root, outf):
    7070        "Recursive directory walk"
    71        
     71
    7272        for item in listdir_items(root):
    7373                if item.is_file:
     
    7777                        dentry.fname = item.name.encode('ascii')
    7878                        dentry.flen = item.size
    79                        
     79
    8080                        outf.write(dentry.pack())
    81                        
     81
    8282                        for data in chunks(item, 4096):
    8383                                outf.write(data)
    84                
     84
    8585                elif item.is_dir:
    8686                        dentry = xstruct.create(DENTRY_DIRECTORY % len(item.name))
     
    8888                        dentry.fname_len = len(item.name)
    8989                        dentry.fname = item.name.encode('ascii')
    90                        
     90
    9191                        outf.write(dentry.pack())
    92                        
     92
    9393                        recursion(item.path, outf)
    94                        
     94
    9595                        dentry = xstruct.create(DENTRY_NONE)
    9696                        dentry.kind = TMPFS_NONE
    9797                        dentry.fname_len = 0
    98                        
     98
    9999                        outf.write(dentry.pack())
    100100
     
    103103                usage(sys.argv[0])
    104104                return
    105        
     105
    106106        path = os.path.abspath(sys.argv[1])
    107107        if (not os.path.isdir(path)):
    108108                print("<PATH> must be a directory")
    109109                return
    110        
     110
    111111        outf = open(sys.argv[2], "wb")
    112        
     112
    113113        header = xstruct.create(HEADER)
    114114        header.tag = b"TMPFS"
    115        
     115
    116116        outf.write(header.pack())
    117        
     117
    118118        recursion(path, outf)
    119        
     119
    120120        dentry = xstruct.create(DENTRY_NONE)
    121121        dentry.kind = TMPFS_NONE
    122122        dentry.fname_len = 0
    123        
     123
    124124        outf.write(dentry.pack())
    125        
     125
    126126        outf.close()
    127        
     127
    128128if __name__ == '__main__':
    129129        main()
Note: See TracChangeset for help on using the changeset viewer.