Skip to content

Commit

Permalink
Allow building specfile in CentOS Stream
Browse files Browse the repository at this point in the history
CentOS Stream does not have EPEL packages.
Package typing-extensions is not available.
  • Loading branch information
majamassarini committed Nov 12, 2024
1 parent b68f01b commit d9f95ca
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_extensions (EL 8)
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 d9f95ca

Please sign in to comment.