diff --git a/extensions/tests/files/addon-with-permissions.zip b/extensions/tests/files/addon-with-permissions.zip index 53fc089a..b693749a 100644 Binary files a/extensions/tests/files/addon-with-permissions.zip and b/extensions/tests/files/addon-with-permissions.zip differ diff --git a/extensions/tests/files/addon-with-split-platforms-linux.zip b/extensions/tests/files/addon-with-split-platforms-linux.zip index 35a09191..177ad6bd 100644 Binary files a/extensions/tests/files/addon-with-split-platforms-linux.zip and b/extensions/tests/files/addon-with-split-platforms-linux.zip differ diff --git a/extensions/tests/files/addon-with-split-platforms-windows.zip b/extensions/tests/files/addon-with-split-platforms-windows.zip index 37a5a828..2d692fbc 100644 Binary files a/extensions/tests/files/addon-with-split-platforms-windows.zip and b/extensions/tests/files/addon-with-split-platforms-windows.zip differ diff --git a/extensions/tests/files/addon-without-dir.zip b/extensions/tests/files/addon-without-dir.zip index 0c488cef..4656113b 100644 Binary files a/extensions/tests/files/addon-without-dir.zip and b/extensions/tests/files/addon-without-dir.zip differ diff --git a/extensions/tests/files/addon-without-platforms-for-split-test.zip b/extensions/tests/files/addon-without-platforms-for-split-test.zip index f3df336a..43f9fe41 100644 Binary files a/extensions/tests/files/addon-without-platforms-for-split-test.zip and b/extensions/tests/files/addon-without-platforms-for-split-test.zip differ diff --git a/extensions/tests/files/amaranth-1.0.8.zip b/extensions/tests/files/amaranth-1.0.8.zip index 4765661d..c605e63d 100644 Binary files a/extensions/tests/files/amaranth-1.0.8.zip and b/extensions/tests/files/amaranth-1.0.8.zip differ diff --git a/extensions/tests/files/blender_gis-2.2.8.zip b/extensions/tests/files/blender_gis-2.2.8.zip index 1de5c046..854c0862 100644 Binary files a/extensions/tests/files/blender_gis-2.2.8.zip and b/extensions/tests/files/blender_gis-2.2.8.zip differ diff --git a/extensions/tests/files/edit_breakdown-0.1.0.zip b/extensions/tests/files/edit_breakdown-0.1.0.zip index 71850b3b..dcd55846 100644 Binary files a/extensions/tests/files/edit_breakdown-0.1.0.zip and b/extensions/tests/files/edit_breakdown-0.1.0.zip differ diff --git a/extensions/tests/files/invalid-addon-dir-no-init.zip b/extensions/tests/files/invalid-addon-dir-no-init.zip index a4424c78..87c32ba4 100644 Binary files a/extensions/tests/files/invalid-addon-dir-no-init.zip and b/extensions/tests/files/invalid-addon-dir-no-init.zip differ diff --git a/extensions/tests/files/invalid-addon-no-init.zip b/extensions/tests/files/invalid-addon-no-init.zip index 740e82fc..ec7c86eb 100644 Binary files a/extensions/tests/files/invalid-addon-no-init.zip and b/extensions/tests/files/invalid-addon-no-init.zip differ diff --git a/extensions/tests/files/invalid-manifest-path.zip b/extensions/tests/files/invalid-manifest-path.zip index afc4e498..44905078 100644 Binary files a/extensions/tests/files/invalid-manifest-path.zip and b/extensions/tests/files/invalid-manifest-path.zip differ diff --git a/extensions/tests/files/invalid-manifest-toml.zip b/extensions/tests/files/invalid-manifest-toml.zip index 942089d4..84805cfc 100644 Binary files a/extensions/tests/files/invalid-manifest-toml.zip and b/extensions/tests/files/invalid-manifest-toml.zip differ diff --git a/extensions/tests/files/invalid-missing-wheels.zip b/extensions/tests/files/invalid-missing-wheels.zip index 93aae3b3..ecf0080f 100644 Binary files a/extensions/tests/files/invalid-missing-wheels.zip and b/extensions/tests/files/invalid-missing-wheels.zip differ diff --git a/extensions/tests/test_manifest.py b/extensions/tests/test_manifest.py index 33715835..4e38ce21 100644 --- a/extensions/tests/test_manifest.py +++ b/extensions/tests/test_manifest.py @@ -482,11 +482,34 @@ class ValidateManifestFields(TestCase): self.assertEqual(1, len(e.exception.messages)) self.assertIn('version', e.exception.messages[0]) - def test_licenses(self): + def test_licenses_addons(self): data = { **self.mandatory_fields, **self.optional_fields, } + data['license'] = ['SPDX:GPL-3.0-or-later'] + ManifestValidator(data) + + data['license'] = ['SPDX:GPL-3.0-or-later', 'SPDX:CC0-1.0'] + ManifestValidator(data) + + message_begin = "Manifest value error: license expects a list of" + for license in ['SPDX:GPL-2.0-or-later', 'SPDX:MIT', 'SPDX:ZLIB']: + data['license'] = [license] + with self.assertRaises(ValidationError) as e: + ManifestValidator(data) + self.assertNotIn(message_begin, e.exception.messages[0]) + self.assertIn('SPDX:GPL-3.0-or-later', e.exception.messages[0]) + self.assertIn('for add-ons must be', e.exception.messages[0]) + + def test_licenses_themes(self): + data = { + **self.mandatory_fields, + **self.optional_fields, + } + data['type'] = 'theme' + data['tags'] = ['Dark'] + del data['permissions'] data['license'] = ['SPDX:GPL-2.0-or-later'] ManifestValidator(data) @@ -497,7 +520,7 @@ class ValidateManifestFields(TestCase): message_begin = "Manifest value error: license expects a list of" self.assertIn(message_begin, e.exception.messages[0]) - self.assertIn('[\'SPDX:GPL-2.0-or-later\']', e.exception.messages[0]) + self.assertIn('[\'SPDX:GPL-3.0-or-later\']', e.exception.messages[0]) data['license'] = ['SPDX:GPL-2.0-only'] with self.assertRaises(ValidationError) as e: diff --git a/extensions/tests/test_submit.py b/extensions/tests/test_submit.py index d3395fe1..f0e34b45 100644 --- a/extensions/tests/test_submit.py +++ b/extensions/tests/test_submit.py @@ -27,7 +27,7 @@ EXPECTED_EXTENSION_DATA = { 'type': 'add-on', 'schema_version': "1.0.0", }, - 'file_hash': 'sha256:28313858b9be34e6ecd15a63e28f626fb914dbdcc74c6d21c6536c9fad9de426', + 'file_hash': 'sha256:31c7489479d268af8622d3468dc40feee2287510dfa1f3adf6cbff37154d2e06', 'size_bytes': 53969, 'tags': ['Sequencer'], 'version_str': '0.1.0', @@ -42,8 +42,8 @@ EXPECTED_EXTENSION_DATA = { 'blender_version_min': '4.2.0', 'type': 'add-on', }, - 'file_hash': 'sha256:fb71280e43400b1fd343a6b5a1421dcb63c4fa69935963429bd6cae965dad2db', - 'size_bytes': 434471, + 'file_hash': 'sha256:67d6259eb99ae60d2abbcdfe312e7677621d8ac4f674158a91a5fde69e751548', + 'size_bytes': 434477, 'tags': ['3D View'], 'version_str': '2.2.8', 'slug': 'blender-gis', @@ -57,8 +57,8 @@ EXPECTED_EXTENSION_DATA = { 'blender_version_min': '4.2.0', 'type': 'add-on', }, - 'file_hash': 'sha256:09dcc1f0f9bc7103c48974da1d81f85b13326172fa008b2651cc4e77198654ed', - 'size_bytes': 72865, + 'file_hash': 'sha256:c218c1b7d13436be59706081adeb4125cb2e3118c5c2a45576ede1bbf61d3ec6', + 'size_bytes': 72868, 'tags': [], 'version_str': '1.0.8', 'slug': 'amaranth', @@ -74,8 +74,8 @@ EXPECTED_EXTENSION_DATA = { 'permissions': {'files': 'reading files', 'network': 'talking to server'}, 'platforms': ['linux-x64'], }, - 'file_hash': 'sha256:0431dac17d6e4d20c17a799dcc5ee915c12ea6d5b9a58a26b7850dea4aecc58c', - 'size_bytes': 765, + 'file_hash': 'sha256:7bcc6730049373856a8f1a801ddf4577e8e6948393b82db032514f0ec44945fc', + 'size_bytes': 767, 'tags': [], 'version_str': '0.1.0', 'slug': 'some-addon', @@ -92,8 +92,8 @@ EXPECTED_EXTENSION_DATA = { 'platforms': ['linux-x64', 'windows-x64'], 'build': {'generated': {'platforms': ['linux-x64']}}, }, - 'file_hash': 'sha256:b592384240eb04fb0f5e57741d93d8e15456d3fc27c837e2246422d6512ae002', - 'size_bytes': 791, + 'file_hash': 'sha256:719069cb27188e57600250fb3a8dcfb671b4c35a2996fb81b1f24943aa17f9ac', + 'size_bytes': 793, 'tags': [], 'version_str': '0.1.0', 'slug': 'some-addon', @@ -447,7 +447,7 @@ class SubmitFinaliseTest(CheckFilePropertiesMixin, TestCase): get_status_display='Awaiting Review', get_type_display='Add-on', hash=version.files.first().original_hash, - original_hash='sha256:2831385', + original_hash='sha256:31c7489', ) # We cannot check for the ManyToMany yet (tags, licences, permissions) diff --git a/extensions/tests/test_utils.py b/extensions/tests/test_utils.py index 98dd4417..6b5c60cf 100644 --- a/extensions/tests/test_utils.py +++ b/extensions/tests/test_utils.py @@ -10,7 +10,7 @@ class UtilsTest(TestCase): 'description': 'my description', 'permissions': [], 'tags': ['foo', 'bar'], - 'license': ['SPDX:GPL-2.0-or-later'], + 'license': ['SPDX:GPL-3.0-or-later'], 'blender_version_min': "2.9.3", 'blender_version_max': None, } @@ -18,7 +18,7 @@ class UtilsTest(TestCase): 'tagline': '', 'description': 'my description', 'tags': ['foo', 'bar'], - 'license': ['SPDX:GPL-2.0-or-later'], + 'license': ['SPDX:GPL-3.0-or-later'], 'blender_version_min': "2.9.3", } cleaned_dictionary = clean_json_dictionary_from_optional_fields(test_dictionary) diff --git a/files/validators.py b/files/validators.py index d1431aff..ac8591eb 100644 --- a/files/validators.py +++ b/files/validators.py @@ -248,13 +248,14 @@ class ListValidator(SimpleValidator): class LicenseValidator(ListValidator): - example = ['SPDX:GPL-2.0-or-later'] + example = ['SPDX:GPL-3.0-or-later'] @classmethod def validate(cls, *, name: str, value: list[str], manifest: dict) -> str: """Return error message if there is any license that is not accepted by the site""" is_error = False error_message = "" + gnu_gpl3_slug = "SPDX:GPL-3.0-or-later" if type(value) != list: is_error = True @@ -267,6 +268,20 @@ class LicenseValidator(ListValidator): unknown_value = license break + if ( + type(value) is list + and (manifest.get("type") == EXTENSION_TYPE_SLUGS_SINGULAR[EXTENSION_TYPE_CHOICES.BPY]) + and gnu_gpl3_slug not in value + ): + return mark_safe( + f'Manifest value error: license for add-ons must be ' + f'GPL v3.0 or later. ' + f'Additional license are possible, read the ' + f'' + f'documentation. e.g., {cls.example}.' + ) + if not is_error: return