1d8d2d382SMasahiro Yamada#!/usr/bin/env python3 251e46c7aSKees Cook# SPDX-License-Identifier: GPL-2.0+ 351e46c7aSKees Cook 42a14f021SMauro Carvalho Chehabimport os 52a14f021SMauro Carvalho Chehabimport sys 62a14f021SMauro Carvalho Chehab 7*fce6df7eSMauro Carvalho ChehabLIB_DIR = "lib" 8*fce6df7eSMauro Carvalho ChehabSRC_DIR = os.path.dirname(os.path.realpath(__file__)) 92a14f021SMauro Carvalho Chehab 10*fce6df7eSMauro Carvalho Chehabsys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) 11*fce6df7eSMauro Carvalho Chehab 12*fce6df7eSMauro Carvalho Chehabfrom jobserver import JobserverExec # pylint: disable=C0415 13*fce6df7eSMauro Carvalho Chehab 14*fce6df7eSMauro Carvalho Chehab 152a14f021SMauro Carvalho Chehab""" 16*fce6df7eSMauro Carvalho ChehabDetermines how many parallel tasks "make" is expecting, as it is 17*fce6df7eSMauro Carvalho Chehabnot exposed via an special variables, reserves them all, runs a subprocess 18*fce6df7eSMauro Carvalho Chehabwith PARALLELISM environment variable set, and releases the jobs back again. 192a14f021SMauro Carvalho Chehab 20*fce6df7eSMauro Carvalho ChehabSee: 21*fce6df7eSMauro Carvalho Chehab https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html#POSIX-Jobserver 222a14f021SMauro Carvalho Chehab""" 232a14f021SMauro Carvalho Chehab 242a14f021SMauro Carvalho Chehabdef main(): 252a14f021SMauro Carvalho Chehab """Main program""" 262a14f021SMauro Carvalho Chehab with JobserverExec() as jobserver: 272a14f021SMauro Carvalho Chehab jobserver.run(sys.argv[1:]) 282a14f021SMauro Carvalho Chehab 292a14f021SMauro Carvalho Chehab 302a14f021SMauro Carvalho Chehabif __name__ == "__main__": 312a14f021SMauro Carvalho Chehab main() 32