From 219e87f7ffdfa40fafc532c235b816b68df0f70b Mon Sep 17 00:00:00 2001 From: Vasilis Tsiligiannis Date: Wed, 23 Jan 2019 21:30:39 +0200 Subject: [PATCH] Add utility to refresh requirements, update docs Signed-off-by: Vasilis Tsiligiannis --- contrib/refresh-requirements.sh | 62 +++++++++++++++++++++++++++++++++ docs/index.rst | 1 + docs/maintenance.rst | 31 +++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100755 contrib/refresh-requirements.sh create mode 100644 docs/maintenance.rst diff --git a/contrib/refresh-requirements.sh b/contrib/refresh-requirements.sh new file mode 100755 index 0000000..ee82e5f --- /dev/null +++ b/contrib/refresh-requirements.sh @@ -0,0 +1,62 @@ +#!/bin/sh -e +# +# Script to refresh requirements.txt file +# +# Copyright (C) 2019 Libre Space Foundation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +EXCLUDE_REGEXP="^\(pkg-resources\|satnogs-network\)" +VIRTUALENV_DIR=$(mktemp -d) +PIP_COMMAND="$VIRTUALENV_DIR/bin/pip" + +# Create virtualenv +virtualenv "$VIRTUALENV_DIR" + +# Install package with dependencies +"$PIP_COMMAND" install --no-cache-dir --force-reinstall . + +# Create requirements file from installed dependencies +cat << EOF > requirements.txt +# This is a generated file; DO NOT EDIT! +# +# Please edit 'setup.cfg' to add top-level dependencies and use +# './contrib/refresh-requirements.sh to regenerate this file + +EOF +"$PIP_COMMAND" freeze | grep -v "$EXCLUDE_REGEXP" >> requirements.txt + +# Install development package with dependencies +"$PIP_COMMAND" install --no-cache-dir .[dev] + +# Create development requirements file from installed dependencies +cat << EOF > requirements-dev.txt +# This is a generated file; DO NOT EDIT! +# +# Please edit 'setup.cfg' to add top-level extra dependencies and use +# './contrib/refresh-requirements.sh to regenerate this file +-r requirements.txt + +EOF + +_tmp_requirements_dev=$(mktemp) +"$PIP_COMMAND" freeze | grep -v "$EXCLUDE_REGEXP" | sort > "$_tmp_requirements_dev" +sort < requirements.txt | comm -13 - "$_tmp_requirements_dev" >> requirements-dev.txt +rm -f "$_tmp_requirements_dev" + +# Verify dependency compatibility +"$PIP_COMMAND" check + +# Cleanup +rm -rf "$VIRTUALENV_DIR" diff --git a/docs/index.rst b/docs/index.rst index a046395..c5a2224 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,3 +7,4 @@ satnogs-network installation contribute + maintenance diff --git a/docs/maintenance.rst b/docs/maintenance.rst new file mode 100644 index 0000000..cbe448f --- /dev/null +++ b/docs/maintenance.rst @@ -0,0 +1,31 @@ +Maintenance +=========== + + +Updating Python dependencies +---------------------------- +To update the Python dependencies: + +#. Execute script to refresh `requirements{-dev}.txt` files: + + $ ./contrib/refresh-requirements.sh + +#. Stage and commit `requirements{-dev}.txt` files + + +Updating frontend dependencies +------------------------------ +The frontend dependencies are managed with `npm` as defined in the `package.json`. +The following are required to perform an update of the dependencies: + +#. Bump versions in `package.json` + +#. Download and install the latest version of the dependencies + + $ npm install + +#. Move the installed version into to satnogs-network source tree + + $ ./node_modules/.bin/gulp + +#. Stage & commit the updated files in `network/static/`.