Skip to content

Commit

Permalink
show version of running and installed xyzcad
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTesla committed Aug 2, 2024
1 parent 7087dbc commit 9366368
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
PROJ_SLUG = xyzcad
SHELL = bash

version=$(shell git describe --tags --abbrev=0)

build:
poetry version $(shell git describe --tags --abbrev=0)
echo "__version__ = \"$(version)\"" > ./$(PROJ_SLUG)/_version.py
poetry version $(version)
poetry build

lint:
Expand All @@ -26,6 +29,7 @@ publish:
poetry publish

clean:
echo "__version__ = \"0.0.0+devel\"" > ./$(PROJ_SLUG)/_version.py
poetry version 0.0.0+devel
rm -rf .pytest_cache \
rm -rf dist \
Expand Down
2 changes: 1 addition & 1 deletion demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ def cube(x, y, z):


# render.renderAndSave(cube, 'demo.stl', 1)
render.renderAndSave(f, "demo.stl", 0.05)
render.renderAndSave(f, "demo.stl", 0.5)

print(time.time() - t0)
1 change: 1 addition & 0 deletions xyzcad/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from xyzcad._version import __version__
1 change: 1 addition & 0 deletions xyzcad/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.0+devel"
12 changes: 7 additions & 5 deletions xyzcad/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from numba import njit, objmode, prange, types
from numba.typed import Dict, List
from stl import mesh
from xyzcad import __version__

tlt = [[[0]]] * 256
tlt[1] = [[0, 1, 2]]
Expand Down Expand Up @@ -830,11 +831,12 @@ def all_njit_func(func, res, tlt):

def renderAndSave(func, filename, res=1):
t0 = time.time()
# version = importlib.metadata.version('xyzcad')
print(__package__)
print(__name__)
version = importlib.metadata.version(__package__ or __name__)
print(f"running xyzcad version {version}")
version_run = __version__
try:
version_inst = importlib.metadata.version(__package__ or __name__)
except importlib.metadata.PackageNotFoundError as e:
version_inst = None
print(f"running xyzcad version {version_run} (installed: {version_inst})")

tlt_L = [List(e) for e in tlt]
verticesArray = all_njit_func(func, res, tlt_L)
Expand Down

0 comments on commit 9366368

Please sign in to comment.