diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-10-21 18:13:33 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-10-21 18:13:33 -0700 |
commit | 72298bcb48e432011d56143525adb642bd18f1d4 (patch) | |
tree | a3b2bcd8538db2ddec5c5ff8a3d623209ef7fc78 /bin | |
parent | f2d7564b93b4c5387fe82d8a8561b6420c04dee7 (diff) | |
download | portage-72298bcb48e432011d56143525adb642bd18f1d4.tar.gz portage-72298bcb48e432011d56143525adb642bd18f1d4.tar.bz2 portage-72298bcb48e432011d56143525adb642bd18f1d4.zip |
AsynchronousLock: use subprocess if no threads
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/lock-helper.py | 23 |
1 files changed, 23 insertions, 0 deletions
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) |