DirectoryVersionScanner¶
- class chango.concrete.DirectoryVersionScanner(base_directory, unreleased_directory, directory_pattern=re.compile('(?P<uid>[^_]+)_(?P<date>[\\d-]+)'))¶
Bases:
VersionScannerImplementation of a version scanner that assumes that change notes are stored in subdirectories named after the version identifier.
- Parameters:
base_directory (
str|Path) –The base directory to scan for version directories.
Important
If the path is relative, it will be resolved relative to the directory of the calling module.
Example
If you build your
DirectoryVersionScannerwithin/home/user/project/chango.py, passingbase_directory="changes"will resolve to/home/user/project/changes.unreleased_directory (
str|Path) –The directory that contains unreleased changes.
Important
If
pathlib.Path.is_dir()returnsFalsefor this directory, it will be assumed to be a subdirectory of thebase_directory.directory_pattern (
str|re.Pattern, optional) – The pattern to match version directories against. Must contain one named groupuidfor the version identifier and a second named group for thedatefor the date of the version release in ISO format.
- base_directory¶
The base directory to scan for version directories.
- Type:
Path
- directory_pattern¶
The pattern to match version directories against.
- Type:
re.Pattern
- unreleased_directory¶
The directory that contains unreleased changes.
- Type:
Path
- get_available_versions(start_from=None, end_at=None)¶
Implementation of
chango.abc.VersionScanner.get_available_versions().Important
Limiting the version range by
start_fromandend_atis based on lexicographical comparison of the version identifiers.- Returns:
The available versions within the specified range.
- Return type:
Tuple[
Version]
- get_latest_version()¶
Implementation of
chango.abc.VersionScanner.get_latest_version().Important
In case of multiple releases on the same day, lexicographical comparison of the version identifiers is employed.
- Returns:
The latest version
- Return type:
- has_unreleased_changes()¶
Implementation of
chango.abc.VersionScanner.has_unreleased_changes(). Checks ifunreleased_directorycontains any files.- Returns:
Trueif there are unreleased changes,Falseotherwise.- Return type:
bool