Changeset a35b458 in mainline for tools/dest_build.py


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 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/dest_build.py

    r3061bc1 ra35b458  
    4242def duplicate_tree(src_path, dest_path, current):
    4343        "Duplicate source directory tree in the destination path"
    44        
     44
    4545        for name in os.listdir(os.path.join(src_path, current)):
    4646                if name in exclude_names:
    4747                        next
    48                
     48
    4949                following = os.path.join(current, name)
    5050                src = os.path.join(src_path, following)
     
    5252                dest_parent = os.path.join(dest_path, current)
    5353                dest_stat = os.stat(src)
    54                
     54
    5555                # Create shadow directories
    5656                if stat.S_ISDIR(dest_stat.st_mode):
    5757                        if not os.path.exists(dest):
    5858                                os.mkdir(dest)
    59                        
     59
    6060                        if not os.path.isdir(dest):
    6161                                raise IOError(errno.ENOTDIR, "Destination path exists, but is not a directory", dest)
    62                        
     62
    6363                        duplicate_tree(src_path, dest_path, following)
    6464                else:
    6565                        # Compute the relative path from destination to source
    6666                        relative = os.path.relpath(src, dest_parent)
    67                        
     67
    6868                        # Create symlink
    6969                        if not os.path.exists(dest):
     
    7878                usage(sys.argv[0])
    7979                return 1
    80        
     80
    8181        # Source tree path
    8282        src_path = os.path.abspath(sys.argv[1])
     
    8484                print("<SRC_PATH> must be a directory")
    8585                return 2
    86        
     86
    8787        # Destination tree path
    8888        dest_path = os.path.abspath(sys.argv[2])
    8989        if not os.path.exists(dest_path):
    9090                os.mkdir(dest_path)
    91        
     91
    9292        if not os.path.isdir(dest_path):
    9393                print("<DEST_PATH> must be a directory")
    9494                return 3
    95        
     95
    9696        # Duplicate source directory tree
    9797        duplicate_tree(src_path, dest_path, "")
    98        
     98
    9999        # Run the build from the destination tree
    100100        os.chdir(dest_path)
    101101        args = ["make"]
    102102        args.extend(sys.argv[3:])
    103        
     103
    104104        return subprocess.Popen(args).wait()
    105105
Note: See TracChangeset for help on using the changeset viewer.