Files
linux-kernel-module-cheat/getvar
Ciro Santilli 六四事件 法轮功 3ce152f61c test-gdb: move to pure python calls
2019-01-22 00:00:00 +00:00

44 lines
970 B
Python
Executable File

#!/usr/bin/env python3
import common
class Main(common.LkmcCliFunction):
def __init__(self):
super().__init__(
defaults={
'print_time': False,
},
description='''\
Print the value of a self.env['py'] variable.
This is useful to:
* give dry commands on the README that don't change when we refactor directory structure
* create simple bash scripts that call use self.env['py'] variables
For example, to get the Buildroot output directory for an ARM build, use:
....
./%(prog)s -a arm buildroot_build_dir
....
List all available variables:
....
./%(prog)s
....
''',
)
self.add_argument('variable', nargs='?')
def timed_main(self):
variable = self.env['variable']
if variable:
print(self.env[variable])
else:
for key in self.env:
print('{}={}'.format(key, self.env[key]))
if __name__ == '__main__':
Main().cli()