| |
@@ -0,0 +1,60 @@
|
| |
+ #!/bin/bash
|
| |
+
|
| |
+ set -e
|
| |
+
|
| |
+ SPECFILE=files/pagure.spec
|
| |
+
|
| |
+ export LANG="en_US.UTF-8"
|
| |
+ . /etc/os-release
|
| |
+
|
| |
+
|
| |
+ #
|
| |
+ # Dependenties detection
|
| |
+ #
|
| |
+
|
| |
+ # Fedora: replace the macro %{python_pkgversion} by '3' which thus installs all
|
| |
+ # the py3 version of the dependencies.
|
| |
+ deps_fedora() {
|
| |
+ grep "Requires:" ${SPECFILE} | \
|
| |
+ awk '{split($0, a, " "); print a[2]}' | grep -v "%{name}" | \
|
| |
+ sed -e "s|%{python_pkgversion}|3|" | \
|
| |
+ grep -v python3-enum34
|
| |
+ }
|
| |
+
|
| |
+ # CentOS7: replace the macro %{python_pkgversion} by empty string which thus
|
| |
+ # installs all the py2 version of the dependencies.
|
| |
+ deps_centos7() {
|
| |
+ grep "Requires:" ${SPECFILE} | \
|
| |
+ awk '{split($0, a, " "); print a[2]}' | grep -v "%{name}" | \
|
| |
+ sed -e "s|%{python_pkgversion}||"
|
| |
+ }
|
| |
+
|
| |
+
|
| |
+ # CentOS7: the old version of setuptools does not support restrictions on
|
| |
+ # the requirements file, so drop them
|
| |
+ remove_req_restrictions() {
|
| |
+ sed -i -e "s|;python_version<\"3.4\"||" requirements.txt
|
| |
+ sed -i -e "s|;python_version<=\"2.7\"||" requirements.txt
|
| |
+ sed -i -e "s|python3-openid;python_version>=\"3.0\"||" requirements.txt
|
| |
+ sed -i "/^email_validator.*/d" requirements.txt
|
| |
+ sed -i -e 's|"alembic-3"|"alembic"|' tests/test_alembic.py
|
| |
+ }
|
| |
+
|
| |
+ #
|
| |
+ # Install the dependencies and run the tests
|
| |
+ #
|
| |
+
|
| |
+ set -x
|
| |
+
|
| |
+ if [ "$ID" == "centos" -a "$VERSION_ID" == "7" ]; then
|
| |
+ yum install -y --enablerepo=epel-testing $(deps_centos7)
|
| |
+ yum clean all
|
| |
+ #remove_req_restrictions
|
| |
+ #python setup.py build
|
| |
+ py.test -n auto ${TESTCASE:-tests/}
|
| |
+ else
|
| |
+ dnf install -y --enablerepo=updates-testing $(deps_fedora)
|
| |
+ dnf clean all
|
| |
+ #python setup.py build
|
| |
+ pytest-3 -n auto ${TESTCASE:-tests/}
|
| |
+ fi
|
| |
I've commented this out because I don't think building the binary is necessary to run the tests. If I'm wrong on that I'll uncomment it.