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

Provide example on skipping certain Python versions #29

Open
letmaik opened this issue May 22, 2016 · 6 comments
Open

Provide example on skipping certain Python versions #29

letmaik opened this issue May 22, 2016 · 6 comments

Comments

@letmaik
Copy link

letmaik commented May 22, 2016

In my library I don't support Python 2.6 anymore, and I was wondering what the best way is to skip this version in the build-wheels.sh script, instead of the loop for PYBIN in /opt/python/*/bin.

@letmaik letmaik changed the title Provide example on skipping certain Python version Provide example on skipping certain Python versions May 22, 2016
@letmaik
Copy link
Author

letmaik commented May 23, 2016

Sorry, just realized this should probably go to the https://github.com/pypa/python-manylinux-demo repo, right?

@rmcgibbo
Copy link
Member

Cool. Is that something you would be able to contribute? It should just be a little bit of bash scripting.

Sent from my iPhone

On May 23, 2016, at 4:08 AM, Maik Riechert [email protected] wrote:

Sorry, just realized this should probably go to the https://github.com/pypa/python-manylinux-demo repo, right?


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@letmaik
Copy link
Author

letmaik commented May 23, 2016

I use this for my own library at the moment:

PYBINS=(
  "/opt/python/cp27-cp27m/bin"
  "/opt/python/cp27-cp27mu/bin"
  "/opt/python/cp33-cp33m/bin"
  "/opt/python/cp34-cp34m/bin"
  "/opt/python/cp35-cp35m/bin"
  )

# and later...
for PYBIN in ${PYBINS[@]}; do
  # ...
done

@njsmith
Copy link
Member

njsmith commented May 23, 2016

There's a few different options depending on what exactly you want... for example /opt/python/cp{27,3}*/bin will give you all cpython 2.7 or 3.x variants, including new 3.x versions added in the future, but not pypy even if it's added in the future.

I guess it might be useful to have some example that explicitly uses a blacklist and gets all new variants by default - obviously projects can do what they want, but I think everyone's better off in the long run if we make it easy to add new interpreters and if projects that don't care that much then get automatically opted in.

Possibly the best is something like

for PYTHON in /opt/python/*/bin/python; do
    # only run body if this interpreter claims to be 2.7 or better
    if python -c 'import sys; sys.exit(not sys.version_info >= (2, 7))'; then
        # build here
    fi
done

(Or this could avoid an indent level if bash has a continue construct... anyone know if this exists?)

@ulope
Copy link

ulope commented Jul 15, 2016

I've been wrapping the pip wheel command with if [[ ${PYBIN} != *"cp26"* ]]; then to exclude Python 2.6

@AvdN
Copy link

AvdN commented Dec 26, 2016

@njsmith Bash has a continue construct, it is called... continue ;-)

for x in $(seq 3) ; do if [ $x == "2" ] ; then continue; fi; echo $x; done

@mayeut mayeut transferred this issue from pypa/manylinux May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants