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. |