install-i18n.py

changeset 12
1d8dd9706f46
parent 7
c679fb30c8f3
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
1 #!/usr/bin/env python 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2004 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> 4 # Copyright (c) 2004 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
5 # 5 #
6 # This is the install script for eric4's translation files. 6 # This is the install script for eric4's translation files.
12 import sys 12 import sys
13 import os 13 import os
14 import shutil 14 import shutil
15 import glob 15 import glob
16 16
17 import sip
18 sip.setapi("QString", 2)
19 sip.setapi("QVariant", 2)
20
21 from PyQt4.QtCore import QDir 17 from PyQt4.QtCore import QDir
22 18
23 try: 19 try:
24 from eric4config import getConfig 20 from .eric4config import getConfig
25 except ImportError: 21 except ImportError:
26 print "The eric4 IDE doesn't seem to be installed. Aborting." 22 print("The eric4 IDE doesn't seem to be installed. Aborting.")
27 sys.exit(1) 23 sys.exit(1)
28 24
29 def getConfigDir(): 25 def getConfigDir():
30 """ 26 """
31 Global function to get the name of the directory storing the config data. 27 Global function to get the name of the directory storing the config data.
57 53
58 @param rcode return code passed back to the calling process (integer) 54 @param rcode return code passed back to the calling process (integer)
59 """ 55 """
60 global progName, configDir 56 global progName, configDir
61 57
62 print 58 print()
63 print "Usage:" 59 print("Usage:")
64 print " %s [-hp]" % (progName) 60 print(" %s [-hp]" % (progName))
65 print "where:" 61 print("where:")
66 print " -h display this help message" 62 print(" -h display this help message")
67 print " -p install into the private area (%s)" % (configDir) 63 print(" -p install into the private area (%s)" % (configDir))
68 64
69 sys.exit(rcode) 65 sys.exit(rcode)
70 66
71 def installTranslations(): 67 def installTranslations():
72 """ 68 """
80 targetDir = getConfig('ericDir') 76 targetDir = getConfig('ericDir')
81 77
82 try: 78 try:
83 for fn in glob.glob(os.path.join('eric', 'i18n', '*.qm')): 79 for fn in glob.glob(os.path.join('eric', 'i18n', '*.qm')):
84 shutil.copy2(fn, targetDir) 80 shutil.copy2(fn, targetDir)
85 except IOError, msg: 81 except IOError as msg:
86 sys.stderr.write('IOError: %s\nTry install-i18n as root.\n' % msg) 82 sys.stderr.write('IOError: %s\nTry install-i18n as root.\n' % msg)
87 83
88 def main(argv): 84 def main(argv):
89 """ 85 """
90 The main function of the script. 86 The main function of the script.
118 try: 114 try:
119 main(sys.argv) 115 main(sys.argv)
120 except SystemExit: 116 except SystemExit:
121 raise 117 raise
122 except: 118 except:
123 print \ 119 print("""An internal error occured. Please report all the output of the program,
124 """An internal error occured. Please report all the output of the program,
125 including the following traceback, to eric5-bugs@eric-ide.python-projects.org. 120 including the following traceback, to eric5-bugs@eric-ide.python-projects.org.
126 """ 121 """)
127 raise 122 raise

eric ide

mercurial