From d427adf0f29f819eae26fda5dee22e099dd96238 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 21 Oct 2010 18:13:33 -0700 Subject: AsynchronousLock: use subprocess if no threads --- bin/lock-helper.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/lock-helper.py (limited to 'bin') diff --git a/bin/lock-helper.py b/bin/lock-helper.py new file mode 100755 index 000000000..5c332b2af --- /dev/null +++ b/bin/lock-helper.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +# Copyright 2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +import sys +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') + + 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) -- cgit v1.2.3-1-g7c22