1
0
Fork 0

refresh-requirements.sh: Add support for comptible release packages

Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>
merge-requests/364/head
Vasilis Tsiligiannis 2019-04-09 00:52:27 +03:00
parent adf4b813a8
commit efa30be189
1 changed files with 12 additions and 2 deletions

View File

@ -17,7 +17,8 @@
# 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-db\\|satnogsdecoders\\)"
EXCLUDE_REGEXP="^\\(pkg-resources\\|satnogs-db\\)"
COMPATIBLE_REGEXP="^\\(satnogsdecoders\\)"
VIRTUALENV_DIR=$(mktemp -d)
PIP_COMMAND="$VIRTUALENV_DIR/bin/pip"
@ -34,10 +35,14 @@ cat << EOF > requirements.txt
# Please edit 'setup.cfg' to add top-level dependencies and use
# './contrib/refresh-requirements.sh to regenerate this file
satnogsdecoders~=0.0
EOF
"$PIP_COMMAND" freeze | grep -v "$EXCLUDE_REGEXP" >> requirements.txt
# Set compatible release packages in requirements file
if [ -n "$COMPATIBLE_REGEXP" ]; then
sed -i 's/'"$COMPATIBLE_REGEXP"'==\([0-9]\+\)\(\.[0-9]\+\)\+$/\1~=\2.0/' requirements.txt
fi
# Install development package with dependencies
"$PIP_COMMAND" install --no-cache-dir .[dev]
@ -56,6 +61,11 @@ _tmp_requirements_dev=$(mktemp)
sort < requirements.txt | comm -13 - "$_tmp_requirements_dev" >> requirements-dev.txt
rm -f "$_tmp_requirements_dev"
# Set compatible release packages in development requirements file
if [ -n "$COMPATIBLE_REGEXP" ]; then
sed -i 's/'"$COMPATIBLE_REGEXP"'==\([0-9]\+\)\(\.[0-9]\+\)\+$/\1~=\2.0/' requirements-dev.txt
fi
# Verify dependency compatibility
"$PIP_COMMAND" check