mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
39 lines
900 B
Python
Executable File
39 lines
900 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import types
|
|
|
|
import common
|
|
|
|
parser = self.get_argparse(argparse_args={
|
|
'description': '''Print the value of a kwargs['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 kwargs['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
|
|
....
|
|
....
|
|
'''
|
|
})
|
|
parser.add_argument('variable', nargs='?')
|
|
args = self.setup(parser)
|
|
if kwargs['variable']:
|
|
print(getattr(common, kwargs['variable']))
|
|
else:
|
|
for attr in dir(common):
|
|
if not attr.startswith('__'):
|
|
val = getattr(common, attr)
|
|
if not callable(val) and not type(val) is types.ModuleType:
|
|
print('{} {}'.format(attr, val))
|