Commit cf77a77a authored by Yuanle Song's avatar Yuanle Song
Browse files

v1.7.0 add utils/ensure_pkg_installed command.

make bootstrap-dev will call this when running unit test.
parent fbb4157a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
(defproject python/lein-template "1.6.5"
(defproject python/lein-template "1.7.0"
  :description "lein template for a python project"
  :url "https://gitlab.emacsos.com/sylecn/python-project-template"
  :license {:name "Apache License 2.0"
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
                        "README-dev.rst"
                        "utils/versionutils.py"
                        "utils/build-deb"
                        "utils/ensure_pkg_installed"
                        "utils/install-git-hooks"
                        "utils/trigger-ci-build"
                        "deb-scripts/before-install.sh"
+3 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@ PYLINT := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/pylint --disable=I0011 --msg-
PEP8 := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/pycodestyle --repeat --ignore=E202,E501,E402,W503
PYTHON := env PYTHONPATH=$(PYTHONPATH) $(VENV)/bin/python
PIP := $(VENV)/bin/pip
# required system packages when installing python dependencies
#DEV_PKGS := python3-dev libpq-dev

DEFAULT_PYTHON ?= $(shell ./utils/choose_default_python.sh)
VIRTUALENV := $(wildcard ./utils/virtualenv-*/virtualenv.py)
@@ -54,6 +56,7 @@ requirements:
		$(PIP) install -q $(REQUIREMENTS); \
	fi
requirements-dev:
	./utils/ensure_pkg_installed $(DEV_PKGS)
	$(PIP) install -q $(REQUIREMENTS_DEV)
logdir:
	@if [ ! -d /var/log/{{name}} ]; then \
+26 −0
Original line number Diff line number Diff line
#!/bin/sh

set -e
PKGS="$@"
all_installed=1

if [ -z "$UID" ]; then
	UID=`id -u`
fi
if [ "$UID" = 0 ]; then
	SUDO=
else
	SUDO=sudo
fi

for pkg in "$@"
do
	if ! dpkg -s "$pkg" | grep -q 'Status: install ok installed'; then
		echo "$pkg is not installed"
		all_installed=0
	fi
done

if [ $all_installed = 0 ]; then
	$SUDO apt-get install -y $PKGS
fi