aboutsummaryrefslogtreecommitdiff
blob: 128e4ddd0fa20f4e23e4ba70e89b359bdc6f7d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

import os
import sys
sys.path.insert(0, os.environ['PORTAGE_PYM_PATH'])
import portage
portage._internal_caller = True
portage._disable_legacy_globals()

def main(args):

	if args and isinstance(args[0], bytes):
		for i, x in enumerate(args):
			args[i] = portage._unicode_decode(x, errors='strict')

	# Make locks quiet since unintended locking messages displayed on
	# stdout would corrupt the intended output of this program.
	portage.locks._quiet = True
	lock_obj = portage.locks.lockfile(args[0], wantnewlockfile=True)
	sys.stdout.write('\0')
	sys.stdout.flush()
	sys.stdin.read(1)
	portage.locks.unlockfile(lock_obj)
	return portage.os.EX_OK

if __name__ == "__main__":
	rval = main(sys.argv[1:])
	sys.exit(rval)