From 4e84b6d7bd8d965c9074465ba0d06f19274f5f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20HUBSCHER?= Date: Tue, 20 Aug 2019 12:09:41 +0200 Subject: [PATCH] Improve Makefile to handle VENV creation if needed. --- .gitignore | 1 + Makefile | 37 ++++++++++++++++++++++++------------- docs/fields.rst | 12 ++++++------ docs/models.rst | 4 ++-- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 5f1c259..d6b55d2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ htmlcov/ docs/_build/ .idea/ .eggs/ +.venv/ diff --git a/Makefile b/Makefile index 4785478..798188c 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,32 @@ +VIRTUALENV = virtualenv --python=python3 +PYTHON = $(VENV)/bin/python +VENV := $(shell echo $${VIRTUAL_ENV-.venv}) +INSTALL_STAMP = $(VENV)/.install.stamp + all: init docs test -init: - python setup.py develop - pip install tox coverage Sphinx +init: $(INSTALL_STAMP) +$(INSTALL_STAMP): $(PYTHON) setup.py + $(VENV)/bin/pip install -e . + $(VENV)/bin/pip install tox coverage Sphinx + touch $(INSTALL_STAMP) -test: - coverage erase - tox - coverage html +virtualenv: $(PYTHON) +$(PYTHON): + $(VIRTUALENV) $(VENV) + +test: init + $(VENV)/bin/coverage erase + $(VENV)/bin/tox + $(VENV)/bin/coverage html docs: documentation -documentation: - python setup.py build_sphinx +documentation: init + $(PYTHON) setup.py build_sphinx -messages: - python translations.py make +messages: init + $(PYTHON) translations.py make -compilemessages: - python translations.py compile +compilemessages: init + $(PYTHON) translations.py compile diff --git a/docs/fields.rst b/docs/fields.rst index 87c298e..cdf2a0c 100644 --- a/docs/fields.rst +++ b/docs/fields.rst @@ -66,7 +66,7 @@ field changes: (A ``MonitorField`` can monitor any type of field for changes, not only a ``StatusField``.) -If a list is passed to the ``when`` parameter, the field will only +If a list is passed to the ``when`` parameter, the field will only update when it matches one of the specified values: .. code-block:: python @@ -159,16 +159,16 @@ be the excerpt. This number can be customized by setting the UUIDField ---------- -A ``UUIDField`` subclass that provides an UUID field. You can -add this field to any model definition. +A ``UUIDField`` subclass that provides an UUID field. You can +add this field to any model definition. -With the param ``primary_key`` you can set if this field is the +With the param ``primary_key`` you can set if this field is the primary key for the model, default is True. -Param ``version`` is an integer that set default UUID version. +Param ``version`` is an integer that set default UUID version. Versions 1,3,4 and 5 are supported, default is 4. -If ``editable`` is set to false the field will not be displayed in the admin +If ``editable`` is set to false the field will not be displayed in the admin or any other ModelForm, default is False. diff --git a/docs/models.rst b/docs/models.rst index 31707f4..79783e9 100644 --- a/docs/models.rst +++ b/docs/models.rst @@ -94,8 +94,8 @@ UUIDModel This abstract base class provides ``id`` field on any model that inherits from it which will be the primary key. -If you dont want to set ``id`` as primary key or change the field name, you can be override it -with our `UUIDField`_ +If you dont want to set ``id`` as primary key or change the field name, you can be override it +with our `UUIDField`_ Also you can override the default uuid version. Versions 1,3,4 and 5 are now supported.