Skip to content

Commit

Permalink
Merge pull request #1 from kyrios123/python-test
Browse files Browse the repository at this point in the history
Python 2+3 version variable and test macros
  • Loading branch information
sunnyflunk authored Oct 28, 2018
2 parents 0e80ec5 + 8cc477e commit c01c783
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions ypkg2/rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,28 @@ actions:
popd
}
python_install
- python_test: |
function python_test() {
[[ -d py2build ]] && cd py2build
if [[ -z $PYTHONPATH ]]; then
export PYTHONPATH=%installroot%/usr/lib/python%python2_version%/site-packages:$PWD/build/lib
local do_unset=true
fi
if [[ -z $1 ]]; then
python2 setup.py test || exit 1
elif [[ $1 =~ .*\.py$ ]]; then
python2 "$@" || exit 1
else
"$@" || exit
fi
[[ $do_unset ]] && unset PYTHONPATH
[[ -d ../py2build ]] && cd ..
}
python_test
- python_compile: |
function python_compile() {
if [ -z "$1" ]; then
Expand Down Expand Up @@ -206,6 +228,28 @@ actions:
popd
}
python3_install
- python3_test: |
function python3_test() {
[[ -d py3build ]] && cd py3build
if [[ -z $PYTHONPATH ]]; then
export PYTHONPATH=%installroot%/usr/lib/python%python3_version%/site-packages:$PWD/build/lib
local do_unset=true
fi
if [[ -z $1 ]]; then
python3 setup.py test || exit 1
elif [[ $1 =~ .*\.py$ ]]; then
python3 "$@" || exit 1
else
"$@" || exit
fi
[[ $do_unset ]] && unset PYTHONPATH
[[ -d ../py3build ]] && cd ..
}
python3_test
- python3_compile: |
function python3_compile() {
if [ -z "$1" ]; then
Expand Down Expand Up @@ -274,3 +318,8 @@ defines:
# Get "Current" kernel version
- kernel_version_current: |
$(echo "$(basename `readlink /usr/lib/kernel/default-current` | cut -d '.' -f 4,5,6)".current)
# Get python 2 & 3 version
- python2_version: |
$(python2 --version 2>&1 | sed -r 's|^Python (.*)\..*$|\1|')
- python3_version: |
$(python3 --version 2>&1 | sed -r 's|^Python (.*)\..*$|\1|')

0 comments on commit c01c783

Please sign in to comment.