Skip to content

Commit

Permalink
Bump to RBTools 4.0 dev and change Python compatibility.
Browse files Browse the repository at this point in the history
This is the start of the work on RBTools 4.0. It drops support for
Python < 3.7 and adds official support for Python 3.10/3.11.

4.0 will largely focus on modern compatibility, internal architectural
improvements, and support for Apple Diff.

As part of the package modernization effort, our `rbtools/__init__.py`
has been updated to use our modern logic (first established in
`beanbag-tools`) for version building.

Testing Done:
Successfully built packages.

Tested that our version gatekeeping logic in `setup.py` did the right
thing for Python 2.7, 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11.

Reviewed at https://reviews.reviewboard.org/r/12522/
  • Loading branch information
chipx86 committed Aug 15, 2022
1 parent a48d5d2 commit 918804a
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 127 deletions.
9 changes: 2 additions & 7 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
kgb>=6.1
mock
kgb~=7.1.1
mercurial
pytest
pytest-env

# Ordering here matters.
mercurial>=4.4.2,<6.2; python_version == '2.7'
mercurial>=5.2; python_version >= '3.6'
hgsubversion; python_version <= '2.7'
116 changes: 61 additions & 55 deletions rbtools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,80 +1,86 @@
#
# __init__.py -- Basic version and package information
#
# Copyright (c) 2007-2009 Christian Hammond
# Copyright (c) 2007-2009 David Trowbridge
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#


from __future__ import unicode_literals


# The version of RBTools
#
# This is in the format of:
#
# (Major, Minor, Micro, Patch, alpha/beta/rc/final, Release Number, Released)
#
VERSION = (3, 1, 2, 0, 'alpha', 0, False)
"""RBTools version and package information.
These variables and functions can be used to identify the version of
Beanbag Tools. They're largely used for packaging purposes.
"""

#: The version of RBTools
#:
#: This is in the format of:
#:
#: (Major, Minor, Micro, Patch, alpha/beta/rc/final, Release Number, Released)
#:
VERSION = (4, 0, 0, 0, 'alpha', 0, False)


def get_version_string():
version = '%s.%s' % (VERSION[0], VERSION[1])
"""Return the version as a human-readable string.
Returns:
str:
The version number as a human-readable string.
"""
major, minor, micro, patch, tag, relnum, is_release = VERSION

version = '%s.%s' % (major, minor)

if VERSION[2] or VERSION[3]:
version += '.%s' % VERSION[2]
if micro or patch:
version += '.%s' % micro

if VERSION[3]:
version += '.%s' % VERSION[3]
if patch:
version += '.%s' % patch

if VERSION[4] != 'final':
if VERSION[4] == 'rc':
version += ' RC%s' % VERSION[5]
if tag != 'final':
if tag == 'rc':
version += ' RC'
else:
version += ' %s %s' % (VERSION[4], VERSION[5])
version += ' %s ' % tag

if not is_release():
version += '%s' % relnum

if not is_release:
version += ' (dev)'

return version


def get_package_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
"""Return the version as a Python package version string.
Returns:
str:
The version number as used in a Python package.
"""
major, minor, micro, patch, tag, relnum = __version_info__

version = '%s.%s' % (major, minor)

if VERSION[2] or VERSION[3]:
version += '.%s' % VERSION[2]
if micro or patch:
version += '.%s' % micro

if VERSION[3]:
version += '.%s' % VERSION[3]
if patch:
version += '.%s' % patch

if VERSION[4] != 'final':
version += '%s%s' % (VERSION[4], VERSION[5])
if tag != 'final':
version += '%s%s' % (
{
'alpha': 'a',
'beta': 'b',
}.get(tag, tag),
relnum)

return version


def is_release():
return VERSION[6]
"""Return whether this is a released version.
Returns:
bool:
``True`` if this is a released version of the package.
``False`` if it is a development version.
"""
return VERSION[-1]


__version_info__ = VERSION[:-1]
Expand Down
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ rc2 = egg_info -Db rc2
release = egg_info -Db ''


[bdist_wheel]
universal = 1


[egg_info]
tag_build = .dev

Expand Down
78 changes: 17 additions & 61 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,4 @@
#!/usr/bin/env python
#
# setup.py -- Installation for rbtools.
#
# Copyright (C) 2009 Christian Hammond
# Copyright (C) 2009 David Trowbridge
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from __future__ import unicode_literals
#!/usr/bin/env python3

import sys

Expand Down Expand Up @@ -53,10 +28,17 @@
'Please install RBTools 0.7.x or upgrade Python to at least '
'2.7.x.\n' % get_package_version())
sys.exit(1)
elif 0x03000000 <= sys.hexversion < 0x03060000:
elif (3, 0) <= sys.version_info < (3, 6):
sys.stderr.write(
'RBTools %s is incompatible with your version of Python.\n'
'Please use Python 3.7+.\n'
% get_package_version())
sys.exit(1)
elif sys.version_info < (3, 7):
sys.stderr.write(
'RBTools %s is incompatible with your version of Python.\n'
'Please use either Python 2.7 or 3.6+.\n'
'Please install RBTools 3.x or upgrade Python to at least '
'3.7.x.\n'
% get_package_version())
sys.exit(1)

Expand Down Expand Up @@ -124,44 +106,19 @@
'rbtools_scm_clients': scm_clients,
},
install_requires=[
'backports.shutil_get_terminal_size; python_version<"3.0"',
'pydiffx>=1.0.1,<=1.999',
'colorama',
'pydiffx~=1.0.1',
'setuptools',
'six>=1.8.0',

# Pin to the last version which supports Python 2.7.
'colorama>=0.3,<0.4; python_version<"3.0"',
'colorama; python_version>"3.0"',

'six>=1.8.0',

# As of 1.6, texttable still supports Python 2.7. Pin in case that
# changes in the future.
'texttable>=1.6,<1.7; python_version<"3.0"',
'texttable; python_version>"3.0"',

# As of 4.x, tqdm is still compatible with Python 2.7, but there's
# no telling how long that'll be the case. Pin in case that changes in
# the future.
'tqdm>=4,<5; python_version<"3.0"',
'tqdm; python_version>"3.0"',

# These are required upstream by tqdm, but we have to pin the version
# to work with Python 2.7. This can be removed entirely once we are
# Python 3+ only.
'importlib_resources>=3.3.1,<3.4; python_version<"3.0"',
'more-itertools==5.0.0; python_version<"3.0"',
'zipp==1.0.0; python_version<"3.0"',
'texttable',
'tqdm',
],
packages=find_packages(exclude=['tests']),
include_package_data=True,
url='https://www.reviewboard.org/downloads/rbtools/',
download_url=('https://downloads.reviewboard.org/releases/%s/%s.%s/'
% (PACKAGE_NAME, VERSION[0], VERSION[1])),
python_requires=(
'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*'
'!=3.5.*'
),
python_requires='>=3.7',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
Expand All @@ -171,13 +128,12 @@
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Software Development',
'Topic :: Software Development :: Quality Assurance',
],
Expand Down

0 comments on commit 918804a

Please sign in to comment.