mirror of
https://github.com/daylinmorgan/yartsu.git
synced 2024-12-21 20:10:45 -06:00
build: switch build framework to pyoxidizer
This commit is contained in:
parent
4aeddafc96
commit
8b28c000b3
3 changed files with 70 additions and 24 deletions
49
Makefile
49
Makefile
|
@ -1,6 +1,7 @@
|
||||||
SRC_FILES = $(wildcard yartsu/*)
|
SRC_FILES := $(wildcard yartsu/*)
|
||||||
|
VERSION := $(shell pdm show | grep "Installed" | awk -F ":" 'gsub(/ /, ""){print $$2}')
|
||||||
|
|
||||||
.PHONY: list lint build typing format dist check-tag
|
.PHONY: list lint build typing format dist check-tag release-asset
|
||||||
|
|
||||||
lint: format typing
|
lint: format typing
|
||||||
|
|
||||||
|
@ -14,8 +15,12 @@ check-tag:
|
||||||
@[ "${TAG}" ] || ( echo ">> TAG is not set"; exit 1 )
|
@[ "${TAG}" ] || ( echo ">> TAG is not set"; exit 1 )
|
||||||
@git describe HEAD --tags --exact-match
|
@git describe HEAD --tags --exact-match
|
||||||
|
|
||||||
release: build/yartsu check-tag
|
release-assets: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu
|
||||||
gh release create $(TAG) build/yartsu -p -d
|
tar czf build/yartsu-$(VERSION)-x86_64-linux.tar.gz \
|
||||||
|
build/x86_64-unknown-linux-gnu/release/install/yartsu
|
||||||
|
|
||||||
|
release: build/yartsu check-tag release-asset
|
||||||
|
gh release create $(TAG) build/yartsu-$(VERSION)-x86_64-linux.tar.gz -p -d
|
||||||
|
|
||||||
publish: dist
|
publish: dist
|
||||||
twine upload dist/*
|
twine upload dist/*
|
||||||
|
@ -25,17 +30,23 @@ dist:
|
||||||
|
|
||||||
build: build/yartsu
|
build: build/yartsu
|
||||||
|
|
||||||
build/yartsu: $(SRC_FILES)
|
build/shiv/yartsu: $(SRC_FILES)
|
||||||
mkdir -p build
|
mkdir -p build/shiv
|
||||||
shiv \
|
shiv \
|
||||||
-c yartsu \
|
-c yartsu \
|
||||||
-o ./build/yartsu \
|
-o ./build/shiv/yartsu \
|
||||||
--preamble scripts/preamble.py \
|
--preamble scripts/preamble.py \
|
||||||
--reproducible \
|
--reproducible \
|
||||||
.
|
.
|
||||||
|
|
||||||
install-bin: build/yartsu
|
build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu: $(SRC_FILES)
|
||||||
cp ./build/yartsu ~/bin
|
pyoxidizer build --release
|
||||||
|
|
||||||
|
install-bin: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu
|
||||||
|
cp ./build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ~/bin
|
||||||
|
|
||||||
|
install-shiv: build/shiv/yartsu
|
||||||
|
cp ./build/shiv/yartsu ~/bin
|
||||||
|
|
||||||
.PHONY: svg-docs theme-docs diff-docs demo-docs docs
|
.PHONY: svg-docs theme-docs diff-docs demo-docs docs
|
||||||
|
|
||||||
|
@ -45,7 +56,7 @@ theme-docs:
|
||||||
./scripts/theme-showcase-gen
|
./scripts/theme-showcase-gen
|
||||||
|
|
||||||
diff-docs:
|
diff-docs:
|
||||||
./scripts/code_svg_format_diff.py > docs/rich-diff.md
|
./scripts/code_svg_format_diff.py >docs/rich-diff.md
|
||||||
|
|
||||||
svg-docs:
|
svg-docs:
|
||||||
lolcat -F .5 -S 9 -f assets/logo.txt | yartsu -o assets/logo.svg
|
lolcat -F .5 -S 9 -f assets/logo.txt | yartsu -o assets/logo.svg
|
||||||
|
@ -54,13 +65,13 @@ svg-docs:
|
||||||
demo-docs:
|
demo-docs:
|
||||||
python -c \
|
python -c \
|
||||||
"from rich.console import Console; \
|
"from rich.console import Console; \
|
||||||
console = Console(force_terminal=True); \
|
console = Console(force_terminal=True); \
|
||||||
console.print('\n:snake: [b i]Emoji\'s!'); \
|
console.print('\n:snake: [b i]Emoji\'s!'); \
|
||||||
console.print(' [cyan]Nerd Fonts!');" \
|
console.print(' [cyan]Nerd Fonts!');" | \
|
||||||
| yartsu -w 25 -o assets/demo.svg
|
yartsu -w 25 -o assets/demo.svg
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build dist
|
rm -rf build dist capture.svg
|
||||||
|
|
||||||
# https://stackoverflow.com/a/26339924
|
# https://stackoverflow.com/a/26339924
|
||||||
list:
|
list:
|
||||||
|
|
|
@ -37,16 +37,15 @@ If you come across anything unexpected please submit an issue.
|
||||||
pip install yartsu
|
pip install yartsu
|
||||||
```
|
```
|
||||||
|
|
||||||
There is a standalone binary available for linux :
|
There is a standalone binary available for linux in the [releases](https://github.com/daylinmorgan/yartsu/releases).
|
||||||
Optionally with [`eget`](https://github.com/zyedidia/eget):
|
|
||||||
|
Optionally install with [`eget`](https://github.com/zyedidia/eget):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
eget daylinmorgan/yartsu
|
eget daylinmorgan/yartsu
|
||||||
```
|
```
|
||||||
|
|
||||||
This version will bundle dependencies and unpack them at `~/.shiv` at first runtime.
|
Otherwise you can download an extract manually to somewhere on your path.
|
||||||
You can change this location by setting the `SHIV_ROOT` environment variable.
|
|
||||||
See `shiv` for more info.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
36
pyoxidizer.bzl
Normal file
36
pyoxidizer.bzl
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# This file defines how PyOxidizer application building and packaging is
|
||||||
|
# performed. See PyOxidizer's documentation at
|
||||||
|
# https://pyoxidizer.readthedocs.io/en/stable/ for details of this
|
||||||
|
# configuration file format.
|
||||||
|
|
||||||
|
|
||||||
|
def make_exe():
|
||||||
|
|
||||||
|
dist = default_python_distribution()
|
||||||
|
python_config = dist.make_python_interpreter_config()
|
||||||
|
python_config.run_command = "from yartsu.cli import main;main()"
|
||||||
|
|
||||||
|
exe = dist.to_python_executable(name="yartsu", config=python_config)
|
||||||
|
|
||||||
|
exe.add_python_resources(exe.pip_install(["."]))
|
||||||
|
|
||||||
|
return exe
|
||||||
|
|
||||||
|
def make_embedded_resources(exe):
|
||||||
|
return exe.to_embedded_resources()
|
||||||
|
|
||||||
|
def make_install(exe):
|
||||||
|
# Create an object that represents our installed application file layout.
|
||||||
|
files = FileManifest()
|
||||||
|
|
||||||
|
# Add the generated executable to our install layout in the root directory.
|
||||||
|
files.add_python_resource("yartsu", exe)
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
||||||
|
# Tell PyOxidizer about the build targets defined above.
|
||||||
|
register_target("exe", make_exe)
|
||||||
|
# register_target("resources", make_embedded_resources, depends=["exe"], default_build_script=True)
|
||||||
|
register_target("install", make_install, depends=["exe"], default=True)
|
||||||
|
|
||||||
|
resolve_targets()
|
Loading…
Reference in a new issue