Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2+3 version variable and test macros #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -270,3 +314,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: |
$(python --version 2>&1 | sed -r 's|^Python (.*)\..*$|\1|')
- python3_version: |
$(python3 --version 2>&1 | sed -r 's|^Python (.*)\..*$|\1|')