Skip to content

Comment Marco used by this project

Zhao Zhang edited this page Apr 29, 2018 · 1 revision

Comment Marcos, comments which have some functionality, are wildly used by this project.

  • First kind of usage is to point out third-party dependency of current .py file. By adding:
# DEPENDENCY( pip-packages )
# DEP_APT( apt-packages )

you can specify third-party dependency for current module. When you deploy different modules to different machines, overview.py can generate proper dependency installation commands for you based on these comment marcos.

  • Export python functions to control commands.

Our commands cache, $stock/cmd_core/cmd_parser.py is a python file generated by overview.py, overview.py simply scan all python files for comment marco like:

# CMDEXPORT ( exported_cmd_alias {cmd_param1} {cmd_param2} ) python_function_name_to_export

then generate proper python code for exporting functions.

  • TODOs and other marcos Since I don't like git and other tools for project management, I use comment marcos. Things like #TODO and #WINDOWS_NOT_GUARANTEE can be found everywhere in my project, and can be filter out by overview.py. Things like these make it easy to manage whole project.