diff --git a/run_tests.py b/run_tests.py deleted file mode 100644 index ccdb913..0000000 --- a/run_tests.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -import sys - -try: - import django -except ImportError: - print("Error: missing test dependency:") - print(" django library is needed to run test suite") - print(" you can install it with 'pip install django'") - sys.exit(1) - -from django.conf import settings - - -def main(): - # Dynamically configure the Django settings with the minimum necessary to - # get Django running tests. - - settings.configure( - INSTALLED_APPS=[ - 'versionfield', - ], - DATABASE_ENGINE='django.db.backends.sqlite3', - DATABASES={ - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': ':memory:', - } - }, - DEBUG=True, - TEMPLATE_DEBUG=True, - ) - - if django.VERSION[:2] >= (1, 7): - django.setup() - - apps = ['versionfield'] - - from django.test.utils import get_runner - - DjangoTestRunner = get_runner(settings) - - failures = DjangoTestRunner(verbosity=2, interactive=True).run_tests(apps) - sys.exit(failures) - - -if __name__ == '__main__': - main() diff --git a/setup.py b/setup.py index 7c916fb..d4a2ae4 100644 --- a/setup.py +++ b/setup.py @@ -21,9 +21,6 @@ author_email="yurtaev.egor+versionfield@gmail.com", packages=["versionfield"], include_package_data=True, - install_requires=[ - "future>=0.16.0", - ], classifiers=[ "Development Status :: 5 - Production/Stable", "Framework :: Django", @@ -31,8 +28,6 @@ "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", diff --git a/versionfield/__init__.py b/versionfield/__init__.py index 2b083c5..95b24d2 100644 --- a/versionfield/__init__.py +++ b/versionfield/__init__.py @@ -1,7 +1,3 @@ -from builtins import str -from past.builtins import basestring -from future.utils import python_2_unicode_compatible - import django from django.db import models from django.core.exceptions import ValidationError @@ -20,7 +16,7 @@ def to_python(self, value): if isinstance(value, Version): return int(value) - if isinstance(value, basestring): + if isinstance(value, str): return Version(value, self.number_bits) if value is None: @@ -33,7 +29,7 @@ def from_db_value(self, value, *args, **kwargs): if isinstance(value, Version): return int(value) - if isinstance(value, basestring): + if isinstance(value, str): return Version(value, self.number_bits) if value is None: @@ -45,7 +41,7 @@ def to_python(self, value): if isinstance(value, Version): return int(value) - if isinstance(value, basestring): + if isinstance(value, str): return Version(value, self.number_bits) if value is None: @@ -66,7 +62,7 @@ def __init__(self, number_bits=DEFAULT_NUMBER_BITS, *args, **kwargs): super(VersionField, self).__init__(*args, **kwargs) def get_prep_value(self, value): - if isinstance(value, basestring): + if isinstance(value, str): try: return int(Version(value, self.number_bits)) except ValueError: @@ -86,7 +82,6 @@ def formfield(self, **kwargs): defaults.update(kwargs) return super(VersionField, self).formfield(**defaults) - @python_2_unicode_compatible def __str__(self, value): return str(value) diff --git a/versionfield/version.py b/versionfield/version.py index c1a2246..9c2366c 100644 --- a/versionfield/version.py +++ b/versionfield/version.py @@ -1,8 +1,4 @@ # coding: utf8 -from builtins import str -from past.builtins import basestring -from future.utils import python_2_unicode_compatible - from .utils import convert_version_string_to_int, convert_version_int_to_string @@ -15,7 +11,6 @@ def __init__(self, string, number_bits): self.number_bits = number_bits self.internal_integer = convert_version_string_to_int(string, number_bits) - @python_2_unicode_compatible def __str__(self): return str(convert_version_int_to_string(self.internal_integer, self.number_bits)) @@ -28,7 +23,7 @@ def __int__(self): def __eq__(self, other): if not other: return False # we are obviously a valid Version, but 'other' isn't - if isinstance(other, basestring): + if isinstance(other, str): return self == Version(other, self.number_bits) else: return int(self) == int(other)