1
0
Fork 0

Add utility to refresh requirements, update docs

Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>
environments/stage/deployments/290
Vasilis Tsiligiannis 2019-01-23 21:30:39 +02:00
parent 311bcc9247
commit 219e87f7ff
3 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,62 @@
#!/bin/sh -e
#
# Script to refresh requirements.txt file
#
# Copyright (C) 2019 Libre Space Foundation <https://libre.space/>
#
# 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 <http://www.gnu.org/licenses/>.
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"

View File

@ -7,3 +7,4 @@ satnogs-network
installation
contribute
maintenance

View File

@ -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/`.