Skip to content

Commit

Permalink
Pass along unknown licenses unclassified (#185)
Browse files Browse the repository at this point in the history
- Fixes #184 generating qt_metapackages recipes in Melodic
  • Loading branch information
andre-rosa authored and allenh1 committed May 6, 2019
1 parent 90df401 commit d87f8dd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 21 deletions.
5 changes: 0 additions & 5 deletions superflore/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
# limitations under the License.


class UnknownLicense(Exception):
def __init__(self, message):
self.message = message


class UnresolvedDependency(Exception):
def __init__(self, message):
self.message = message
Expand Down
5 changes: 0 additions & 5 deletions superflore/generate_installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from rosinstall_generator.distro import get_package_names
from superflore.exceptions import UnknownBuildType
from superflore.exceptions import UnknownLicense
from superflore.utils import err
from superflore.utils import get_pkg_version
from superflore.utils import info
Expand Down Expand Up @@ -75,10 +74,6 @@ def generate_installers(
else:
changes.append('*{0} {1}*'.format(pkg, version))
installers.append(pkg)
except UnknownLicense as ul:
err("{0}%: Unknown License '{1}'.".format(percent, str(ul)))
bad_installers.append(pkg)
failed = failed + 1
except UnknownBuildType as ub:
err(
"{0}%: Unknown Build type '{1}' for package '{2}'".format(
Expand Down
5 changes: 2 additions & 3 deletions superflore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import sys
import time

from superflore.exceptions import UnknownLicense
from superflore.exceptions import UnknownPlatform
from superflore.rosdep_support import get_cached_index, resolve_rosdep_key
from termcolor import colored
Expand Down Expand Up @@ -199,8 +198,8 @@ def get_license(l):
elif re.search(pub_dom_re, l, f):
return 'public_domain'
else:
err('Could not match license "{0}".'.format(l))
raise UnknownLicense('bad license')
warn('Could not match license "{0}". Passing it through...'.format(l))
return l


def resolve_dep(pkg, os, distro=None):
Expand Down
6 changes: 1 addition & 5 deletions tests/test_generate_installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from rosinstall_generator.distro import get_distro
from superflore.exceptions import UnknownBuildType
from superflore.exceptions import UnknownLicense
from superflore.generate_installers import generate_installers
import unittest

Expand Down Expand Up @@ -55,9 +54,7 @@ def _create_if_p2os(overlay, pkg, distro, preserve_existing, collector):
def _raise_exceptions(overlay, pkg, distro, preserve_existing, collector):
"""Raise exceptions"""
collector.append(pkg)
if 'l' in pkg:
raise UnknownLicense('l')
elif 'b' in pkg:
if 'b' in pkg:
raise UnknownBuildType('b')
elif 'k' in pkg:
raise KeyError('k')
Expand Down Expand Up @@ -116,7 +113,6 @@ def test_exceptions(self):
# anything with a 'k', 'l', or a 'b' has been skipped
for p in inst:
self.assertNotIn('k', p)
self.assertNotIn('l', p)
self.assertNotIn('b', p)

def test_changes(self):
Expand Down
5 changes: 2 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import string
import sys

from superflore.exceptions import UnknownLicense
from superflore.exceptions import UnknownPlatform
from superflore.TempfileManager import TempfileManager
from superflore.utils import clean_up
Expand Down Expand Up @@ -119,8 +118,8 @@ def test_get_license(self):
self.assertEqual(ret, 'MIT')
ret = get_license('Creative Commons')
self.assertEqual(ret, 'CC-BY-SA-3.0')
with self.assertRaises(UnknownLicense):
ret = get_license('TODO')
ret = get_license('United States Government Purpose')
self.assertEqual(ret, 'United States Government Purpose')

def test_delta_msg(self):
"""Test the delta message generated for the PR"""
Expand Down

0 comments on commit d87f8dd

Please # to comment.