forked from AnneGilles/c3sMembership
-
Notifications
You must be signed in to change notification settings - Fork 3
/
requirements.sh
executable file
·95 lines (88 loc) · 2.17 KB
/
requirements.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
#
# splits requirements into environments using a list of top-level dependencies:
#
# - requirements.txt
# - requirements_production.txt
# - requirements_staging.txt
# - requirements_testing.txt
# - requirements_development.txt
#
# find out top-level dependencies:
#
# $ pip install pipdeptree
# $ pipdeptree --warn silence | grep -E '^\w+'
# define top level packages
PRODUCTION=(
alembic
bcrypt
colorama
cornice
deform
fdfgen
lingua
pbkdf2
pdfminer
pycountry
pyramid-beaker
pyramid-chameleon
pyramid-mailer
pyramid-tm
python-gnupg
requests
slate
zope.sqlalchemy
)
STAGING=()
TESTING=(
coverage
docutils
mock
pytest
pytest-cov
pylint
flake8
pyquery
selenium
sphinx
sphinx-rtd-theme
sphinxcontrib-plantuml
waitress
WebTest
)
DEVELOPMENT=(
pdbpp
pyramid-debugtoolbar
debugpy
)
EXCLUDE=(
c3smembership
pip
pipdeptree
setuptools
wheel
)
# install pipdeptree
pip -q install pipdeptree
# production
pipdeptree --warn silence --exclude $(IFS=, ; echo "${EXCLUDE[*]:--}") \
--freeze --packages $(IFS=, ; echo "${PRODUCTION[*]:--}") \
> requirements_production.txt
# staging
echo "-r requirements_production.txt" > requirements_staging.txt
pipdeptree --warn silence --exclude $(IFS=, ; echo "${EXCLUDE[*]:--}") \
--freeze --packages $(IFS=, ; echo "${STAGING[*]:--}") \
>> requirements_staging.txt
# testing
echo "-r requirements_production.txt" > requirements_testing.txt
echo "-r requirements_staging.txt" >> requirements_testing.txt
pipdeptree --warn silence --exclude $(IFS=, ; echo "${EXCLUDE[*]:--}") \
--freeze --packages $(IFS=, ; echo "${TESTING[*]:--}") \
>> requirements_testing.txt
# development
echo "-r requirements_production.txt" > requirements_development.txt
echo "-r requirements_staging.txt" >> requirements_development.txt
echo "-r requirements_testing.txt" >> requirements_development.txt
pipdeptree --warn silence --exclude $(IFS=, ; echo "${EXCLUDE[*]:--}") \
--freeze --packages $(IFS=, ; echo "${DEVELOPMENT[*]:--}") \
>> requirements_development.txt