Drops Python 2 support

Makes sure the user is warned at install time if using Python 2.
This commit is contained in:
Andre Miras 2020-05-09 00:18:28 +02:00
parent d0323c165d
commit 20bfa24005
3 changed files with 35 additions and 8 deletions

View file

@ -58,3 +58,18 @@ jobs:
pip install Cython==0.28.6 pip install Cython==0.28.6
- run: buildozer --help - run: buildozer --help
- run: buildozer init - run: buildozer init
Python2:
runs-on: ubuntu-latest
steps:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 2.7
- uses: actions/checkout@v2
- name: Try Python 2 install
run: |
# we don't want to build to fail with the exit 1 so we catch with "||"
python2 -m pip install -e . 2> error.log || echo Failing as expected
cat error.log
grep "Unsupported Python version" error.log

View file

@ -2,6 +2,7 @@
Buildozer Buildozer
''' '''
import sys
from setuptools import setup from setuptools import setup
from os.path import dirname, join from os.path import dirname, join
import codecs import codecs
@ -11,6 +12,21 @@ import io
here = os.path.abspath(os.path.dirname(__file__)) here = os.path.abspath(os.path.dirname(__file__))
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 6)
# This check and everything above must remain compatible with Python 2.7.
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write("""
==========================
Unsupported Python version
==========================
This version of buildozer requires Python {}.{}, but you're trying to
install it on Python {}.{}.
""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))
sys.exit(1)
def find_version(*file_paths): def find_version(*file_paths):
# Open in Latin-1 so that we avoid encoding errors. # Open in Latin-1 so that we avoid encoding errors.
@ -52,14 +68,10 @@ setup(
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools', 'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.1', 'Programming Language :: Python :: 3.6'
'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.7'
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.8'
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5'
], ],
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [

View file

@ -1,5 +1,5 @@
[tox] [tox]
envlist = pep8,py27,py3 envlist = pep8,py3
[testenv] [testenv]
deps = deps =