Package liveusb
[hide private]
[frames] | no frames]

Source Code for Package liveusb

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright © 2008  Red Hat, Inc. All rights reserved. 
 4  # 
 5  # This copyrighted material is made available to anyone wishing to use, modify, 
 6  # copy, or redistribute it subject to the terms and conditions of the GNU 
 7  # General Public License v.2.  This program is distributed in the hope that it 
 8  # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the 
 9  # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10  # See the GNU General Public License for more details.  You should have 
11  # received a copy of the GNU General Public License along with this program; if 
12  # not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 
13  # Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks that are 
14  # incorporated in the source code or documentation are not subject to the GNU 
15  # General Public License and may only be used or replicated with the express 
16  # permission of Red Hat, Inc. 
17  # 
18  # Author(s): Luke Macken <lmacken@redhat.com> 
19   
20  import os 
21  import sys 
22  import gettext 
23   
24  if os.path.exists('locale'): 
25      translation = gettext.translation('liveusb-creator', 'locale', fallback=True) 
26  else: 
27      translation = gettext.translation('liveusb-creator', '/usr/share/locale', 
28                                        fallback=True) 
29  _ = translation.ugettext 
30   
31 -def utf8_gettext(string):
32 " Translate string, converting it to a UTF-8 encoded bytestring " 33 return _(string).encode('utf8')
34 35 from liveusb.creator import LiveUSBError 36 37 if sys.platform == "win32": 38 from liveusb.creator import WindowsLiveUSBCreator as LiveUSBCreator 39 from liveusb.windows_dialog import Ui_Dialog as LiveUSBInterface 40 else: 41 if os.getuid() != 0: 42 print >> sys.stderr, _("You must run this application as root") 43 sys.exit(1) 44 from liveusb.creator import LinuxLiveUSBCreator as LiveUSBCreator 45 from liveusb.linux_dialog import Ui_Dialog as LiveUSBInterface 46 47 __all__ = ("LiveUSBCreator", "LiveUSBError", "LiveUSBDialog", "_", "utf8_gettext") 48