create_init_py.py 478 B

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