create_init_py.py 464 B

123456789101112
  1. import os
  2. def oncreate_init_py_structure(unit, *args):
  3. if unit.get('DISTBUILD') or unit.get('AUTOCHECK'):
  4. return
  5. target_dir = unit.get('PY_PROTOS_FOR_DIR')
  6. path_list = target_dir.split(os.path.sep)[1:]
  7. inits = [os.path.join("${ARCADIA_BUILD_ROOT}", '__init__.py')]
  8. for i in range(1, len(path_list) + 1):
  9. inits.append(os.path.join("${ARCADIA_BUILD_ROOT}", os.path.join(*path_list[0:i]), '__init__.py'))
  10. unit.ontouch(inits)