Changeset df3f85f in mainline for tools


Ignore:
Timestamp:
2012-05-23T12:03:26Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
692be1ae, 8ad5470, f7e69f5
Parents:
c196671 (diff), 67435b1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge GSOC-originated patches

Merge from lp:~vojtech-horky/helenos/misc.

The merge includes:

  • Switching to previous directory with `cd -' in Bdsh
  • Interactive mode for cp module in Bdsh
  • Implementation of sleep command
  • printf and echo for Bdsh
  • Rewrite of the mkdir module
  • Ctrl-arrow jumps over words in the editor
  • The scripts work with Python 3
Location:
tools
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • tools/checkers/clang.py

    rc196671 rdf3f85f  
    114114        for job in jobs:
    115115                if (not clang(rootdir, job)):
    116                         print
     116                        print()
    117117                        print("Failed job: %s" % job)
    118118                        return
  • tools/checkers/stanse.py

    rc196671 rdf3f85f  
    127127        for job in jobs:
    128128                if (not stanse(rootdir, job)):
    129                         print
     129                        print()
    130130                        print("Failed job: %s" % job)
    131131                        return
  • tools/checkers/vcc.py

    rc196671 rdf3f85f  
    204204        for job in jobs:
    205205                if (not vcc(vcc_path, rootdir, job)):
    206                         print
     206                        print()
    207207                        print("Failed job: %s" % job)
    208208                        return
    209209       
    210         print
     210        print()
    211211        print("All jobs passed")
    212212
  • tools/filldir.py

    rc196671 rdf3f85f  
    3737
    3838if len(sys.argv) < 3:
    39         print 'Usage: filldir <parent-dir> <count>'
     39        print('Usage: filldir <parent-dir> <count>')
    4040        exit(2)
    4141
  • tools/gentestfile.py

    rc196671 rdf3f85f  
    3636
    3737if len(sys.argv) < 2:
    38         print "Usage: gentestfile.py <count of 64-bit numbers to output>"
     38        print("Usage: gentestfile.py <count of 64-bit numbers to output>")
    3939        exit()
    4040
    41 m = long(sys.argv[1])
     41m = int(sys.argv[1])
    4242i = 0
    4343pow_2_64 = 2 ** 64
  • tools/mkfat.py

    rc196671 rdf3f85f  
    189189        "Filter FAT legal characters"
    190190       
    191         filtered_name = ''
     191        filtered_name = b''
    192192        filtered = False
    193193       
     
    205205       
    206206        ascii_name, lfn = fat_lchars(name)
    207         ascii_parts = ascii_name.split('.')
     207        # Splitting works only on strings, not on bytes
     208        ascii_parts = ascii_name.decode('utf8').split('.')
    208209       
    209210        short_name = ''
     
    444445        extra_bytes = int(sys.argv[1])
    445446       
    446         path = os.path.abspath(sys.argv[2].decode())
     447        path = os.path.abspath(sys.argv[2])
    447448        if (not os.path.isdir(path)):
    448449                print("<PATH> must be a directory")
  • tools/mkuimage.py

    rc196671 rdf3f85f  
    124124        header.img_type = 2             # Kernel
    125125        header.compression = 0          # None
    126         header.img_name = image_name
     126        header.img_name = image_name.encode('ascii')
    127127
    128128        header_crc = calc_crc32(header.pack())
     
    140140        signed_crc = zlib.crc32(byteseq, 0)
    141141        if signed_crc < 0:
    142                 return (long(signed_crc) + (long(2) ** long(32))) # 2^32L
     142                return signed_crc + (1 << 32)
    143143        else:
    144144                return signed_crc
     
    148148def print_syntax(cmd):
    149149        print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
    150         print
     150        print()
    151151        print("\traw_image\tInput image name (raw binary data)")
    152152        print("\tuImage\t\tOutput uImage name (U-Boot image)")
    153         print
     153        print()
    154154        print("options:")
    155155        print("\t-name <name>\tImage name (default: 'Noname')")
  • tools/xstruct.py

    rc196671 rdf3f85f  
    3232
    3333import struct
     34import sys
    3435import types
    3536
     37# Handle long integer conversions nicely in both Python 2 and Python 3
     38integer_types = (int, long) if sys.version < '3' else (int,)
     39
     40# Ensure that 's' format for struct receives correct data type depending
     41# on Python version (needed due to different way to encode into bytes)
     42ensure_string = \
     43        (lambda value: value if type(value) is str else bytes(value)) \
     44                if sys.version < '3' else \
     45        (lambda value: bytes(value, 'ascii') if type(value) is str else value)
     46
    3647ranges = {
    37         'B': ((int, long), 0x00, 0xff),
    38         'H': ((int, long), 0x0000, 0xffff),
    39         'L': ((int, long), 0x00000000, 0xffffffff),
    40         'Q': ((int, long), 0x0000000000000000, 0xffffffffffffffff),
    41         'b': ((int, long), -0x80, 0x7f),
    42         'h': ((int, long), -0x8000, 0x7fff),
    43         'l': ((int, long), -0x80000000, 0x7fffffff) ,
    44         'q': ((int, long), -0x8000000000000000, 0x7fffffffffffffff),
     48        'B': (integer_types, 0x00, 0xff),
     49        'H': (integer_types, 0x0000, 0xffff),
     50        'L': (integer_types, 0x00000000, 0xffffffff),
     51        'Q': (integer_types, 0x0000000000000000, 0xffffffffffffffff),
     52        'b': (integer_types, -0x80, 0x7f),
     53        'h': (integer_types, -0x8000, 0x7fff),
     54        'l': (integer_types, -0x80000000, 0x7fffffff) ,
     55        'q': (integer_types, -0x8000000000000000, 0x7fffffffffffffff),
    4556}
    4657
     
    7485                                        args.append(item)
    7586                        else:
     87                                if (fmt == "s"):
     88                                        value = ensure_string(value)
    7689                                check_range(variable, fmt, value)
    7790                                args.append(value)             
Note: See TracChangeset for help on using the changeset viewer.