Commit 5bbf4b3e authored by Jérome Perrin's avatar Jérome Perrin

component/pylint: include an ERP5 component patch

This use to be a monkey patch in product/ERP5Type/patches/pylint.py
but the modules imported by the monkey patch are different, move
the monkey patch as a slapos patch so that we don't have to deal
with multiple versions in the monkey patch
parent f540e95c
Pipeline #21357 failed with stage
in 0 seconds
From 46956eda499b1bdc41521273046e1f92aa0fd0d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 9 May 2022 16:18:34 +0200
Subject: [PATCH] Always consider absolute_import for ERP5 component modules
---
astroid/scoped_nodes.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py
index ea1dbdb8..e4c280ef 100644
--- a/astroid/scoped_nodes.py
+++ b/astroid/scoped_nodes.py
@@ -473,6 +473,9 @@ class Module(LocalsDictNodeNG):
if six.PY2:
@decorators_mod.cachedproperty
def _absolute_import_activated(self):
+ if (self.name.startswith('checkPythonSourceCode') or
+ self.name.startswith('erp5')):
+ return True
for stmt in self._locals.get('absolute_import', ()):
if isinstance(stmt, node_classes.ImportFrom) and stmt.modname == '__future__':
return True
--
2.35.1
...@@ -10,6 +10,7 @@ recipe = zc.recipe.egg:custom ...@@ -10,6 +10,7 @@ recipe = zc.recipe.egg:custom
egg = astroid egg = astroid
patches = patches =
${:_profile_base_location_}/astroid-six_moves_import_error.patch#35f50b5434c5c2c73b9cc206d87f3371 ${:_profile_base_location_}/astroid-six_moves_import_error.patch#35f50b5434c5c2c73b9cc206d87f3371
${:_profile_base_location_}/0001-Always-consider-absolute_import-for-ERP5-component-m.patch#201dfa59960187c0530d2fc7e0f2de42
patch-options = -p1 patch-options = -p1
patch-binary = ${patch:location}/bin/patch patch-binary = ${patch:location}/bin/patch
......
...@@ -638,7 +638,7 @@ Zope2 = 2.13.30+SlapOSPatched001 ...@@ -638,7 +638,7 @@ Zope2 = 2.13.30+SlapOSPatched001
## https://lab.nexedi.com/nexedi/slapos/merge_requests/648 ## https://lab.nexedi.com/nexedi/slapos/merge_requests/648
pylint = 1.5.0+SlapOSPatched002 pylint = 1.5.0+SlapOSPatched002
# astroid 1.4.1 breaks testDynamicClassGeneration # astroid 1.4.1 breaks testDynamicClassGeneration
astroid = 1.4.0+SlapOSPatched001 astroid = 1.4.0+SlapOSPatched002
wrapt = 1.14.1 wrapt = 1.14.1
lazy-object-proxy = 1.6.0:whl lazy-object-proxy = 1.6.0:whl
......
  • ( with erp5@fc05f43c )

  • This needs more work on ERP5 side, first because that monkey patch needed to be updated, but looking more at this I feel that it might be possible to make a pylint plugin with everything we have in Products/ERP5Type/patches/pylint.py

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment