Mercurial > kallithea
annotate scripts/validate-minimum-dependency-versions @ 7950:eee49a119592
i18n: added translation for Turkish
Currently translated at 0.3% (3 of 1087 strings)
author | Hüseyin Tunç <huseyin.tunc@bulutfon.com> |
---|---|
date | Mon, 04 Nov 2019 08:00:01 +0100 |
parents | ac6cc1b8a07e |
children | 28fa94f56370 |
rev | line source |
---|---|
7901
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
1 #!/bin/bash |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
2 # Test that installation of all dependencies works fine if versions are set to |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
3 # the minimum ones. |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
4 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
5 set -e |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
6 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
7 if [ -n "$VIRTUAL_ENV" ]; then |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
8 echo "This script will create its own virtualenv - please don't run it inside an existing one." >&2 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
9 exit 1 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
10 fi |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
11 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
12 cd "$(hg root)" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
13 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
14 venv=build/minimum-dependency-versions-venv |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
15 log=build/minimum-dependency-versions.log |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
16 min_requirements=build/minimum-dependency-versions-requirements.txt |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
17 echo "virtualenv: $venv" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
18 echo "log: $log" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
19 echo "minimum requirements file: $min_requirements" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
20 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
21 # clean up previous runs |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
22 rm -rf "$venv" "$log" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
23 mkdir -p "$venv" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
24 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
25 # Make a light weight parsing of setup.py and dev_requirements.txt, |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
26 # finding all >= requirements and dumping into a custom requirements.txt |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
27 # while fixating the requirement at the lower bound. |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
28 sed -n 's/.*"\(.*\)>=\(.*\)".*/\1==\2/p' setup.py > "$min_requirements" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
29 sed 's/>=/==/p' dev_requirements.txt >> "$min_requirements" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
30 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
31 virtualenv -p "$(command -v python2)" "$venv" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
32 source "$venv/bin/activate" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
33 pip install --upgrade pip setuptools |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
34 pip install -e . -r "$min_requirements" python-ldap python-pam 2> >(tee "$log" >&2) |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
35 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
36 # Strip out the known Python 2.7 deprecation message. |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
37 sed -i '/DEPRECATION: Python 2\.7 will reach the end of its life/d' "$log" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
38 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
39 # Treat any message on stderr as a problem, for the caller to interpret. |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
40 if [ -s "$log" ]; then |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
41 echo |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
42 echo "Error: pip detected following problems:" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
43 cat "$log" |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
44 echo |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
45 exit 1 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
46 fi |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
47 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
48 freeze_txt=build/minimum-dependency-versions.txt |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
49 pip freeze > $freeze_txt |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
50 echo "Installation of minimum packages was successful, providing a set of packages as in $freeze_txt . Now running test suite..." |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
51 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
52 pytest |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
53 |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
54 echo "Test suite execution was successful." |
ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
diff
changeset
|
55 echo "You can now do additional validation using virtual env '$venv'." |