chore: auto generate requirements.txt (#1651)
- force LC_ALL for the sort command
This commit is contained in:
parent
cc0e764f47
commit
d55e58e416
|
@ -60,3 +60,13 @@ repos:
|
|||
- --ignore-words=.codespellignore
|
||||
- --builtin=clear,rare,informal
|
||||
exclude: (^legacy.*|yarn\.lock)$
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: requirements.txt
|
||||
name: requirements.txt
|
||||
description: Generate requirements.txt
|
||||
entry: tools/extract-requirements.sh dev
|
||||
pass_filenames: false
|
||||
language: script
|
||||
files: setup.py$
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# This file is auto-generated by tools/extract-requirements.sh.
|
||||
# Please do not edit this file, edit the setup.py file!
|
||||
mutagen>=1.45.1
|
||||
pika>=1.0.0
|
||||
requests>=2.7.0
|
||||
typing_extensions
|
|
@ -0,0 +1,10 @@
|
|||
# This file is auto-generated by tools/extract-requirements.sh.
|
||||
# Please do not edit this file, edit the setup.py file!
|
||||
coreapi
|
||||
django~=3.0
|
||||
django-filter
|
||||
djangorestframework
|
||||
drf-spectacular
|
||||
markdown
|
||||
model_bakery
|
||||
psycopg2
|
|
@ -0,0 +1,4 @@
|
|||
# This file is auto-generated by tools/extract-requirements.sh.
|
||||
# Please do not edit this file, edit the setup.py file!
|
||||
python-dateutil>=2.7.0
|
||||
requests
|
|
@ -0,0 +1,11 @@
|
|||
# This file is auto-generated by tools/extract-requirements.sh.
|
||||
# Please do not edit this file, edit the setup.py file!
|
||||
amqplib
|
||||
configobj
|
||||
defusedxml
|
||||
kombu
|
||||
mutagen
|
||||
packaging
|
||||
pytz
|
||||
requests
|
||||
typing-extensions
|
|
@ -0,0 +1,6 @@
|
|||
# This file is auto-generated by tools/extract-requirements.sh.
|
||||
# Please do not edit this file, edit the setup.py file!
|
||||
click>=8.0.3
|
||||
loguru==0.6.0
|
||||
pydantic
|
||||
pyyaml
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Extract the dependencies from the setup.py files
|
||||
# and save the result to requirements.txt.
|
||||
#
|
||||
# You can filter any extra require by adding the name as argument.
|
||||
#
|
||||
# Examples:
|
||||
# tools/extract-requirements.sh
|
||||
# tools/extract-requirements.sh dev
|
||||
|
||||
set -u
|
||||
|
||||
error() {
|
||||
echo >&2 "error: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
command -v python3 > /dev/null || error "python3 command not found!"
|
||||
command -v sed > /dev/null || error "sed command not found!"
|
||||
|
||||
for setup_path in */setup.py; do
|
||||
path="$(dirname "$setup_path")"
|
||||
egg_path="$(echo "$path"/*.egg-info)"
|
||||
|
||||
# Only build egg if absent
|
||||
if [[ ! -d "$egg_path" ]]; then
|
||||
python3 "$setup_path" egg_info > /dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Refresh egg_path with bash expansion
|
||||
egg_path="$(echo "$path"/*.egg-info)"
|
||||
|
||||
# Remove entire extra section from require file
|
||||
for arg in "$@"; do
|
||||
sed --in-place "/^\[$arg\]/,/^\[/d" -- "$egg_path/requires.txt"
|
||||
done
|
||||
|
||||
# Generate requirements.txt
|
||||
cat << EOF > "$path/requirements.txt"
|
||||
# This file is auto-generated by tools/extract-requirements.sh.
|
||||
# Please do not edit this file, edit the setup.py file!
|
||||
EOF
|
||||
|
||||
cat -- "$egg_path/requires.txt" |
|
||||
sed '/^$/d' |
|
||||
LC_ALL=en_US.UTF-8 sort >> "$path/requirements.txt"
|
||||
done
|
|
@ -0,0 +1,6 @@
|
|||
# This file is auto-generated by tools/extract-requirements.sh.
|
||||
# Please do not edit this file, edit the setup.py file!
|
||||
celery==4.4.7
|
||||
kombu==4.6.10
|
||||
mutagen>=1.31.0
|
||||
requests>=2.7.0
|
Loading…
Reference in New Issue