-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
299 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import subprocess | ||
from functools import cache | ||
|
||
MARKER = '<HATCH_LATEST_VERSION>' | ||
SEMVER_PARTS = 3 | ||
|
||
# Ignore the current documentation environment so that the version | ||
# command can execute as usual in the default build environment | ||
os.environ.pop('HATCH_ENV_ACTIVE', None) | ||
|
||
|
||
@cache | ||
def get_latest_version(): | ||
output = subprocess.check_output(['hatch', '--no-color', 'version']).decode('utf-8').strip() | ||
|
||
version = output.replace('dev', '') | ||
parts = list(map(int, version.split('.'))) | ||
major, minor, patch = parts[:SEMVER_PARTS] | ||
if len(parts) > SEMVER_PARTS: | ||
patch -= 1 | ||
|
||
return f'{major}.{minor}.{patch}' | ||
|
||
|
||
def on_page_read_source(page, config): | ||
with open(page.file.abs_src_path, encoding='utf-8') as f: | ||
return f.read().replace(MARKER, get_latest_version()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Release assets | ||
|
||
----- | ||
|
||
This directory stores files related to building binaries and installers for each platform. |
Oops, something went wrong.