aboutsummaryrefslogtreecommitdiff
blob: 5f3ea9f0955665c459614ab923905a6c8e3d404c (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
#!/usr/bin/python
# Copyright 2010 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

def main(args):

	if args and sys.hexversion < 0x3000000 and not isinstance(args[0], unicode):
		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)