Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Python < 3.8 and replace pkg_resources with importlib #37

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,20 @@ env:
jobs:
build:
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
include:
- python: "2.7"
container: "python:2.7"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
if: matrix.container == null
- name: Install dependencies
run: pip install -r requirements-test.txt
- name: Run tests
Expand Down
6 changes: 2 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
author = 'The Foreman'

try:
import pkg_resources
package = pkg_resources.require("obsah")[0]
version = package.version
release = package.version
from importlib import metadata
version = release = metadata.version('obsah')
except:
# The short X.Y version
version = ''
Expand Down
10 changes: 3 additions & 7 deletions obsah/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import sys
from collections import namedtuple
from functools import total_ordering
from importlib import resources

import yaml
import pkg_resources

try:
import argcomplete
Expand Down Expand Up @@ -207,12 +207,8 @@ def data_path():
"""
path = os.environ.get('OBSAH_DATA')
if path is None:
path = pkg_resources.resource_filename(__name__, 'data')
if not os.path.isabs(path):
# this is essentially a workaround for
# https://github.com/pytest-dev/pytest-xdist/issues/414
distribution = pkg_resources.get_distribution('obsah')
path = os.path.join(distribution.location, path)
# TODO: deprecated in 3.11
path = resources.path(__name__, 'data')

return path

Expand Down
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,26 @@ def find_package_data(package, data_dir):
author='The Foreman Project',
author_email='foreman-dev@googlegroups.com',
zip_safe=False,
python_requires=">=2.7, <4, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*",
python_requires=">=3.8, <4",

classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'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',
'Programming Language :: Python :: 3.12',
],

keywords='ansible foreman packaging koji brew mock',

packages=find_packages(exclude=['contrib', 'docs']),

install_requires=[
'ansible >= 2.5; python_version < "3.8"',
'ansible-core; python_version >= "3.8"',
'ansible-core',
],

extras_require={
Expand Down
Loading