Support MAIN keyword in PY_SRCS.
PY_SRCS(MAIN x/y.py)
in a/b/ya.make means
PY_MAIN(a.b.x.y)
PY_SRCS(x/y.py)
@@ -189,6 +189,10 @@ def onpy_srcs(unit, *args):
pass
# Sources.
else:
+ main_mod = arg == 'MAIN'
+ if main_mod:
+ arg = next(args)
+
if '=' in arg:
path, mod = arg.split('=', 1)
else:
@@ -200,6 +204,9 @@ def onpy_srcs(unit, *args):
ymake.report_configure_error('PY_SRCS item starts with "../": {!r}'.format(arg))
mod = ns + stripext(arg).replace('/', '.')
+ if main_mod:
+ unit.onpy_main(mod)
+
pathmod = (path, mod)
if path.endswith('.py'):
@@ -379,6 +386,10 @@ def onpy3_srcs(unit, *args):
pass
# Sources.
else:
+ main_mod = arg == 'MAIN'
+ if main_mod:
+ arg = next(args)
+
if '=' in arg:
path, mod = arg.split('=', 1)
else:
@@ -390,6 +401,9 @@ def onpy3_srcs(unit, *args):
ymake.report_configure_error('PY3_SRCS item starts with "../": {!r}'.format(arg))
mod = ns + stripext(arg).replace('/', '.')
+ if main_mod:
+ unit.onpy3_main(mod)
+
pathmod = (path, mod)
if path.endswith('.py'):
