Skip to content
Snippets Groups Projects
Verified Commit 89e5753e authored by sunpoet's avatar sunpoet
Browse files

textproc/translate-toolkit: Unbreak this port

parent 93e8723a
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,6 @@ COMMENT= Tools and API for translation and localization engineering
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
BROKEN= fails to build: ImportError: cannot import name 'commaSeparatedList' from 'pyparsing'
BUILD_DEPENDS= ${RUN_DEPENDS}
RUN_DEPENDS= bash:shells/bash \
msghack:devel/gettext-msghack \
......
Obtained from: https://github.com/translate/translate/commit/888091da38619af885c2350848f546a20f95ba39
Revert the change from pyparsing 2 to 3
--- translate/storage/rc.py.orig 2021-10-27 09:01:25 UTC
+++ translate/storage/rc.py
@@ -39,13 +39,13 @@ from pyparsing import (
ZeroOrMore,
alphanums,
alphas,
- c_style_comment,
- delimited_list,
+ commaSeparatedList,
+ cStyleComment,
+ delimitedList,
nums,
- quoted_string,
- rest_of_line,
+ quotedString,
+ restOfLine,
)
-from pyparsing.common import pyparsing_common
from translate.storage import base
@@ -149,24 +149,24 @@ def rc_statement():
:rtype: pyparsing.ParserElement
"""
- one_line_comment = "//" + rest_of_line
+ one_line_comment = "//" + restOfLine
- comments = c_style_comment ^ one_line_comment
+ comments = cStyleComment ^ one_line_comment
- precompiler = Word("#", alphanums) + rest_of_line
+ precompiler = Word("#", alphanums) + restOfLine
language_definition = (
"LANGUAGE"
- + Word(alphas + "_").set_results_name("language")
- + Optional("," + Word(alphas + "_").set_results_name("sublanguage"))
+ + Word(alphas + "_").setResultsName("language")
+ + Optional("," + Word(alphas + "_").setResultsName("sublanguage"))
)
- block_start = (Keyword("{") | Keyword("BEGIN")).set_name("block_start")
- block_end = (Keyword("}") | Keyword("END")).set_name("block_end")
+ block_start = (Keyword("{") | Keyword("BEGIN")).setName("block_start")
+ block_end = (Keyword("}") | Keyword("END")).setName("block_end")
reserved_words = block_start | block_end
- name_id = ~reserved_words + Word(alphas, alphanums + "_").set_name("name_id")
+ name_id = ~reserved_words + Word(alphas, alphanums + "_").setName("name_id")
numbers = Word(nums)
@@ -175,25 +175,25 @@ def rc_statement():
constant = Combine(
Optional(Keyword("NOT")) + (name_id | integerconstant),
adjacent=False,
- join_string=" ",
+ joinString=" ",
)
- combined_constants = delimited_list(constant, "|")
+ combined_constants = delimitedList(constant, "|")
- concatenated_string = OneOrMore(quoted_string)
+ concatenated_string = OneOrMore(quotedString)
block_options = Optional(
- SkipTo(Keyword("CAPTION"), fail_on=block_start)("pre_caption")
+ SkipTo(Keyword("CAPTION"), failOn=block_start)("pre_caption")
+ Keyword("CAPTION")
- + quoted_string("caption")
+ + quotedString("caption")
) + SkipTo(block_start)("post_caption")
undefined_control = (
Group(
- name_id.set_results_name("id_control")
- + delimited_list(
+ name_id.setResultsName("id_control")
+ + delimitedList(
concatenated_string ^ constant ^ numbers ^ Group(combined_constants)
- ).set_results_name("values_")
+ ).setResultsName("values_")
)
| comments
)
@@ -210,14 +210,14 @@ def rc_statement():
string_table = Keyword("STRINGTABLE")("block_type") + block_options + block
menu_item = Keyword("MENUITEM")("block_type") + (
- pyparsing_common.comma_separated_list("values_") | Keyword("SEPARATOR")
+ commaSeparatedList("values_") | Keyword("SEPARATOR")
)
popup_block = Forward()
popup_block <<= Group(
Keyword("POPUP")("block_type")
- + Optional(quoted_string("caption"))
+ + Optional(quotedString("caption"))
+ block_start
+ ZeroOrMore(Group(menu_item | popup_block))("elements")
+ block_end
@@ -350,7 +350,7 @@ class rcfile(base.TranslationStore):
decoded = decoded.replace("\r", "")
# Parse the strings into a structure.
- results = rc_statement().search_string(decoded)
+ results = rc_statement().searchString(decoded)
processblocks = True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment