Skip to content

Commit

Permalink
Drop VERSION file.
Browse files Browse the repository at this point in the history
Signed-off-by: Giacomo Leidi <goodoldpaul@autistici.org>
  • Loading branch information
fishinthecalculator committed Oct 26, 2024
1 parent 044243a commit 0e0b92b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 21 deletions.
4 changes: 2 additions & 2 deletions ocui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from appdirs import AppDirs
from textual import log

from ocui.utils import get_version
from ocui import __version__

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -45,7 +45,7 @@


def get_config_path() -> Path | None:
dirs = AppDirs(appname="ocui", version=get_version())
dirs = AppDirs(appname="ocui", version=__version__)

for config_path in [
Path(dirs.user_config_dir, "ocui.toml").absolute(),
Expand Down
1 change: 0 additions & 1 deletion ocui/res/VERSION

This file was deleted.

5 changes: 3 additions & 2 deletions ocui/ui/base/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from textual.app import ComposeResult
from textual.widgets import Header, Static, Markdown

from ocui.utils import get_logo, get_version
from ocui import __version__
from ocui.utils import get_logo


class OcuiHeader(Header):
Expand All @@ -27,7 +28,7 @@ def _format_value(context: str, version: str, user: str):
def compose(self) -> ComposeResult:
"""Create child widgets of the context widget."""
yield Markdown(
OcuiContext._format_value("local", get_version(), os.environ["USER"])
OcuiContext._format_value("local", __version__, os.environ["USER"])
)


Expand Down
5 changes: 0 additions & 5 deletions ocui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ def get_logo() -> str:
return read_resource(logo_ref)


def get_version() -> str:
version_ref = OCUI_RESOURCES / "VERSION"
return read_resource(version_ref)


def get_egg() -> str:
egg_ref = OCUI_RESOURCES / "egg"
return read_resource(egg_ref)
5 changes: 3 additions & 2 deletions scripts/generate_badges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
set -eu

project_root="$(cd "$(dirname "$(dirname "$0")")" && pwd)"
init_py="${project_root}/ocui/__init__.py"
imgs="${project_root}/.img"
license="${imgs}/license.svg"
python="${imgs}/python.svg"
pypi="${imgs}/pypi.svg"

get_version () {
cat "${project_root}/ocui/res/VERSION"
cat "$init_py" | grep version | sed -E 's/^.*__version__ = "(.*)".*$/\1/'
}

python -m pybadges \
--left-text="python" \
--right-text="3.10, 3.11" \
--right-text="3.10, 3.11, 3.12" \
--whole-link="https://www.python.org/" \
--logo='https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/python.svg' \
--embed-logo=yes > "${python}"
Expand Down
13 changes: 4 additions & 9 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -eu

myself="$(basename "$0")"
version_file="$(pwd)/ocui/res/VERSION"
init_py="$(pwd)/ocui/__init__.py"
channel_scm="$(pwd)/.guix/modules/ocui.scm"
generate_badges="$(pwd)/scripts/generate_badges.sh"
Expand Down Expand Up @@ -65,17 +64,14 @@ validate-bump-type() {
}

current-version() {
cat "${version_file}"
cat "$init_py" | grep version | sed -E 's/^.*__version__ = "(.*)".*$/\1/'
}

release-new-version() {
current="$(current-version)"
next="$(pysemver bump "$1" "$current")"
echo "RELEASING VERSION: ${next}"

[ "$verbose" = "1" ] && echo "Updating ${version_file}..."
[ "$dryrun" = "0" ] && printf "%s" "$next" >"$version_file"

[ "$verbose" = "1" ] && echo "Updating ${init_py}..."
[ "$dryrun" = "0" ] && sed -i -E "s/__version__.*=.*\"${current}\"$/__version__ = \"${next}\"/" "$init_py"

Expand All @@ -89,10 +85,9 @@ release-new-version() {

fi

[ "$verbose" = "1" ] && echo "Committing ${pyproject_toml}, ${channel_scm} and ${version_file}"
[ "$dryrun" = "0" ] && git add "${pyproject_toml}" \
"${channel_scm}" \
"${version_file}" && \
[ "$verbose" = "1" ] && echo "Committing ${init_py} and ${channel_scm}"
[ "$dryrun" = "0" ] && git add "${init_py}" \
"${channel_scm}" && \
git commit -m "Release v${next}."

[ "$verbose" = "1" ] && echo "Tagging Git HEAD with v${next}"
Expand Down

0 comments on commit 0e0b92b

Please sign in to comment.