mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-05 05:04:46 +02:00
Add a script to help keep requirements.txt up to date
Add a script that creates a virtualenv and does the following: 1) Tests pip install -r requirements.txt 2) Runs pip freeze and diffs the output to requirements.txt (to check if any dependencies have been missed when it was last updated) 3) Runs pip list --outdated and writes the output to a file so you can see which packages might need updating (of course some may not be able to be updated easily e.g. if an API change has been made) 4) Installs safety and runs "safety check" to check if there are any known vulnerabilities Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
476348a598
commit
55d6840072
39
check_requirements.sh
Normal file
39
check_requirements.sh
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Script to be used on a regular basis to prevent requirements.txt
|
||||
# from going stale
|
||||
#
|
||||
# Copyright (C) 2018 Intel Corporation
|
||||
#
|
||||
# Licensed under the MIT license, see COPYING.MIT for details
|
||||
|
||||
if [ ! -f requirements.txt ] ; then
|
||||
echo "No requirements.txt file, please run this in the right directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
tmpdir=`mktemp -d`
|
||||
virtualenv -p python3 $tmpdir
|
||||
. $tmpdir/bin/activate
|
||||
pip install -r requirements.txt
|
||||
newreqs="requirements.txt.updated"
|
||||
echo "Creating $newreqs"
|
||||
pip freeze > $newreqs
|
||||
newreqsdiff="requirements.txt.diff"
|
||||
echo "Creating $newreqsdiff"
|
||||
diff -udN requirements.txt $newreqs > $newreqsdiff || true
|
||||
outdated="outdated.txt"
|
||||
echo "Creating $outdated"
|
||||
pip list --outdated > $outdated
|
||||
pip install pipdeptree
|
||||
deptree="deptree.txt"
|
||||
echo "Creating $deptree"
|
||||
pipdeptree > $deptree
|
||||
pip install safety
|
||||
echo "Running safety check"
|
||||
safety check
|
||||
deactivate
|
||||
rm -rf $tmpdir
|
||||
|
Loading…
Reference in New Issue
Block a user