Skip to content

Commit

Permalink
Change: remove support for python 3.7 and 3.8
Browse files Browse the repository at this point in the history
Also, add support for python 3.10 and 3.11
SC-904
  • Loading branch information
jjnicola committed Aug 18, 2023
1 parent 1fea222 commit c167f05
Show file tree
Hide file tree
Showing 9 changed files with 314 additions and 264 deletions.
6 changes: 3 additions & 3 deletions .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ RUN apt-get update && \
apt-get remove --purge --auto-remove -y && \
rm -rf /var/lib/apt/lists/*

RUN python -m pip install --upgrade pip && \
python3 -m pip install poetry
RUN python -m pip install --upgrade --break-system-packages pip && \
python3 -m pip install --break-system-packages poetry

RUN rm -rf dist && poetry build -f wheel

Expand Down Expand Up @@ -44,7 +44,7 @@ RUN addgroup --gid 1001 --system notus && \
COPY --from=builder /source/dist/* /notus/
COPY .docker/entrypoint.sh /usr/local/bin/entrypoint

RUN python3 -m pip install /notus/*
RUN python3 -m pip install --break-system-packages /notus/*

RUN apt-get purge -y gcc python3-dev && apt-get autoremove -y

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Check with black, pylint and pontos.version
Expand All @@ -31,8 +30,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,4 @@ valid-metaclass-classmethod-first-arg=mcs

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
9 changes: 7 additions & 2 deletions notus/scanner/models/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ class PackageAdvisories:
)

is_comparable = (
lambda a, b: a.compare(b) != PackageComparison.NOT_COMPARABLE
lambda a, b: a.compare( # pylint: disable=unnecessary-lambda-assignment
b
)
!= PackageComparison.NOT_COMPARABLE
)

comparison_map = {
Expand Down Expand Up @@ -209,7 +212,9 @@ def add_advisory_for_package(
if verifier not in self.comparison_map:
verifier = ">="
advisories = self.get_package_advisories_for_package(package)
is_vulnerable = lambda other: self.comparison_map[verifier](
is_vulnerable = lambda other: self.comparison_map[ # pylint: disable=unnecessary-lambda-assignment
verifier
](
package, other
)

Expand Down
536 changes: 290 additions & 246 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ classifiers=[
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -41,7 +39,7 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.9"
paho-mqtt = ">=1.5.1"
psutil = "^5.9"
python-gnupg = "^0.5.1"
Expand Down
4 changes: 2 additions & 2 deletions smoketest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN apt-get update && \
python3-pip && \
apt-get remove --purge --auto-remove -y && \
rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install poetry
RUN python3 -m pip install --break-system-packages poetry
RUN rm -rf dist && poetry build -f wheel

# we want to start ospd-openvas, mosquitto, redis as well as notus on the same
Expand Down Expand Up @@ -63,7 +63,7 @@ RUN apt-get update && \

COPY --from=builder /source/dist/* /usr/local/src/notus/

RUN python3 -m pip install /usr/local/src/notus/*
RUN python3 -m pip install --break-system-packages /usr/local/src/notus/*

RUN apt-get purge -y gcc python3-dev && apt-get autoremove -y

Expand Down
4 changes: 3 additions & 1 deletion tests/loader/test_gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class GpgTest(TestCase):
@patch("pathlib.Path")
def test_reload(self, gmock, pathmock: Path):
def on_failure(_: Optional[Dict[str, str]]) -> Dict[str, str]:
raise Exception("verification_failed")
raise Exception( # pylint: disable=broad-exception-raised
"verification_failed"
)

omock = Mock()
emock = Mock()
Expand Down
8 changes: 6 additions & 2 deletions tests/test_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ def per_symbol(
"""
returns not_in_result and in result
"""
greater = lambda: name.replace("15", "16")
smaller = lambda: name.replace("15", "14")
greater = lambda: name.replace( # pylint: disable=unnecessary-lambda-assignment
"15", "16"
)
smaller = lambda: name.replace( # pylint: disable=unnecessary-lambda-assignment
"15", "14"
) # pylint: disable=unnecessary-lambda-assignment
if not verifier:
return [greater(), name], [smaller()]
if verifier == ">":
Expand Down

0 comments on commit c167f05

Please sign in to comment.