Skip to content

Commit

Permalink
Allow building specfile in CentOS Stream without EPEL
Browse files Browse the repository at this point in the history
When building CentOS Stream in CBS Koji,
EPEL packages are not available.
There is no package typing-extensions.

Co-authored-by: Nikola Forró <[email protected]>
  • Loading branch information
majamassarini and nforro committed Nov 12, 2024
1 parent b68f01b commit 04839bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ install_requires =
importlib-metadata;python_version<"3.8"
dataclasses;python_version<"3.7"
rpm
typing-extensions
typing-extensions;python_version<"3.8"
python_requires = >=3.6
include_package_data = True

Expand Down
16 changes: 9 additions & 7 deletions specfile/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

import abc

from typing_extensions import Protocol


# define our own SupportsIndex type for older version of typing_extensions (EL 8)
class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
@abc.abstractmethod
def __index__(self) -> int: ...
try:
from typing import SupportsIndex
except ImportError:
# define our own SupportsIndex type for older version of typing (Python 3.7 and older)
from typing_extensions import Protocol

class SupportsIndex(Protocol, metaclass=abc.ABCMeta): # type: ignore [no-redef]
@abc.abstractmethod
def __index__(self) -> int: ...

0 comments on commit 04839bb

Please sign in to comment.