diff options
author | Brian Dolbec <dolsen@gentoo.org> | 2012-11-11 17:32:14 -0800 |
---|---|---|
committer | Brian Dolbec <dolsen@gentoo.org> | 2012-11-11 23:22:25 -0800 |
commit | 729f667ac9db835ac800b698dd01c436162d8a65 (patch) | |
tree | 5397ca8fb0400ea3960148724e259858e03de160 /bin | |
parent | update manpage, this and the previous commit fix bug 442654 (diff) | |
download | mirrorselect-729f667ac9db835ac800b698dd01c436162d8a65.tar.gz mirrorselect-729f667ac9db835ac800b698dd01c436162d8a65.tar.bz2 mirrorselect-729f667ac9db835ac800b698dd01c436162d8a65.zip |
move main.py into site-packages, create and use a minimal script to start it.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mirrorselect | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/bin/mirrorselect b/bin/mirrorselect new file mode 100755 index 0000000..ef3b6af --- /dev/null +++ b/bin/mirrorselect @@ -0,0 +1,65 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- + + +"""Mirrorselect 2.x + Tool for selecting Gentoo source and rsync mirrors. + +Copyright 2005-2012 Gentoo Foundation + + Copyright (C) 2005 Colin Kingsley <tercel@gentoo.org> + Copyright (C) 2008 Zac Medico <zmedico@gentoo.org> + Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org> + Copyright (C) 2009 Christian Ruppert <idl0r@gentoo.org> + +Distributed under the terms of the GNU General Public License v2 + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +""" + +from __future__ import print_function + + + + +import sys + +# This block ensures that ^C interrupts are handled quietly. +try: + import signal + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + print('Caught signal %s. Exiting' % signum) + sys.exit(1) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + +except KeyboardInterrupt: + print() + sys.exit(1) + + +from mirrorselect.main import main + +try: + main(sys.argv) +except KeyboardInterrupt: + print("Aborted.") + sys.exit(130) +sys.exit(0) + |