Changes in tools/dest_build.py [a35b458:0a0b3d8] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/dest_build.py

    ra35b458 r0a0b3d8  
    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.