Skip to content

Commit c0cb698

Browse files
authored
Merge pull request #6 from sensiblecodeio/drop-python-2-support
Drop Python 2 support
2 parents d338469 + b73ef2d commit c0cb698

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

__autoversion__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
``setup.py develop``
55
"""
66

7-
from __future__ import print_function, unicode_literals
87

98
import os
109
import re
@@ -25,7 +24,7 @@
2524
orig = sys.modules[__name__]
2625

2726

28-
class Git(object):
27+
class Git:
2928

3029
@classmethod
3130
def get_branch(cls, path):
@@ -53,7 +52,7 @@ def get_version(cls, path, memo={}):
5352
v = re.search("-[0-9]+-", memo[path])
5453
if v is not None:
5554
# Replace -n- with -branchname-n-
56-
branch = r"-{0}-\1-".format(cls.get_branch(path))
55+
branch = fr"-{cls.get_branch(path)}-\1-"
5756
(memo[path], _) = re.subn("-([0-9]+)-", branch, memo[path], 1)
5857

5958
return memo[path]
@@ -93,7 +92,7 @@ def getversion(package):
9392
"""
9493
distribution = get_distribution(package)
9594
if distribution is None:
96-
raise RuntimeError("Can't find distribution {0}".format(package))
95+
raise RuntimeError(f"Can't find distribution {package}")
9796
repo_type = get_repo_type(distribution.location)
9897
if repo_type is None:
9998
return distribution.version
@@ -113,7 +112,7 @@ def version_from_frame(frame):
113112

114113
module_name = module.__name__
115114

116-
variable = "AUTOVERSION_{}".format(module_name.upper())
115+
variable = f"AUTOVERSION_{module_name.upper()}"
117116
override = os.environ.get(variable, None)
118117
if override is not None:
119118
return override
@@ -161,7 +160,7 @@ def tupleize_version(version):
161160
if version.startswith("<unknown"):
162161
return (("unknown",),)
163162

164-
split = re.split("(?:\.|(-))", version)
163+
split = re.split(r"(?:\.|(-))", version)
165164
parsed = tuple(try_fix_num(x) for x in split if x)
166165

167166
# Put the tuples in groups by "-"

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33

44
conf = dict(
55
name='autoversion',
6-
version='1.2.2',
6+
version='2.0.0',
77
description="Obtain installed version of package automatically, even if "
88
"it is installed using editable or develop",
99
long_description="\n".join(list(open("README"))[2:]).strip(),
1010
classifiers=[
1111
"Intended Audience :: Developers",
1212
"License :: OSI Approved :: MIT License",
1313
"Programming Language :: Python",
14-
"Programming Language :: Python :: 2.7",
15-
"Programming Language :: Python :: 3.5",
14+
"Programming Language :: Python :: 3",
1615
],
1716
requires=["setuptools"],
1817
keywords='autoversion __autoversion__ __version__ __version__tuple__ version git',

0 commit comments

Comments
 (0)