Skip to content

Commit c26c22d

Browse files
committed
🐛 Switched setup's metaclass to py2 syntax
To make py2 parse correctly the file and show the nice "use python3" error. Added a hack to have a py2/py3 support for metaclass on Version, to avoid the new `metaclass=` syntax in setup.py. * Fixes issue #31 Signed-off-by: Guyzmo <[email protected]>
1 parent ae39ea9 commit c26c22d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ def info(cls):
6363
def __str__(cls):
6464
return '.'.join(map(str, cls.info))
6565

66+
# Hack for metaclass support in both Py2 and Py3
67+
class VersionInfo_metaclass(VersionInfo):
68+
def __new__(cls, *bases):
69+
return VersionInfo('version_info', bases, {})
6670

67-
class Version(Command, metaclass=VersionInfo):
71+
class Version(VersionInfo_metaclass(Command)):
6872
description = 'Bump version number'
6973
user_options = [
7074
('major', 'M', 'Bump major part of version number'),

0 commit comments

Comments
 (0)