From e96090fbe3a5579f03d88ff80bd1a01f850ac14d Mon Sep 17 00:00:00 2001 From: smileknife Date: Wed, 1 Jul 2020 20:40:42 +0800 Subject: [PATCH] Resolve the parsing description probelm Signed-off-by: smileknife --- pyporter | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/pyporter b/pyporter index 85d68bd..66f198c 100755 --- a/pyporter +++ b/pyporter @@ -169,24 +169,10 @@ class PyPorter: res = [] paragraph = 0 for d in desc: - if len(d.strip()) == 0: - continue - first_char = d.strip()[0] - ignore_line = False - if d.strip().startswith("===") or d.strip().startswith("---"): - paragraph = paragraph + 1 - ignore_line = True - elif d.strip().startswith(":") or d.strip().startswith(".."): - ignore_line = True - if ignore_line != True and paragraph == 1: + if re.match("[a-zA-Z0-9()-]+", d): res.append(d) - if paragraph >= 2: - del res[-1] - return "\n".join(res) if res != []: - return "\n".join(res) - elif paragraph == 0: - return self.__json["info"]["description"] + return "\\\n".join(res) else: return self.__json["info"]["summary"] @@ -420,8 +406,9 @@ def build_spec(porter, output): print("") porter.get_requires() print("") - print("%description") + print("%global _description\\") print(porter.get_description()) + print("%description %_description") print("") print("%package -n {name}".format(name=porter.get_pkg_name())) @@ -432,14 +419,12 @@ def build_spec(porter, output): build_req_list=porter.get_build_requires() - print("%description -n " + porter.get_pkg_name()) - print(porter.get_description()) + print("%description -n " + porter.get_pkg_name() + " %_description") print("") print("%package help") print("Summary:\tDevelopment documents and examples for {name}".format(name=porter.get_module_name())) print("Provides:\t{name}-doc".format(name=porter.get_pkg_name())) - print("%description help") - print(porter.get_description()) + print("%description help" + " %_description") print("") print("%prep") print("%autosetup -n {name}-{ver}".format(name=porter.get_module_name(), ver=porter.get_version())) -- Gitee