Skip to content

Commit

Permalink
Merge pull request #7270 from yan12125/conditionalize-importlib-resou…
Browse files Browse the repository at this point in the history
…rces

Conditionalize use of importlib_resources to 3.9 or older.
  • Loading branch information
p12tic committed Dec 20, 2023
2 parents 3261999 + 4decac4 commit 40395e8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions common/code_spelling_ignore_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ ie
iff
i'm
impl
importlib
ina
incrementing
indextemplates
Expand Down
10 changes: 8 additions & 2 deletions master/buildbot/www/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@
#
# Copyright Buildbot Team Members


import importlib_resources
import sys

from twisted.web import static

from buildbot.util import bytes2unicode

if sys.version_info[:2] >= (3, 9):
# We need importlib.resources.files, which is added in Python 3.9
# https://docs.python.org/3/library/importlib.resources.html
import importlib.resources as importlib_resources
else:
import importlib_resources


class Application:

Expand Down
1 change: 1 addition & 0 deletions master/docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ ie
img
implementers
impls
importlib
incoherencies
incrementing
Indices
Expand Down
2 changes: 1 addition & 1 deletion master/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def define_plugin_entries(groups):
'Jinja2 >= 2.1',
'msgpack >= 0.6.0',
"croniter >= 1.3.0",
'importlib-resources >= 5',
'importlib-resources >= 5; python_version < "3.9"',
# required for tests, but Twisted requires this anyway
'zope.interface >= 4.1.1',
'sqlalchemy >= 1.3.0, < 1.5',
Expand Down
1 change: 1 addition & 0 deletions newsfragments/importlib_resources.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Conditionalize importlib_resources for Python <3.9 only, for interoperability with more modern Pythons and without that module.
2 changes: 1 addition & 1 deletion requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ hyperlink==21.0.0
idna==2.10 # pyup: ignore (conflicts with moto on master)
imagesize==1.4.1
importlib-metadata==7.0.0
importlib-resources==6.1.1
importlib-resources==6.1.1; python_version < "3.9"
incremental==22.10.0
ipaddress==1.0.23
isort==4.3.21 # pyup: ignore (until https://github.com/PyCQA/pylint/pull/3725 is merged)
Expand Down

0 comments on commit 40395e8

Please sign in to comment.