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

Merge branch 'feature/unspecifiy-versions' into 'devel'

Feature/unspecifiy versions

Closes #6 and #4

See merge request !3
parents b7870075 d1cbb2cd
Pipeline #16898 passed with stages
in 2 minutes and 41 seconds
......@@ -13,6 +13,7 @@ build/
......@@ -23,6 +24,14 @@ var/
# Auto-generated requirements.txt file
#pipenv stuff
# 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
# debian build artifacts
# vim swap files
# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
image: "python:3.4"
image: burt/pyinstaller
- build
- release-job
stage: build
- pip3 install python-dateutil==2.7.3 && pip3 install MarkupSafe
- ./ install
- pipenv install --dev
- pipenv run objdict-generate
# script:
# - ./ test
stage: release-job
- pipenv install --dev
- pipenv run make package
- packaging/*.deb
name: "${CI_PROJECT_NAME}-${CI_BUILD_TAG}-deb"
- tags
## [dev-1.0.6]
- set up repo to build an executable binary like burt-util
- un-specified package versions
- command is now objdict-generate, not objdict_generate
## [dev-1.0.5]
### Changed
SHELL := /bin/bash
WORKSPACE_DIR=$(shell git rev-parse --show-toplevel)
VERSION=$(shell cat objdict_generate/ | grep --color=never -oh '[0-9]\+\.[0-9]\+\.[0-9]\+')
NAME=$(shell basename -s .git `git config --get remote.origin.url`)
USERNAME=$(shell git config
EMAIL=$(shell git config
all: build
.PHONY: build
build: $(EXE)
pyinstaller $< --onefile -n $(NAME)
.PHONY: package
package: $(DEB)
rm -f $(DEBIAN_DIR)/changelog
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"
cd $(OUTDIR) && debuild -us -uc
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
-rm -f $(DEBIAN_DIR)/control
.PHONY: install
install: $(DEB)
sudo dpkg -i $<
.PHONY: uninstall
sudo apt remove $(NAME)
.PHONY: 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 \
# 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
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.5
# lastly, we actually set up the pipenv enviroment
pipenv install --dev -v
pipenv lock -r > requirements.txt
# The following pyenv installation is coppied from
git clone ~/.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
verify_ssl = true
url = ""
name = "pypi"
objdict-generate = {path = "."}
nosetests-json-extended = "==0.1.0"
nose = "==1.3.7"
pyinstaller = "==4.0"
python_version = "3.9"
click = ">=6.6"
click_spinner = "*"
click_didyoumean = "*"
semver = "*"
jinja2 = "*"
canopen = "*"
PyYaml = "*"
configparser = "*"
pykwalify = "*"
arrow = "*"
This diff is collapsed.
......@@ -4,8 +4,8 @@
> information
**Build Status**: [![build status](](
**Coverage Report**: [![coverage report](](
**Build Status**: [![build status](](
**Coverage Report**: [![coverage report](](
*Requires*: Python 3.4+
......@@ -13,40 +13,96 @@
### Quick Start
The following commands are all you need:
To install objdict-generate, go to the latest tag in GitLab, download the .deb
installer (inside "release-job" and install with the following command:
$ sudo apt-get install -y python3 python3-pip
$ sudo pip3 install git+
$ sudo dpkg -i objdict-generate*.deb
### Development Setup
This project is set up to be developed in a pipenv virtual environment using
python 3.9.5 Since this may be too recent of a version for older development
systems, we use
pyenv to provide it to pipenv. The application can be run locally from the
virtual environment, or 'frozen' into a single-file application using
pyinstaller. This one-file application can then be installed on other systems
by building a .deb installer file using make.
The build server builds the .deb slightly differently. The environment in which
make is run is not a pipenv virtual environment, but rather a docker container
defined in the burt-ci-docker-image project. This docker container is set up so
that its internal global python setup is the same as the one defined by the
pipenv Pipfile. It is not defined by the Pipfile though, and if the Pipfile is
changed, the docker image should be updated as well to keep local & server
builds roughly compatible.
Development can be done in one of two ways
#### Recomended: Pipenv
ipenv is a tool for setting up your python development environment.
First download the repository:
$ git clone && cd objdict-generate
To install the dependencies
$ sudo apt-get install -y python3 python3-pip
make setup
Now we can run the program in this repo without installing on one of two ways
$ pipenv run objdict-generate
$ pipenv shell
(pipenv) $ objdict-generate
All python requirements are managed by the file and the application can
be installed by running:
You may be prompted to install python3.9 if you do not already have it
installed. Indicate yes when asked.
This allows for faster development because you don't need to do a system wide
install every time you make a change.
#### Advanced: Install after changes
First download the repository:
$ sudo ./ install
$ git clone && cd objdict-generate
To verified it is installed properly you can now run the unit tests:
To install the system dependencies
$ sudo ./ test
$ make setup
_Note_: Currently _virtualenv_ usage is broken.
The project should be built inside the pipenv virtual environment to ensure
that it is built with the dependencies specified in the Pipfile. To do so run:
$ pipenv install --dev
$ pipenv run make install
You may be prompted to install python3.9 if you do not already have it
installed. Indicate yes when asked.
This sets up the virtual environment as a development environment, builds the
package inside the virtual environment, and then installs the built debian
on the system. This method is preferable for testing, as it installs burt-util
at the system level.
## Dependencies
......@@ -60,7 +116,7 @@ _Note_: Currently _virtualenv_ usage is broken.
Reading an object dictionary yaml file and outputting sources:
$ objdict_generate project/uss-enterprise/uss_enterprise_od.yaml -o project/uss-enterprise/src -d docs -m projects/mainboard/src
$ objdict-generate project/uss-enterprise/uss_enterprise_od.yaml -o project/uss-enterprise/src -d docs -m projects/mainboard/src
The above command will read in the yaml file `project/uss-enterprise/uss_enterprise_od.yaml` and in the output directory (`projects/uss-enterprise/sources`) create two files:
......@@ -83,7 +139,7 @@ dictionary should be placed:
Get usage instructions and help:
$ objdict_generate --help
$ objdict-generate --help
## Example yaml file
from .version import __version__
from . import util
from . import datatypes
from . import scripts
......@@ -11,6 +11,7 @@ from objdict_generate.util import *
from objdict_generate.datatypes import *
from objdict_generate.resources import get_resource, get_resource_string
from objdict_generate.version import __version__
from pykwalify.core import Core
from collections import OrderedDict
import yaml
......@@ -79,9 +80,11 @@ def generate_eds_section(objdict):
@click.option('--doc_dir', '-d', default=".", type=click.Path(exists=True), help="Output directory to put, .eds and .md files")
@click.option('--output_dir', '-o', default=".", type=click.Path(exists=True), help="Output directory to put, .h and .cpp files")
@click.option('--master_dir', '-m', default=None, type=click.Path(exists=True), help="Output directory to put, .h and .cpp files for the master generated files. Defaults to output dir")
@click.option('--master_dir', '-m', default=None, type=click.Path(exists=True), help="Output directory to put, .h and .cpp files for the master generated files. Defaults to output dir")
@click.argument('yaml_files', type=click.Path(exists=True), nargs=-1)
def cli(ctx, doc_dir, output_dir, master_dir, yaml_files):
#!/usr/bin/env python3
__version__ = "1.0.5"
__version__ = "1.0.6"
Source: ${NAME}
Section: unknown
Priority: optional
Maintainer: Thomas Nadovich <>
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: ${NAME}
# add symlink from burt-util to bu so both work just like the does it
ln -sfn /usr/bin/objdict-generate /usr/bin/odg
echo "Completed post install"
rm -f /usr/bin/odg
echo "Completed post remove"
[[ $(which objdict_generate) != "" ]] && \
[[ $(which objdict_generate) != "/usr/bin/objdict_generate" ]] && \
echo "objdict_generate already installed using" && \
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 $@
......@@ -16,25 +16,25 @@ setup(
tests_require=['pytest==4.0.1', 'coverage==5.0a4'],
tests_require=['pytest', 'coverage'],
description='Object Dictionary Generator for Barrett Firmware',
author='Christopher Woodall',
"console_scripts": [
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