diff --git a/specfile/sources.py b/specfile/sources.py index 2f3f82c..34b6675 100644 --- a/specfile/sources.py +++ b/specfile/sources.py @@ -66,6 +66,12 @@ def comments(self) -> Comments: """List of comments associated with the source.""" ... + @property + @abstractmethod + def valid(self) -> bool: + """Whether the source is not located in a false branch of a condition.""" + ... + class TagSource(Source): """Class that represents a source backed by a spec file tag.""" @@ -161,6 +167,11 @@ def comments(self) -> Comments: """List of comments associated with the source.""" return self._tag.comments + @property + def valid(self) -> bool: + """Whether the source is not located in a false branch of a condition.""" + return self._tag.valid + class ListSource(Source): """Class that represents a source backed by a line in a %sourcelist section.""" @@ -224,6 +235,11 @@ def comments(self) -> Comments: """List of comments associated with the source.""" return self._source.comments + @property + def valid(self) -> bool: + """Whether the source is not located in a false branch of a condition.""" + return self._source.valid + class Sources(collections.abc.MutableSequence): """Class that represents a sequence of all sources."""