diff options
| author | nvi-openerp <nicolas.vanhoren@openerp.com> | 2010-12-08 11:52:49 +0100 |
|---|---|---|
| committer | nvi-openerp <nicolas.vanhoren@openerp.com> | 2010-12-08 11:52:49 +0100 |
| commit | 38569b7754bb2e1dc1b6e8d58df626ff0fafaedb (patch) | |
| tree | e0ad1d56381f8f0e4d288c0f50407191ab8ac7a7 /bin/tools/misc.py | |
| parent | 8cc1c1086d2243678e2fef9c1631758ac517d097 (diff) | |
| parent | 00f2f6b97d71f43fe38c0ade7875864dd7ef564b (diff) | |
[merge]
bzr revid: nicolas.vanhoren@openerp.com-20101206091222-miwtrvjkfh8hy8ec
bzr revid: nicolas.vanhoren@openerp.com-20101206174010-f819dzx7vyw2jntk
bzr revid: nicolas.vanhoren@openerp.com-20101207132443-z0wabhbh0ruzwoo2
bzr revid: nicolas.vanhoren@openerp.com-20101208105249-qfjalxkboqpi9xr0
Diffstat (limited to 'bin/tools/misc.py')
| -rw-r--r-- | bin/tools/misc.py | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 7a416052d21..59230d5f141 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -76,20 +76,19 @@ def init_db(cr): p_id = None while categs: if p_id is not None: - cr.execute('select id \ - from ir_module_category \ - where name=%s and parent_id=%s', (categs[0], p_id)) + cr.execute('SELECT id \ + FROM ir_module_category \ + WHERE name=%s AND parent_id=%s', (categs[0], p_id)) else: - cr.execute('select id \ - from ir_module_category \ - where name=%s and parent_id is NULL', (categs[0],)) + cr.execute('SELECT id \ + FROM ir_module_category \ + WHERE name=%s AND parent_id IS NULL', (categs[0],)) c_id = cr.fetchone() if not c_id: - cr.execute('select nextval(\'ir_module_category_id_seq\')') + cr.execute('INSERT INTO ir_module_category \ + (name, parent_id) \ + VALUES (%s, %s) RETURNING id', (categs[0], p_id)) c_id = cr.fetchone()[0] - cr.execute('insert into ir_module_category \ - (id, name, parent_id) \ - values (%s, %s, %s)', (c_id, categs[0], p_id)) else: c_id = c_id[0] p_id = c_id @@ -104,23 +103,23 @@ def init_db(cr): state = 'uninstalled' else: state = 'uninstallable' - cr.execute('select nextval(\'ir_module_module_id_seq\')') - id = cr.fetchone()[0] - cr.execute('insert into ir_module_module \ - (id, author, website, name, shortdesc, description, \ - category_id, state, certificate, web) \ - values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)', ( - id, info.get('author', ''), + cr.execute('INSERT INTO ir_module_module \ + (author, website, name, shortdesc, description, \ + category_id, state, certificate, web, license) \ + VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING id', ( + info.get('author', ''), info.get('website', ''), i, info.get('name', False), info.get('description', ''), p_id, state, info.get('certificate') or None, - info.get('web') or False)) - cr.execute('insert into ir_model_data \ - (name,model,module, res_id, noupdate) values (%s,%s,%s,%s,%s)', ( + info.get('web') or False, + info.get('license') or 'AGPL-3')) + id = cr.fetchone()[0] + cr.execute('INSERT INTO ir_model_data \ + (name,model,module, res_id, noupdate) VALUES (%s,%s,%s,%s,%s)', ( 'module_meta_information', 'ir.module.module', i, id, True)) dependencies = info.get('depends', []) for d in dependencies: - cr.execute('insert into ir_module_module_dependency \ - (module_id,name) values (%s, %s)', (id, d)) + cr.execute('INSERT INTO ir_module_module_dependency \ + (module_id,name) VALUES (%s, %s)', (id, d)) cr.commit() def find_in_path(name): @@ -142,15 +141,15 @@ def exec_pg_command(name, *args): prog = find_pg_tool(name) if not prog: raise Exception('Couldn\'t find %s' % name) - args2 = (os.path.basename(prog),) + args + args2 = (prog,) + args - return subprocess.call(args2, executable=prog) + return subprocess.call(args2) def exec_pg_command_pipe(name, *args): prog = find_pg_tool(name) if not prog: raise Exception('Couldn\'t find %s' % name) - pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1, + pop = subprocess.Popen((prog,) + args, bufsize= -1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) return (pop.stdin, pop.stdout) @@ -158,7 +157,7 @@ def exec_command_pipe(name, *args): prog = find_in_path(name) if not prog: raise Exception('Couldn\'t find %s' % name) - pop = subprocess.Popen(args, executable=prog, shell=True, bufsize= -1, + pop = subprocess.Popen((prog,) + args, bufsize= -1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) return (pop.stdin, pop.stdout) @@ -913,6 +912,8 @@ def get_iso_codes(lang): return lang def get_languages(): + # The codes below are those from Launchpad's Rosetta, with the exception + # of some trivial codes where the Launchpad code is xx and we have xx_XX. languages={ 'ab_RU': u'Abkhazian / аҧсуа', 'ar_AR': u'Arabic / الْعَرَبيّة', @@ -979,7 +980,8 @@ def get_languages(): 'sl_SI': u'Slovenian / slovenščina', 'sk_SK': u'Slovak / Slovenský jazyk', 'sq_AL': u'Albanian / Shqip', - 'sr_RS': u'Serbian / српски језик', + 'sr_RS': u'Serbian (Cyrillic) / српски', + 'sr@latin': u'Serbian (Latin) / srpski', 'sv_SE': u'Swedish / svenska', 'te_IN': u'Telugu / తెలుగు', 'tr_TR': u'Turkish / Türkçe', |
