diff --git a/src/catkin_pkg/package.py b/src/catkin_pkg/package.py index e2c8f2d4..8805afd4 100644 --- a/src/catkin_pkg/package.py +++ b/src/catkin_pkg/package.py @@ -253,6 +253,9 @@ def validate(self, warnings=None): if not self.description: errors.append('Package description must not be empty') + else + if '\n' in self.description: + new_warnings.append('Package "%s" has newlines in the description') if not self.maintainers: errors.append("Package '{0}' must declare at least one maintainer".format(self.name)) diff --git a/src/catkin_pkg/python_setup.py b/src/catkin_pkg/python_setup.py index c18ded8c..46b624be 100644 --- a/src/catkin_pkg/python_setup.py +++ b/src/catkin_pkg/python_setup.py @@ -58,7 +58,10 @@ def generate_distutils_setup(package_xml_path=os.path.curdir, **kwargs): The "description" is taken from the eponymous tag if it does not exceed 200 characters. If it does "description" contains the - truncated text while "description_long" contains the complete. + truncated text while "long_description" contains the complete. + + The description shouldn't contain newlines, remove them automatically + here (with a warning in validate()) and leave them in long_description. All licenses are merged into the "license" field. @@ -99,9 +102,16 @@ def generate_distutils_setup(package_xml_path=os.path.curdir, **kwargs): data['url'] = package.urls[0].url if len(package.description) <= 200: - data['description'] = package.description + if '\n' in package.description: + data['description'] = package.description.replaceAll('\n', ' ') + data['long_description'] = package.description + else: + data['description'] = package.description else: - data['description'] = package.description[:197] + '...' + if '\n' in package.description: + data['description'] = package.description[:197].replaceAll('\n', ' ') + '...' + else: + data['description'] = package.description[:197] + '...' data['long_description'] = package.description data['license'] = ', '.join(package.licenses)