Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Fix python module build method (#1072)
Browse files Browse the repository at this point in the history
* Fix python module build method

* Create requirements.txt

* Fix build module installation

* Update Makefile.mk

* Update Makefile.mk

Co-authored-by: Alyona Teyber <[email protected]>
  • Loading branch information
David P. Chassin and aivanova5 authored Jan 13, 2022
1 parent 1ee293f commit a16e9bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,7 @@ geodata.conf
gldcore/autotest/output.csv
python_extras/example/output.csv
*.egg
gridlabd.egg-info/
gldcore/link/python/dist/
gldcore/link/python/gridlabd.egg-info/
gridlabd.egg-*
16 changes: 10 additions & 6 deletions gldcore/link/python/Makefile.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
python-install: gldcore/build.h
@echo "python3 $(top_srcdir)/gldcore/link/python/setup.py --quiet install"
@( export SRCDIR=$(top_srcdir) ; python3 $(top_srcdir)/gldcore/link/python/setup.py --quiet install )
$(top_srcdir)/gldcore/link/python/dist/gridlabd-$(notdir $(prefix))-.tar.gz: gldcore/build.h
@echo "building $@"
@python3 -m pip install build 1>/dev/null
@( export SRCDIR=$(realpath $(top_srcdir)) ; python3 -m build $(top_srcdir)/gldcore/link/python 1>/dev/null )

python-install: $(top_srcdir)/gldcore/link/python/dist/gridlabd-$(notdir $(prefix))-.tar.gz
@echo "installing $@"
@python3 -m pip install --ignore-installed $(top_srcdir)/gldcore/link/python/dist/gridlabd-*.whl

python-clean:
@echo "python3 $(top_srcdir)/gldcore/link/python/setup.py clean"
@( export SRCDIR=$(top_srcdir) ; python3 $(top_srcdir)/gldcore/link/python/setup.py clean )
-rm -rf $(SRCDIR)/build/lib.*
@echo "uninstalling $(top_srcdir)/gldcore/link/python"
@python3 -m pip uninstall gridlabd -y || (echo "Use '. utilities/cleanwc' instead to clean this build."; exit 1)
5 changes: 4 additions & 1 deletion gldcore/link/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ def get_version(path=None):
if info[0] == "#define":
if info[1] == "BUILDNUM":
build = int(info[2])
elif info[1] == "BRANCH":
branch = info[2].replace('"','')
except:
build = 0
return '%d.%d.%d.%d' % (major,minor,patch,build)
# TODO: this needs to be revised to match PEP 440
return '%d.%d.%d-%d-%s' % (major,minor,patch,build,branch)

setup ( name = 'gridlabd',
version = get_version(),
Expand Down

0 comments on commit a16e9bf

Please sign in to comment.