more version examples
parent
7202cf3da3
commit
b5c4d12c4c
1 changed files with 8 additions and 3 deletions
|
|
@ -80,14 +80,20 @@ clean:
|
||||||
|
|
||||||
### External Data
|
### External Data
|
||||||
|
|
||||||
Get the version from a bash source file without spaces around "="
|
Get the version from a comment header with `## Version: 0.0.1` format
|
||||||
|
|
||||||
|
```makefile
|
||||||
|
version := $(shell grep '^\#\# Version:' src/myfile.sh | cut -d' ' -f3)
|
||||||
|
```
|
||||||
|
|
||||||
|
Get the version from a source file with `_VERSION="0.0.1"` format (shell)
|
||||||
|
|
||||||
```makefile
|
```makefile
|
||||||
leftparen := (
|
leftparen := (
|
||||||
version := $(shell eval $$(grep ^_VERSION= src/myfile.sh); echo $$_VERSION| awk -F' \\$(leftparen)' '{print $$1}' | sed "s/ /-/g" )
|
version := $(shell eval $$(grep ^_VERSION= src/myfile.sh); echo $$_VERSION| awk -F' \\$(leftparen)' '{print $$1}' | sed "s/ /-/g" )
|
||||||
```
|
```
|
||||||
|
|
||||||
Same thing but the file is a Python style source with spaces
|
Get the version from a source file with `_version_ = "0.0.1"` format (python)
|
||||||
|
|
||||||
```makefile
|
```makefile
|
||||||
version := $(shell grep ^__version__ src/version.py | awk '{print $$3}')
|
version := $(shell grep ^__version__ src/version.py | awk '{print $$3}')
|
||||||
|
|
@ -144,6 +150,5 @@ pyvenv:
|
||||||
|
|
||||||
install-python: install-main
|
install-python: install-main
|
||||||
sed -i "1s/python/${PYSHORT}/" "$(DESTDIR)$(BINPREFIX)/${bin_name}"
|
sed -i "1s/python/${PYSHORT}/" "$(DESTDIR)$(BINPREFIX)/${bin_name}"
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue