From dde439534cf429b60c06e1a676184fae7d9e7a43 Mon Sep 17 00:00:00 2001 From: lambdaclan <47409392+lambdaclan@users.noreply.github.com> Date: Fri, 17 May 2019 16:21:39 +0900 Subject: [PATCH 1/3] fix(rez-pip): deal with SchemaError when requires list includes None Fix the SchemaError "should be instance of" PackageRequest but is None. This is occuring when the requires list includes None and validation takes place. --- src/rez/package_maker__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rez/package_maker__.py b/src/rez/package_maker__.py index 57efc89de..11ef6284b 100644 --- a/src/rez/package_maker__.py +++ b/src/rez/package_maker__.py @@ -128,6 +128,10 @@ def get_package(self): def _get_data(self): data = self._data.copy() + if "requires" in data: + if None in data["requires"]: + data["requires"] = [x for x in data["requires"] if x is not None] + data.pop("installed_variants", None) data.pop("skipped_variants", None) data.pop("package_cls", None) From 568b2e97bd128609a6d8e7b83aafba9814c2b35a Mon Sep 17 00:00:00 2001 From: lambdaclan <47409392+lambdaclan@users.noreply.github.com> Date: Fri, 17 May 2019 16:34:36 +0900 Subject: [PATCH 2/3] fix(rez-pip): deal with package names that include a dash Modify the allowed package name regex string to allow for packages that include a dash in their names which is quite common for Python packages. This eliminates issues like the one below: ERROR PackageRequestError: Not a valid package name: u'import-class'. --- src/rez/utils/formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rez/utils/formatting.py b/src/rez/utils/formatting.py index 4a9681e93..ca83a0aad 100644 --- a/src/rez/utils/formatting.py +++ b/src/rez/utils/formatting.py @@ -14,7 +14,7 @@ import time -PACKAGE_NAME_REGSTR = "[a-zA-Z_0-9](\.?[a-zA-Z0-9_]+)*" +PACKAGE_NAME_REGSTR = "[a-zA-Z_0-9](\.?[a-zA-Z0-9_-]+)*" PACKAGE_NAME_REGEX = re.compile(r"^%s\Z" % PACKAGE_NAME_REGSTR) ENV_VAR_REGSTR = r'\$(\w+|\{[^}]*\})' From 1bfb112067692f3901ebc03cf77904f460af828c Mon Sep 17 00:00:00 2001 From: lambdaclan <47409392+lambdaclan@users.noreply.github.com> Date: Thu, 11 Jul 2019 11:49:40 +0900 Subject: [PATCH 3/3] fix(rez-pip): revert REGEX for package names that include a dash --- src/rez/utils/formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rez/utils/formatting.py b/src/rez/utils/formatting.py index ca83a0aad..4a9681e93 100644 --- a/src/rez/utils/formatting.py +++ b/src/rez/utils/formatting.py @@ -14,7 +14,7 @@ import time -PACKAGE_NAME_REGSTR = "[a-zA-Z_0-9](\.?[a-zA-Z0-9_-]+)*" +PACKAGE_NAME_REGSTR = "[a-zA-Z_0-9](\.?[a-zA-Z0-9_]+)*" PACKAGE_NAME_REGEX = re.compile(r"^%s\Z" % PACKAGE_NAME_REGSTR) ENV_VAR_REGSTR = r'\$(\w+|\{[^}]*\})'