diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-10-21 18:13:33 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-11-23 17:37:10 -0800 |
commit | d427adf0f29f819eae26fda5dee22e099dd96238 (patch) | |
tree | d472eb540b7016eeb09b92d5abd747c5156bcbdf /bin | |
parent | bbce62ccae17b6db10ecd99e76589b7174f63f55 (diff) | |
download | portage-d427adf0f29f819eae26fda5dee22e099dd96238.tar.gz portage-d427adf0f29f819eae26fda5dee22e099dd96238.tar.bz2 portage-d427adf0f29f819eae26fda5dee22e099dd96238.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) |