tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mach_commands.py (1262B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 from mach.decorators import Command
      6 
      7 
      8 @Command(
      9    "gen-use-counter-metrics",
     10    category="misc",
     11    description="Generate a Glean use_counter_metrics.yaml file, creating metrics definitions for every use counter.",
     12 )
     13 def gen_use_counter_metrics(command_context):
     14    # Dispatch to usecounters.py
     15    import sys
     16    from os import path
     17 
     18    sys.path.append(path.dirname(__file__))
     19    from usecounters import gen_use_counter_metrics
     20 
     21    return gen_use_counter_metrics()
     22 
     23 
     24 @Command(
     25    "gen-uuid",
     26    category="misc",
     27    description="Generate a uuid suitable for use in xpidl files and/or in C++",
     28 )
     29 def gen_uuid(command_context):
     30    import uuid
     31 
     32    uuid_str = str(uuid.uuid4())
     33    print(uuid_str)
     34    print()
     35 
     36    stuff = uuid_str.split("-")
     37    print(f"{{ 0x{stuff[0]}, 0x{stuff[1]}, 0x{stuff[2]}, \\")
     38    print(f"  {{ 0x{stuff[3][0:2]}, 0x{stuff[3][2:4]}, ", end="")
     39    print(f"0x{stuff[4][0:2]}, 0x{stuff[4][2:4]}, ", end="")
     40    print(f"0x{stuff[4][4:6]}, 0x{stuff[4][6:8]}, ", end="")
     41    print(f"0x{stuff[4][8:10]}, 0x{stuff[4][10:12]} }} }}")