Added kernel userspace mismatch check and updated precommit config
This commit is contained in:
parent
3b6984a1fe
commit
205d2faf9d
2 changed files with 51 additions and 11 deletions
|
|
@ -3,17 +3,40 @@
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/python/black
|
- repo: https://github.com/python/black
|
||||||
rev: 22.3.0
|
rev: 23.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/fsfe/reuse-tool
|
- repo: https://github.com/fsfe/reuse-tool
|
||||||
rev: v0.12.1
|
rev: v1.1.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: reuse
|
- id: reuse
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.0.1
|
rev: v4.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
|
- repo: https://github.com/pycqa/pylint
|
||||||
|
rev: v2.17.4
|
||||||
|
hooks:
|
||||||
|
- id: pylint
|
||||||
|
name: pylint (library code)
|
||||||
|
types: [python]
|
||||||
|
args:
|
||||||
|
- --disable=consider-using-f-string
|
||||||
|
exclude: "^(docs/|examples/|tests/|setup.py$)"
|
||||||
|
- id: pylint
|
||||||
|
name: pylint (example code)
|
||||||
|
description: Run pylint rules on "examples/*.py" files
|
||||||
|
types: [python]
|
||||||
|
files: "^examples/"
|
||||||
|
args:
|
||||||
|
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
|
||||||
|
- id: pylint
|
||||||
|
name: pylint (test code)
|
||||||
|
description: Run pylint rules on "tests/*.py" files
|
||||||
|
types: [python]
|
||||||
|
files: "^tests/"
|
||||||
|
args:
|
||||||
|
- --disable=missing-docstring,consider-using-f-string,duplicate-code
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import adafruit_platformdetect
|
||||||
__version__ = "0.0.0-auto.0"
|
__version__ = "0.0.0-auto.0"
|
||||||
__repo__ = "https://github.com/adafruit/Adafruit_Python_Shell.git"
|
__repo__ = "https://github.com/adafruit/Adafruit_Python_Shell.git"
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-public-methods
|
# pylint: disable=too-many-public-methods
|
||||||
class Shell:
|
class Shell:
|
||||||
"""
|
"""
|
||||||
|
|
@ -563,6 +564,22 @@ class Shell:
|
||||||
)
|
)
|
||||||
self.prompt_reboot()
|
self.prompt_reboot()
|
||||||
|
|
||||||
|
def check_kernel_userspace_mismatch(self):
|
||||||
|
"""
|
||||||
|
Check if the userspace is 64-bit and kernel is 32-bit
|
||||||
|
"""
|
||||||
|
if self.is_arm64() and platform.architecture()[0] == "32bit":
|
||||||
|
print(
|
||||||
|
"Unable to compile driver because kernel space is 64-bit, but user space is 32-bit."
|
||||||
|
)
|
||||||
|
if self.is_raspberry_pi_os() and self.prompt(
|
||||||
|
"Add parameter to /boot/config.txt to use 32-bit kernel?"
|
||||||
|
):
|
||||||
|
self.reconfig("/boot/config.txt", "^.*arm_64bit.*$", "arm_64bit=0")
|
||||||
|
self.prompt_reboot()
|
||||||
|
else:
|
||||||
|
self.bail("Unable to continue while mismatch is present.")
|
||||||
|
|
||||||
# pylint: enable=invalid-name
|
# pylint: enable=invalid-name
|
||||||
|
|
||||||
def is_raspberry_pi_os(self):
|
def is_raspberry_pi_os(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue