This function is used to check if $DIR is present in the binary path. If it is there then replace it with module.
(binary_path)
| 441 | |
| 442 | |
| 443 | def replace_binary_path(binary_path): |
| 444 | """ |
| 445 | This function is used to check if $DIR is present in |
| 446 | the binary path. If it is there then replace it with |
| 447 | module. |
| 448 | """ |
| 449 | if "$DIR" in binary_path: |
| 450 | # When running as an WSGI application, we will not find the |
| 451 | # '__file__' attribute for the '__main__' module. |
| 452 | main_module_file = getattr( |
| 453 | sys.modules['__main__'], '__file__', None |
| 454 | ) |
| 455 | |
| 456 | if main_module_file is not None: |
| 457 | binary_path = binary_path.replace( |
| 458 | "$DIR", os.path.dirname(main_module_file) |
| 459 | ) |
| 460 | |
| 461 | return binary_path |
| 462 | |
| 463 | |
| 464 | def add_value(attr_dict, key, value): |
no test coverage detected