getvar 548 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python3
  2. import common
  3. parser = common.get_argparse(argparse_args={
  4. 'description': '''Print the value of a common.py variable.
  5. This is useful to:
  6. * give dry commands on the README that don't change when we refactor directory structure
  7. * create simple bash scripts that call use common.py variables
  8. For example, to get the Buildroot output directory for an ARM build, use:
  9. ....
  10. ./%(prog)s -a arm buildroot_build_dir
  11. ....
  12. '''
  13. })
  14. parser.add_argument('variable')
  15. args = common.setup(parser)
  16. print(getattr(common, args.variable))