specfile.prep
PrepMacro
class PrepMacro(ABC)
Class that represents a %prep macro.
Attributes:
name
- Literal name of the macro.options
- Options of the macro.
__init__
def __init__(name: str,
options: Options,
delimiter: str,
prefix: Optional[str] = None,
suffix: Optional[str] = None,
preceding_lines: Optional[List[str]] = None) -> None
Initializes a prep macro object.
Arguments:
name
- Literal name of the macro.options
- Options of the macro.delimiter
- Delimiter separating name and option string.prefix
- Characters preceding the macro on a line.suffix
- Characters following the macro on a line.preceding_lines
- Lines of the %prep section preceding the macro.
SetupMacro
class SetupMacro(PrepMacro)
Class that represents a %setup macro.
PatchMacro
class PatchMacro(PrepMacro)
Class that represents a %patch macro.
number
@property
def number() -> int
Number of the %patch macro.
AutosetupMacro
class AutosetupMacro(PrepMacro)
Class that represents an %autosetup macro.
AutopatchMacro
class AutopatchMacro(PrepMacro)
Class that represents an %autopatch macro.
PrepMacros
class PrepMacros(UserList[PrepMacro])
Class that represents a list of %prep macros.
Attributes:
data
- List of individual %prep macros.
__init__
def __init__(data: Optional[List[PrepMacro]] = None,
remainder: Optional[List[str]] = None) -> None
Initializes a prep macros object.
Arguments:
data
- List of individual %prep macros.remainder
- Leftover lines in the section.
Prep
class Prep(collections.abc.Container)
Class that represents a %prep section.
Attributes:
macros
- List of individual %prep macros.
add_patch_macro
def add_patch_macro(number: Optional[int] = None,
old_style_number: bool = False,
**kwargs: Any) -> None
Adds a new %patch macro with given number and options.
Arguments:
number
- Optional macro number.old_style_number
- Whether the number should be part of macro name.P
- The -P option (patch number).p
- The -p option (strip number).R
- The -R option (reverse).E
- The -E option (remove empty files).b
- The -b option (backup).z
- The -z option (suffix).F
- The -F option (fuzz factor).d
- The -d option (working directory).old_style_number
0 - The -o option (output file).old_style_number
1 - The -Z option (set UTC times).
remove_patch_macro
def remove_patch_macro(number: int) -> None
Removes a %patch macro with given number.
Arguments:
number
- Macro number.
parse
@classmethod
def parse(cls, section: Section) -> "Prep"
Parses a section into a Prep
object.
Arguments:
section
- %prep section.
Returns:
New instance of Prep
class.
get_raw_section_data
def get_raw_section_data() -> List[str]
Reconstructs section data from Prep
object.
Returns:
List of lines forming the reconstructed section data.