Skip to content

Commit

Permalink
adding description missing warning (conan-io#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored and lasote committed Dec 13, 2016
1 parent a963af2 commit 668ea17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
13 changes: 5 additions & 8 deletions conans/client/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,11 @@ def export(self, user, conan_file_path, keep_source=False):
logger.debug("Exporting %s" % conan_file_path)
user_name, channel = get_user_channel(user)
conan_file = self._loader().load_class(os.path.join(conan_file_path, CONANFILE))
url = getattr(conan_file, "url", None)
license_ = getattr(conan_file, "license", None)
if not url:
self._user_io.out.warn("Conanfile doesn't have 'url'.\n"
"It is recommended to add your repo URL as attribute")
if not license_:
self._user_io.out.warn("Conanfile doesn't have a 'license'.\n"
"It is recommended to add the package license as attribute")
for field in ["url", "license", "description"]:
field_value = getattr(conan_file, field, None)
if not field_value:
self._user_io.out.warn("Conanfile doesn't have '%s'.\n"
"It is recommended to add it as attribute" % field)

conan_ref = ConanFileReference(conan_file.name, conan_file.version, user_name, channel)
conan_ref_str = str(conan_ref)
Expand Down
2 changes: 1 addition & 1 deletion conans/test/command/export_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestConan(ConanFile):
files = {CONANFILE: conanfile}
client.save(files)
client.run("export lasote/stable")
self.assertIn("WARN: Conanfile doesn't have a 'license'", client.user_io.out)
self.assertIn("WARN: Conanfile doesn't have 'license'", client.user_io.out)
client.run("install Hello/1.2@lasote/stable -s os=Windows", ignore_error=True)
self.assertIn("'Windows' is not a valid 'settings.os' value", client.user_io.out)
self.assertIn("Possible values are ['Linux']", client.user_io.out)
Expand Down
8 changes: 5 additions & 3 deletions conans/test/command/info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ def _create(self, number, version, deps=None, deps_dev=None, export=True):
expected_output = textwrap.dedent(
"""\
WARN: Conanfile doesn't have 'url'.
It is recommended to add your repo URL as attribute
WARN: Conanfile doesn't have a 'license'.
It is recommended to add the package license as attribute""")
It is recommended to add it as attribute
WARN: Conanfile doesn't have 'license'.
It is recommended to add it as attribute
WARN: Conanfile doesn't have 'description'.
It is recommended to add it as attribute""")
self.assertIn(expected_output, self.client.user_io.out)

if number != "Hello2":
Expand Down
2 changes: 1 addition & 1 deletion conans/test/upload_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class TestConan(ConanFile):
files = {CONANFILE: conanfile}
self.client.save(files)
self.client.run("export lasote/stable")
self.assertIn("WARN: Conanfile doesn't have a 'license'", self.client.user_io.out)
self.assertIn("WARN: Conanfile doesn't have 'license'", self.client.user_io.out)
self.client.run("upload Hello/1.2@lasote/stable", ignore_error=False)
self.assertIn("Uploading conan_export.tgz", self.client.user_io.out)

Expand Down

0 comments on commit 668ea17

Please sign in to comment.