Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move handling of umu_version.json to pyproject.toml #154

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ FLATPAK ?= xfalse

.PHONY: all
ifeq ($(FLATPAK), xtrue)
all: version umu umu-launcher
all: umu umu-launcher
else
all: version umu umu-docs umu-launcher
all: umu umu-docs umu-launcher
endif

.PHONY: install
Expand All @@ -45,22 +45,6 @@ fix_shebangs:
find $(DESTDIR) -type f -name "*.sh" -exec sed -i '1s|^#!/usr/bin/env sh|#!$(SHELL_INTERPRETER)|' {} \;
find $(DESTDIR) -type f -name "umu-run" -exec sed -i '1s|^#!/usr/bin/env sh|#!$(SHELL_INTERPRETER)|' {} \;

# Special case, do this inside the source directory for release distribution
umu/umu_version.json: umu/umu_version.json.in
$(info :: Updating $(@) )
cp $(<) $(<).tmp
sed 's|##UMU_VERSION##|$(shell git describe --always --long --tags)|g' -i $(<).tmp
mv $(<).tmp $(@)

.PHONY: version
version: umu/umu_version.json

version-install: version
$(info :: Installing umu_version.json )
install -d $(DESTDIR)$(PYTHONDIR)/$(INSTALLDIR)
install -Dm 644 umu/umu_version.json -t $(DESTDIR)$(PYTHONDIR)/$(INSTALLDIR)


$(OBJDIR)/.build-umu-docs: | $(OBJDIR)
$(info :: Building umu man pages )
scdoc < docs/umu.1.scd > $(OBJDIR)/umu.1
Expand Down Expand Up @@ -92,9 +76,9 @@ umu-dist-install: umu-dist
$(PYTHON_INTERPRETER) -m installer --destdir=$(DESTDIR) $(OBJDIR)/*.whl

ifeq ($(FLATPAK), xtrue)
umu-install: version-install umu-dist-install
umu-install: umu-dist-install
else
umu-install: version-install umu-dist-install umu-docs-install
umu-install: umu-dist-install umu-docs-install
endif

ifeq ($(FLATPAK), xtrue)
Expand Down Expand Up @@ -154,7 +138,7 @@ $(RELEASEDIR):
mkdir -p $(@)

.PHONY: release
release: $(RELEASEDIR) | version
release: $(RELEASEDIR)
$(info :: Creating source distribution for release )
mkdir -p $(<)
rm -rf umu/__pycache__
Expand Down
20 changes: 18 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -42,7 +42,20 @@ dependencies = ["python-xlib>=0.33"]
umu-run = "umu.__main__:main"

[tool.hatch.version]
path = "umu/__init__.py"
source = "vcs"
fallback-version = "0.0.1"

[tool.hatch.build.hooks.vcs]
version-file = "umu/umu_version.json"
template = '''{{
"umu": {{
"versions": {{
"launcher": "{version}",
"runner": "{version}",
"runtime_platform": "sniper"
}}
}}
}}'''

[tool.hatch.build.targets.sdist]
exclude = [
Expand All @@ -64,6 +77,9 @@ exclude = [
"/umu/umu_test.py",
"/umu/umu_test_plugins.py",
]
artifacts = [
"umu/umu_version.json",
]

[tool.mypy]
python_version = "3.10"
Expand Down
9 changes: 0 additions & 9 deletions umu/umu_version.json.in

This file was deleted.