From b39936af205117bb24fa3afad6b0e428354109e4 Mon Sep 17 00:00:00 2001 From: David Lai Date: Wed, 19 Aug 2020 20:19:51 +0800 Subject: [PATCH 1/2] Raise unversioned error when config not allowed --- src/rezplugins/package_repository/filesystem.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rezplugins/package_repository/filesystem.py b/src/rezplugins/package_repository/filesystem.py index 6fa9e7741..d6b2e857d 100644 --- a/src/rezplugins/package_repository/filesystem.py +++ b/src/rezplugins/package_repository/filesystem.py @@ -1181,6 +1181,11 @@ def _remove_build_keys(obj): # format version is always set package_data["format_version"] = format_version + # Stop if package is unversioned and config does not allow that + if (not package_data["version"] + and not config.allow_unversioned_packages): + raise PackageMetadataError("Unversioned package is not allowed.") + # write out new package definition file package_file = ".".join([package_filename, package_extension]) filepath = os.path.join(pkg_base_path, package_file) From 4026d47931bacfb07269dadf5c660a4ea7e46bc2 Mon Sep 17 00:00:00 2001 From: David Lai Date: Wed, 19 Aug 2020 20:48:12 +0800 Subject: [PATCH 2/2] Improve error message --- src/rezplugins/package_repository/filesystem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rezplugins/package_repository/filesystem.py b/src/rezplugins/package_repository/filesystem.py index d6b2e857d..bee3745f8 100644 --- a/src/rezplugins/package_repository/filesystem.py +++ b/src/rezplugins/package_repository/filesystem.py @@ -1184,7 +1184,8 @@ def _remove_build_keys(obj): # Stop if package is unversioned and config does not allow that if (not package_data["version"] and not config.allow_unversioned_packages): - raise PackageMetadataError("Unversioned package is not allowed.") + raise PackageMetadataError("Unversioned package is not allowed " + "in current configuration.") # write out new package definition file package_file = ".".join([package_filename, package_extension])