Commit cc713466 authored by Thomas Nadovich's avatar Thomas Nadovich 🌸
Browse files

added new files for binary build

parent 3630816e
Pipeline #16798 passed with stages
in 1 minute and 14 seconds
......@@ -13,6 +13,7 @@ build/
develop-eggs/
dist/
downloads/
packaging/
eggs/
.eggs/
lib/
......@@ -23,6 +24,14 @@ var/
*.egg-info/
.installed.cfg
*.egg
.idea/
# Auto-generated requirements.txt file
requirements.txt
#pipenv stuff
pipenv
pyproject.toml
# PyInstaller
# Usually these files are written by a python script from a template
......@@ -103,12 +112,16 @@ ENV/
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# debian build artifacts
scripts/debian/control
scripts/debian/changelog
scripts/debian/*.install
.vscode
*.csv
*.eds
bin/
# vim swap files
*.swp
*.swo
SHELL := /bin/bash
WORKSPACE_DIR=$(shell git rev-parse --show-toplevel)
VERSION=$(shell cat objdict_generate/version.py | grep --color=never -oh '[0-9]\+\.[0-9]\+\.[0-9]\+')
BUILD_DIR=${WORKSPACE_DIR}/build
DIST_DIR=${WORKSPACE_DIR}/dist
PACKAGING_DIR=${WORKSPACE_DIR}/packaging
DEBIAN_DIR=${WORKSPACE_DIR}/scripts/debian
NAME=$(shell basename -s .git `git config --get remote.origin.url`)
USERNAME=$(shell git config user.name)
EMAIL=$(shell git config user.email)
OUTDIR=$(PACKAGING_DIR)/$(NAME)-$(VERSION)
DEBIAN_GENERATED_FILES=$(DEBIAN_DIR)/$(NAME).install $(DEBIAN_DIR)/control
RELEASE_TYPE=dev
DEB=$(PACKAGING_DIR)/$(NAME)_$(VERSION)_amd64.deb
PROGRAM_OUTDIR= bin/Debug/
ENTRYPOINT=objdict_generate/scripts/objdict_generate.py
EXE = $(DIST_DIR)/$(NAME)
all: build
.PHONY: build
build: $(EXE)
$(EXE): $(ENTRYPOINT)
pyinstaller $< --onefile -n $(NAME)
.PHONY: package
package: $(DEB)
$(DEB): build $(DEBIAN_GENERATED_FILES)
rm -f $(DEBIAN_DIR)/changelog
export DEBEMAIL=$(EMAIL)
export DEBFULLNAME=$(USERNAME)
mkdir -p $(OUTDIR)/bin/usr/bin
cp $(DIST_DIR)/$(NAME) $(OUTDIR)/bin/usr/bin/
cd $(DEBIAN_DIR)/.. && dch --create --package "$(NAME)" -v $(VERSION) -D UNRELEASED "Latest update"
cp -r $(DEBIAN_DIR) $(OUTDIR)
cd $(OUTDIR) && debuild -us -uc
$(DEBIAN_DIR)/$(NAME).install:
echo "./bin/* ./" > $(DEBIAN_DIR)/$(NAME).install
$(DEBIAN_DIR)/control: $(DEBIAN_DIR)/control.tmpl
NAME=$(NAME) envsubst < $(DEBIAN_DIR)/control.tmpl > $(DEBIAN_DIR)/control
.PHONY: clean
clean:
-rm -rf $(BUILD_DIR) $(PACKAGING_DIR) $(DIST_DIR)
-rm -f $(DEBIAN_DIR)/control
.PHONY: install
install: $(DEB)
sudo dpkg -i $<
.PHONY: uninstall
uninstall:
sudo apt remove $(NAME)
.PHONY: release
release:
git tag -a ${RELEASE_TYPE}-$(VERSION) -m "Release ${RELEASE_TYPE}-${VERSION}"
git push --tags
.PHONY: setup
setup: ~/.pyenv
sudo apt-get update
sudo apt-get install -y \
python3-dev \
python3-pip \
devscripts \
debhelper \
git \
make \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
wget \
curl \
llvm \
libncurses5-dev \
libncursesw5-dev \
xz-utils \
tk-dev \
libffi-dev \
liblzma-dev \
python-openssl
# pipenv is the only python package that we need to install globably, all the
# other package get installed inside our virtual enviroment
sudo pip3 install importlib-resources==1.0 zipp==1.0
sudo pip3 install pipenv
# we need to manually build python3.9 with the --enable-shared flag
# because otherwise pyinstaller won't be able to find the shared
# python libraries from within pipenv
# https://stackoverflow.com/questions/58548730/how-to-use-pyinstaller-with-pipenv-pyenv
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.5
# lastly, we actually set up the pipenv enviroment
pipenv install --dev -v
requirements.txt:
pipenv lock -r > requirements.txt
~/.pyenv:
# The following pyenv installation is coppied from
# https://gist.github.com/genyrosk/2a6e893ee72fa2737a6df243f6520a6d
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$$PYENV_ROOT/bin:$$PATH"' >> ~/.bashrc
#we need to reload bashrc after making changes.
source ~/.bashrc
[[source]]
verify_ssl = true
url = "https://pypi.org/simple"
name = "pypi"
[dev-packages]
objdict-generate = {path = "."}
nosetests-json-extended = "==0.1.0"
nose = "==1.3.7"
pyinstaller = "==4.0"
[requires]
python_version = "3.9"
[packages]
click = ">=6.6"
click_spinner = "*"
click_didyoumean = "*"
semver = "*"
jinja2 = "*"
canopen = "*"
PyYaml = "*"
configparser = "*"
pykwalify = "*"
arrow = "*"
This diff is collapsed.
Source: ${NAME}
Section: unknown
Priority: optional
Maintainer: Thomas Nadovich <tn@barrett.com>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: <insert the upstream URL, if relevant>
Package: ${NAME}
Architecture: amd64
Recommends: gdb-multiarch
Description: burt-util
#!/bin/sh
# add symlink from burt-util to bu so both work just like the setup.py does it
ln -sfn /usr/bin/objdict-generate /usr/bin/odg
echo "Completed post install"
#!/bin/sh
rm -f /usr/bin/odg
echo "Completed post remove"
#!/bin/bash
[[ $(which objdict_generate) != "" ]] && \
[[ $(which objdict_generate) != "/usr/bin/objdict_generate" ]] && \
echo "objdict_generate already installed using setup.py" && \
echo "Uninstalling..." && \
pip3 uninstall objdict_generate
exit 0
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
%:
dh $@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment