FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 06-01-2011, 01:18 PM
Martin Gracik
 
Default Improvements to loadkeys-stub

Related: rhbz#706099
---
command-stubs/loadkeys-stub | 41 +++++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/command-stubs/loadkeys-stub b/command-stubs/loadkeys-stub
index 1752717..2d1d434 100755
--- a/command-stubs/loadkeys-stub
+++ b/command-stubs/loadkeys-stub
@@ -2,7 +2,7 @@
#
# loadkeys-stub
#
-# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007, 2011 Red Hat, Inc. All rights reserved.
#
# 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
@@ -18,30 +18,35 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

-import os
import sys

-# for testing
-if (os.path.exists('isys')):
- sys.path.append('isys')
-
sys.path.append('/usr/lib/anaconda')
-
import isys

+
def usage():
- print "usage: %s keymap" %(sys.argv[0],)
- sys.exit(1)
+ return 'Usage: %prog <keymap>'
+
+
+def main(prog, args):

-def main():
- if len(sys.argv) != 2:
- usage()
+ def err(msg):
+ sys.stderr.write('%s: %s' % (prog, msg))
+ sys.exit(1)
+
+ if len(args) > 1:
+ err("extra operand '%s'" % args[1])
+
+ try:
+ keymap = args[0]
+ except IndexError:
+ err('missing operand')

try:
- isys.loadKeymap(sys.argv[1])
- except SystemError:
- pass
- sys.exit(0)
+ isys.loadKeymap(keymap)
+ except SystemError as e:
+ err(e)
+

-if __name__ == "__main__":
- main()
+if __name__ == '__main__':
+ main(prog=sys.argv[0], args=sys.argv[1:])
--
1.7.3.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 01:23 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org