Skip to content

Commit 7e887f0

Browse files
Allow building specfile in CentOS Stream without EPEL (#423)
Allow building specfile in CentOS Stream without EPEL CentOS Stream does not have EPEL packages in CBS Koji. Package typing-extensions is not available. Reviewed-by: Nikola Forró
2 parents b68f01b + 04839bb commit 7e887f0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ install_requires =
3939
importlib-metadata;python_version<"3.8"
4040
dataclasses;python_version<"3.7"
4141
rpm
42-
typing-extensions
42+
typing-extensions;python_version<"3.8"
4343
python_requires = >=3.6
4444
include_package_data = True
4545

specfile/types.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
import abc
55

6-
from typing_extensions import Protocol
7-
8-
9-
# define our own SupportsIndex type for older version of typing_extensions (EL 8)
10-
class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
11-
@abc.abstractmethod
12-
def __index__(self) -> int: ...
6+
try:
7+
from typing import SupportsIndex
8+
except ImportError:
9+
# define our own SupportsIndex type for older version of typing (Python 3.7 and older)
10+
from typing_extensions import Protocol
11+
12+
class SupportsIndex(Protocol, metaclass=abc.ABCMeta): # type: ignore [no-redef]
13+
@abc.abstractmethod
14+
def __index__(self) -> int: ...

0 commit comments

Comments
 (0)