python-tools.sh: Fix __init__.py linter complaints
The __init__.py files as gnerated by python-tools.sh contain multiple issues, fix them:
- Make the machinery fail if the same type name is imported from different modules- Support relative imports from .Module import Module instead of having to use the entire module path as import source- Import types explicitly re-exported with "as":
from .Module import Module as ModuleOtherwise ruff will regard the type as "imported but not used"- Add "# ruff: noqa: E501" near the top. The import lines can get long and are beyond manual control (except for renaming the modules themselves, that is). This can cause ruff to fail, so get it to accept long lines in __init__.py. The style violation doesn't make much of a difference in generated code, anyway, because nobody reads that. Plus what's happening in the code isn't rocket science, so good style wouldn't help much with understanding, either.This promptly digs up two symbol name conflicts lib.pm.dpkg and lib.pm.rpm. Fix them along with this commit to keep it from breaking the build.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
22d87143a3
commit
fc6f2fbb65
4 changed files with 32 additions and 18 deletions
|
|
@ -20,7 +20,7 @@ include $(JWBDIR)/make/py-rules.mk
|
|||
ifeq ($(PY_UPDATE_INIT_PY),true)
|
||||
__init__.py: $(PY_INIT_TMPL) $(filter-out __init__.py,$(PY_SRC_PY))
|
||||
if [ "$(PY_INIT_TMPL)" ]; then cat "$(PY_INIT_TMPL)" > $@.tmp; else > $@.tmp; fi
|
||||
/bin/bash +H $(JWB_SCRIPT_DIR)/python-tools.sh create-init -m $(PY_MOD) -e "$(PY_SED_EXTRACT_EXPORT)" \
|
||||
set -e -o pipefail; /bin/bash $(JWB_SCRIPT_DIR)/python-tools.sh create-init -m . -e "$(PY_SED_EXTRACT_EXPORT)" \
|
||||
$(filter-out __init__.py,$(PY_ALL_PY)) $(SUBDIRS_TO_ITERATE) | $(PY_INIT_FILTER) | tee -a $@.tmp
|
||||
mv $@.tmp $@
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue