mirror of https://github.com/zulip/zulip.git
tools: Delete tagmessages script.
It was broken by commit aaedec1fdb
which
moved it to tools/i18n without adjusting its relative path references,
and it contains a sketchy injectable os.system call that I’d like to
remove.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
5a1104f1b8
commit
3b257d10df
|
@ -1,28 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
import configparser
|
|
||||||
import os
|
|
||||||
from hashlib import md5
|
|
||||||
|
|
||||||
import polib
|
|
||||||
|
|
||||||
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
config = configparser.RawConfigParser()
|
|
||||||
config.read(os.path.join(THIS_DIR, '../.transifexrc'))
|
|
||||||
login = '{}:{}'.format(config.get('https://www.transifex.com', 'username'),
|
|
||||||
config.get('https://www.transifex.com', 'password'))
|
|
||||||
|
|
||||||
project_slug = 'zulip-test' # HACK hardcode
|
|
||||||
|
|
||||||
tools_dir = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
root_dir = os.path.dirname(tools_dir)
|
|
||||||
# Choose any translation file for processing all strings.
|
|
||||||
po = polib.pofile(os.path.join(root_dir, 'locale', 'de', 'LC_MESSAGES', 'django.po'))
|
|
||||||
for entry in po:
|
|
||||||
tag = entry.comment
|
|
||||||
if tag:
|
|
||||||
keys = [entry.msgid, entry.msgctxt or '']
|
|
||||||
msg_hash = md5(':'.join(keys).encode('utf-8')).hexdigest()
|
|
||||||
curl_call = 'curl -i -L --user {} -X PUT -H "Content-Type: application/json" ' \
|
|
||||||
'--data \'{{"tags": ["{}"]}}\' https://www.transifex.com/api/2/project/{}/resource' \
|
|
||||||
'/djangopo/source/{}'.format(login, tag, project_slug, msg_hash)
|
|
||||||
os.system(curl_call)
|
|
|
@ -196,8 +196,7 @@ python_rules = RuleList(
|
||||||
'zerver/tests/',
|
'zerver/tests/',
|
||||||
'zerver/views/'}},
|
'zerver/views/'}},
|
||||||
{'pattern': 'msgid|MSGID',
|
{'pattern': 'msgid|MSGID',
|
||||||
'exclude': {'tools/check-capitalization',
|
'exclude': {'tools/check-capitalization'},
|
||||||
'tools/i18n/tagmessages'},
|
|
||||||
'description': 'Avoid using "msgid" as a variable name; use "message_id" instead.'},
|
'description': 'Avoid using "msgid" as a variable name; use "message_id" instead.'},
|
||||||
{'pattern': '^(?!#)@login_required',
|
{'pattern': '^(?!#)@login_required',
|
||||||
'description': '@login_required is unsupported; use @zulip_login_required',
|
'description': '@login_required is unsupported; use @zulip_login_required',
|
||||||
|
|
Loading…
Reference in New Issue