public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: jturney@sourceware.org
To: cygwin-apps-cvs@sourceware.org
Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-3-g364bbc4
Date: Fri, 31 May 2019 17:33:00 -0000	[thread overview]
Message-ID: <20190531173320.55796.qmail@sourceware.org> (raw)




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=364bbc4fd6d43fda32ebc5711df4d584eec0d65d

commit 364bbc4fd6d43fda32ebc5711df4d584eec0d65d
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri May 31 18:24:18 2019 +0100

    Include subpackage category in package metadata dump

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=156e26806ea0f70e35da9e8836e421097dc52f4c

commit 156e26806ea0f70e35da9e8836e421097dc52f4c
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu May 30 15:05:54 2019 +0100

    Improve handling of multiline ldesc in package summary page

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=f1ea4f74a4c1ec9953fa350fef9e7a1338218f21

commit f1ea4f74a4c1ec9953fa350fef9e7a1338218f21
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu May 30 16:06:04 2019 +0100

    Use subtest in test_html_write to identify different file


Diff:
---
 calm/package.py   |   10 ++++++++--
 calm/pkg2html.py  |    9 +++++++--
 test/test_calm.py |   17 +++++++++--------
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/calm/package.py b/calm/package.py
index 95ea7cb..502547e 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -1008,6 +1008,12 @@ def write_repo_json(args, packages, f):
                 po = packages[arch][pn]
                 arches.append(arch)
 
+        def package(p):
+            for arch in common_constants.ARCHES:
+                if p in packages[arch]:
+                    return packages[arch][p]
+            return None
+
         bv = po.best_version
 
         if po.version_hints[bv].get('external-source', None):
@@ -1022,8 +1028,8 @@ def write_repo_json(args, packages, f):
             'name': pn,
             'versions': versions,
             'summary': po.version_hints[bv].get('sdesc', '').strip('"'),
-            'categories': po.version_hints[bv].get('category', '').split(),
-            'subpackages': [{'name': sp} for sp in po.is_used_by],
+            'categories': po.version_hints[bv].get('category', '').split(),  # to be removed
+            'subpackages': [{'name': sp, 'categories': package(sp).version_hints[package(sp).best_version].get('category', '').split()} for sp in po.is_used_by],
             'arches': arches,
         }
 
diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index 1e817a6..c12d811 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -70,7 +70,7 @@ def sdesc(packages, p, bv):
     else:
         header = p
 
-    return header.replace('"', '')
+    return header.strip('"')
 
 
 # ditto for ldesc
@@ -81,7 +81,12 @@ def ldesc(packages, p, bv):
     else:
         header = p
 
-    return header.replace('"', '')
+    header = header.strip('"')
+    header = header.replace('\n\n', '\n<br>\n')
+    # try to recognize things which look like bullet points
+    header = re.sub(r'\n(\s*[*-]\s)', r'<br>\n\1', header)
+
+    return header
 
 
 # ensure a directory exists
diff --git a/test/test_calm.py b/test/test_calm.py
index 48a6020..9fefa19 100755
--- a/test/test_calm.py
+++ b/test/test_calm.py
@@ -173,14 +173,15 @@ class CalmTest(unittest.TestCase):
         for (dirpath, subdirs, files) in os.walk(htdocs):
             relpath = os.path.relpath(dirpath, htdocs)
             for f in files:
-                results = os.path.join(htdocs, relpath, f)
-                expected = os.path.join('testdata/htdocs.expected', relpath, f)
-                if not filecmp.cmp(results, expected, shallow=False):
-                    logging.info("%s different", os.path.join(relpath, f))
-                    with open(results) as r, open(expected) as e:
-                        self.assertMultiLineEqual(e.read(), r.read())
-                else:
-                    logging.info("%s identical", os.path.join(relpath, f))
+                with self.subTest(file=os.path.join(relpath, f)):
+                    results = os.path.join(htdocs, relpath, f)
+                    expected = os.path.join('testdata/htdocs.expected', relpath, f)
+                    if not filecmp.cmp(results, expected, shallow=False):
+                        logging.info("%s different", os.path.join(relpath, f))
+                        with open(results) as r, open(expected) as e:
+                            self.assertMultiLineEqual(e.read(), r.read())
+                    else:
+                        logging.info("%s identical", os.path.join(relpath, f))
 
     def test_version_sort(self):
         test_data = [


                 reply	other threads:[~2019-05-31 17:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190531173320.55796.qmail@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).