Beispiel #1
0
def verify_conan_name(name):
    try:
        ConanName.validate_name(name)
    except InvalidNameException as e:
        print(e.args[0])
        exit(1)
    return name
Beispiel #2
0
    def __new__(cls, name):
        """Simple name creation.

        @param name:        string containing the desired name
        """
        ConanName.validate_user(name)
        return str.__new__(cls, name)
Beispiel #3
0
 def validate_name_test(self):
     self.assertIsNone(ConanName.validate_name("string.dot.under-score.123"))
     self.assertIsNone(ConanName.validate_name("_underscore+123"))
     self.assertIsNone(ConanName.validate_name("*"))
     self.assertIsNone(ConanName.validate_name("a" * ConanName._min_chars))
     self.assertIsNone(ConanName.validate_name("a" * ConanName._max_chars))
     self.assertIsNone(ConanName.validate_name("a" * 50))  # Regression test
Beispiel #4
0
 def validate_name_version_test(self):
     self.assertIsNone(ConanName.validate_name("[vvvv]", version=True))
Beispiel #5
0
 def _check_invalid_type(self, value):
     with six.assertRaisesRegex(self, InvalidNameException,
                                "is not a string"):
         ConanName.validate_name(value)
Beispiel #6
0
 def _check_invalid_format(self, value, *args):
     with six.assertRaisesRegex(self, InvalidNameException, "Valid names"):
         ConanName.validate_name(value, *args)
Beispiel #7
0
 def test_validate_name_version(self):
     self.assertIsNone(ConanName.validate_version("name", "[vvvv]"))
Beispiel #8
0
 def _check_invalid_version(self, name, version):
     with six.assertRaisesRegex(self, InvalidNameException,
                                "invalid version number"):
         ConanName.validate_version(version, name)