<pre style='margin:0'>
Renee Otten (reneeotten) pushed a commit to branch master
in repository upt-macports.

</pre>
<p><a href="https://github.com/macports/upt-macports/commit/cfa3332e8ced06e26ae5d89a44637471b8e4bafe">https://github.com/macports/upt-macports/commit/cfa3332e8ced06e26ae5d89a44637471b8e4bafe</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'>     new cfa3332  Fix license logging and add messages to the template
</span>cfa3332 is described below

<span style='display:block; white-space:pre;color:#808000;'>commit cfa3332e8ced06e26ae5d89a44637471b8e4bafe
</span>Author: Renee Otten <reneeotten@macports.org>
AuthorDate: Thu Dec 19 10:05:59 2019 -0500

<span style='display:block; white-space:pre;color:#404040;'>    Fix license logging and add messages to the template
</span><span style='display:block; white-space:pre;color:#404040;'>    
</span><span style='display:block; white-space:pre;color:#404040;'>    - "no license found" should be logged as warning
</span><span style='display:block; white-space:pre;color:#404040;'>    - add the "no upstream license found" and "upt failed to detect the
</span><span style='display:block; white-space:pre;color:#404040;'>        license" to the template
</span><span style='display:block; white-space:pre;color:#404040;'>    - use two spaces for inline comments
</span>---
 upt_macports/tests/test_macports_package.py |  6 +++---
 upt_macports/upt_macports.py                | 11 ++++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/upt_macports/tests/test_macports_package.py b/upt_macports/tests/test_macports_package.py
</span><span style='display:block; white-space:pre;color:#808080;'>index c7ae376..e37c10d 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/upt_macports/tests/test_macports_package.py
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/upt_macports/tests/test_macports_package.py
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -17,7 +17,7 @@ class TestMacPortsPackageLicenses(unittest.TestCase):
</span> 
     def test_no_licenses(self):
         self.package.upt_pkg.licenses = []
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        expected = 'unknown'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        expected = 'unknown  # no upstream license found'
</span>         self.assertEqual(self.package.licenses, expected)
 
     def test_one_license(self):
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -27,12 +27,12 @@ class TestMacPortsPackageLicenses(unittest.TestCase):
</span> 
     def test_unknown_license(self):
         self.package.upt_pkg.licenses = [FakeLicense]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        expected = 'unknown # MacPorts license unknown for fake'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        expected = 'unknown  # MacPorts license unknown for fake'
</span>         self.assertEqual(self.package.licenses, expected)
 
     def test_bad_license(self):
         self.package.upt_pkg.licenses = [upt.licenses.UnknownLicense()]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        expected = 'unknown'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        expected = 'unknown  # upt failed to detect license'
</span>         self.assertEqual(self.package.licenses, expected)
 
     def test_multiple_license(self):
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/upt_macports/upt_macports.py b/upt_macports/upt_macports.py
</span><span style='display:block; white-space:pre;color:#808080;'>index eb3b725..7ba4ce9 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/upt_macports/upt_macports.py
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/upt_macports/upt_macports.py
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -64,21 +64,22 @@ class MacPortsPackage(object):
</span>             spdx2macports = json.loads(f.read())
 
         if not self.upt_pkg.licenses:
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            self.logger.info('No license found')
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            return 'unknown'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            self.logger.warning('No license found')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            return 'unknown  # no upstream license found'
</span>         licenses = []
         for license in self.upt_pkg.licenses:
             try:
                 if license.spdx_identifier == 'unknown':
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    port_license = 'unknown'
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    self.logger.warning(f'upt failed to detect license')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    warn = 'upt failed to detect license'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    port_license = f'unknown  # {warn}'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    self.logger.warning(warn)
</span>                 else:
                     port_license = spdx2macports[license.spdx_identifier]
                     self.logger.info(f'Found license {port_license}')
                 licenses.append(port_license)
             except KeyError:
                 err = f'MacPorts license unknown for {license.spdx_identifier}'
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                licenses.append('unknown # ' + err)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                licenses.append(f'unknown  # {err}')
</span>                 self.logger.error(err)
                 self.logger.info('Please report the error at https://github.com/macports/upt-macports') # noqa
         return ' '.join(licenses)
</pre><pre style='margin:0'>

</pre>