Skip to content

Commit 6948d3f

Browse files
committed
directly edit pyproject toml
1 parent 52bc196 commit 6948d3f

6 files changed

+16
-18
lines changed

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ If you find a bug, we recommend that you post an [issue](https://github.com/delv
66

77
## Release steps
88

9-
1. [ ] Double-check that the version in `contracts/src/libraries/Constants.sol` matches the version to be tagged. If it doesn't, open a PR to update the version before tagging.
9+
1. [ ] Double-check that the version in `contracts/src/libraries/Constants.sol` matches the version to be tagged. If it doesn't, update it and run `make build` to automatically update the hyperdrivetypes `pyproject.toml` file. Merge a PR with these changes before tagging.
1010
2. [ ] Tag the release with `git tag vX.Y.Z`.
11-
3. [ ] Push the release to Github with `git push --tags`
12-
4. [ ] Go to the `releases` tab in Github and add the new tag as a release. Click the "Generate Release Notes" button to generate release notes.
11+
3. [ ] Push the release to Github with `git push --tags`.
12+
4. [ ] Go to the `releases` tab in Github and add the new tag as a release. Click the "Generate Release Notes" button to generate release notes.

python/hyperdrivetypes/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
from hyperdrivetypes import *
2-
3-
__version__ = "v1.0.18"

python/hyperdrivetypes/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "hyperdrivetypes"
3-
dynamic = ["version"]
3+
version = "1.0.18"
44

55
# Authors are the current, primary stewards of the repo
66
# contributors can be found on github

scripts/build-hyperdrivetypes-wheel.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22

3-
# Check the version of hyperdrivetypes and hyperdrive
4-
# this will set an environment variable with the result
5-
source scripts/verify-hyperdrivetypes-version.sh
3+
# Set the python project version to match the hyperdrive version
4+
source scripts/set-hyperdrivetypes-version.sh
65

7-
# Check if the environment variable was set
6+
# Just in case, check the versions match
7+
source scripts/verify-hyperdrivetypes-version.sh
88
if [ -z "$HYPERDRIVE_VERSIONS_MATCH" ]; then
99
echo "Environment variable HYPERDRIVE_VERSIONS_MATCH is not set. Exiting with failure."
1010
exit 1

scripts/set-hyperdrivetypes-version.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ echo "get hyperdrive version"
44

55
# Extract version using sed by reading from the file
66
HYPERDRIVE_FILE="contracts/src/libraries/Constants.sol"
7-
VERSION=$(sed -n -E 's/.*VERSION = "(v[0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$HYPERDRIVE_FILE")
7+
VERSION=$(sed -n -E 's/.*VERSION = "v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$HYPERDRIVE_FILE")
88

99
# Append the version to hyperdrivetypes
10-
HYPERDRIVETYPES_FILE="python/hyperdrivetypes/__init__.py"
11-
echo "found version: $VERSION"
10+
HYPERDRIVETYPES_FILE="python/hyperdrivetypes/pyproject.toml"
11+
echo "found version: v$VERSION"
1212
echo "writing to $HYPERDRIVETYPES_FILE"
1313
# Check the operating system to use the correct sed syntax
1414
if [[ "$OSTYPE" == "darwin"* ]]; then
1515
# macOS
16-
sed -i '' -E "s/^(__version__ = \")v[0-9]+\.[0-9]+\.[0-9]+(\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE"
16+
sed -i '' -E "s/^(version = \")[0-9]+\.[0-9]+\.[0-9]+(\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE"
1717
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
1818
# Linux
19-
sed -i -E "s/^(__version__ = \")v[0-9]+\.[0-9]+\.[0-9]+(\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE"
19+
sed -i -E "s/^(version = \")[0-9]+\.[0-9]+\.[0-9]+(\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE"
2020
else
2121
echo "Unsupported OS: $OSTYPE"
2222
exit 1

scripts/verify-hyperdrivetypes-version.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
# Extract version from hyperdrive
44
constants_file="contracts/src/libraries/Constants.sol"
5-
VERSION_CONSTANTS=$(sed -n -E 's/.*VERSION = "(v[0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$constants_file")
5+
VERSION_CONSTANTS=$(sed -n -E 's/.*VERSION = "v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$constants_file")
66

77
# Extract version from hyperdrivetypes
8-
init_file="python/hyperdrivetypes/__init__.py"
9-
VERSION_INIT=$(sed -n -E 's/__version__ = "(v[0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$init_file")
8+
init_file="python/hyperdrivetypes/pyproject.toml"
9+
VERSION_INIT=$(sed -n -E 's/version = "([0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$init_file")
1010

1111
# Compare versions
1212
if [ "$VERSION_CONSTANTS" == "$VERSION_INIT" ]; then

0 commit comments

Comments
 (0)