Skip to content

Commit

Permalink
Merge pull request #226 from jan-cerny/py36
Browse files Browse the repository at this point in the history
Make openscap-report compatible with Python 3.6
  • Loading branch information
Honny1 authored Apr 23, 2024
2 parents ae91b05 + 93f853e commit f176ea8
Show file tree
Hide file tree
Showing 31 changed files with 1,376 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ jobs:
image: quay.io/centos/centos:stream8
steps:
- name: Install Deps
run: dnf install -y python38 python38-devel python38-setuptools rpm-build
run: dnf install -y python3 python3-devel python3-setuptools rpm-build
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: python3.8 setup.py bdist_rpm --requires=python38-lxml,python38-jinja2 --build-requires=python38-devel,python38-setuptools --python=python3.8
run: python3 setup.py bdist_rpm --requires=python3-lxml,python3-jinja2 --build-requires=python3-devel,python3-setuptools
- name: RPM install
run: dnf install -y ./dist/openscap-report-*.noarch.rpm
- name: Test parameter -h
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Installation from source

Requirements:

* Python 3.8+
* Python 3.6+
* `lxml`_
* `jinja2`_

Expand Down
17 changes: 11 additions & 6 deletions openscap_report/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Copyright 2022, Red Hat, Inc.
# SPDX-License-Identifier: LGPL-2.1-or-later

from importlib.metadata import PackageNotFoundError, version
from os import path

DISTRIBUTION_NAME = "openscap-report"
try:
__version__ = version(DISTRIBUTION_NAME)
except PackageNotFoundError:
__version__ = f"Version is unavailable. Please install {DISTRIBUTION_NAME}!"
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version(DISTRIBUTION_NAME)
except PackageNotFoundError:
__version__ = f"Version is unavailable. Please install {DISTRIBUTION_NAME}!"
except ImportError:
import pkg_resources
try:
__version__ = pkg_resources.get_distribution(DISTRIBUTION_NAME).version
except pkg_resources.DistributionNotFound:
__version__ = f"Version is unavailable. Please install {DISTRIBUTION_NAME}!"
4 changes: 4 additions & 0 deletions openscap_report/dataclasses/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from dataclasses import asdict, dataclass, field, replace
except ImportError:
from .dataclasses import asdict, dataclass, field, replace
Loading

0 comments on commit f176ea8

Please sign in to comment.