diff --git a/.gitignore b/.gitignore index f1c6f94..60fa3f1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ .DS_Store .eggs .tox +/build /dist /wheelhouse diff --git a/.travis.yml b/.travis.yml index 99f4106..e63ffae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,36 @@ language: python python: - - "2.7" + - "3.5" + - "3.6" + - "3.7" -env: - matrix: - - TOX_ENV=py27-dj14 - - TOX_ENV=py27-dj15 - - TOX_ENV=py27-dj16 - - TOX_ENV=py27-dj17 - - TOX_ENV=py27-dj18 - - TOX_ENV=py33-dj15 - - TOX_ENV=py33-dj16 - - TOX_ENV=py33-dj17 - - TOX_ENV=py33-dj18 - - TOX_ENV=py34-dj15 - - TOX_ENV=py34-dj16 - - TOX_ENV=py34-dj17 - - TOX_ENV=py34-dj18 - - TOX_ENV=pypy-dj14 - - TOX_ENV=pypy-dj15 - - TOX_ENV=pypy-dj16 - - TOX_ENV=pypy-dj17 - - TOX_ENV=pypy-dj18 - - TOX_ENV=py27-cov +matrix: + include: + - python: "3.5" + env: TOXENV="py35-dj20" + - python: "3.5" + env: TOXENV="py35-dj21" + - python: "3.5" + env: TOXENV="py35-dj22" + - python: "3.6" + env: TOXENV="py36-dj20" + - python: "3.6" + env: TOXENV="py36-dj21" + - python: "3.6" + env: TOXENV="py36-dj22" + - python: "3.7" + env: TOXENV="py37-dj20" + - python: "3.7" + env: TOXENV="py37-dj21" + - python: "3.7" + env: TOXENV="py37-dj22" install: - pip install tox script: - - tox -e $TOX_ENV + - tox -e $TOXENV + after_success: - coveralls diff --git a/dj_elastictranscoder/migrations/0001_initial.py b/dj_elastictranscoder/migrations/0001_initial.py index db0199f..9693e37 100644 --- a/dj_elastictranscoder/migrations/0001_initial.py +++ b/dj_elastictranscoder/migrations/0001_initial.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations +import django.db.models.deletion class Migration(migrations.Migration): @@ -20,7 +21,7 @@ class Migration(migrations.Migration): ('message', models.TextField()), ('created_at', models.DateTimeField(auto_now_add=True)), ('last_modified', models.DateTimeField(auto_now=True)), - ('content_type', models.ForeignKey(to='contenttypes.ContentType')), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), ], ), ] diff --git a/dj_elastictranscoder/models.py b/dj_elastictranscoder/models.py index e226543..7389153 100644 --- a/dj_elastictranscoder/models.py +++ b/dj_elastictranscoder/models.py @@ -1,12 +1,7 @@ from django.db import models +from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType -import django -if django.VERSION >= (1, 8): - from django.contrib.contenttypes.fields import GenericForeignKey -else: - from django.contrib.contenttypes.generic import GenericForeignKey - class EncodeJob(models.Model): STATE_CHOICES = ( @@ -17,7 +12,7 @@ class EncodeJob(models.Model): (4, 'Complete'), ) id = models.CharField(max_length=100, primary_key=True) - content_type = models.ForeignKey(ContentType) + content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() state = models.PositiveIntegerField(choices=STATE_CHOICES, default=0, db_index=True) content_object = GenericForeignKey() diff --git a/dj_elastictranscoder/south_migrations/0001_initial.py b/dj_elastictranscoder/south_migrations/0001_initial.py deleted file mode 100644 index 849422f..0000000 --- a/dj_elastictranscoder/south_migrations/0001_initial.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'EncodeJob' - db.create_table(u'dj_elastictranscoder_encodejob', ( - ('id', self.gf('django.db.models.fields.CharField')(max_length=100, primary_key=True)), - ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), - ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), - ('state', self.gf('django.db.models.fields.PositiveIntegerField')(default=0, db_index=True)), - ('message', self.gf('django.db.models.fields.TextField')()), - ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('last_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - )) - db.send_create_signal(u'dj_elastictranscoder', ['EncodeJob']) - - - def backwards(self, orm): - # Deleting model 'EncodeJob' - db.delete_table(u'dj_elastictranscoder_encodejob') - - - models = { - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - u'dj_elastictranscoder.encodejob': { - 'Meta': {'object_name': 'EncodeJob'}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'primary_key': 'True'}), - 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'message': ('django.db.models.fields.TextField', [], {}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), - 'state': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}) - } - } - - complete_apps = ['dj_elastictranscoder'] \ No newline at end of file diff --git a/dj_elastictranscoder/south_migrations/__init__.py b/dj_elastictranscoder/south_migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dj_elastictranscoder/urls.py b/dj_elastictranscoder/urls.py index 7ae4e8c..4222b6e 100644 --- a/dj_elastictranscoder/urls.py +++ b/dj_elastictranscoder/urls.py @@ -1,27 +1,9 @@ -import django - - -if django.VERSION >= (1, 9): - from django.conf.urls import url - from dj_elastictranscoder import views - - urlpatterns = [ - url(https://github.com/r'%5Eendpoint/),%20views.aws_endpoint), - url(https://github.com/r'%5Eaws_endpoint/'),%20views.aws_endpoint,%20name='aws_endpoint'), - url(https://github.com/r'%5Eqiniu_endpoint/'),%20views.qiniu_endpoint,%20name='qiniu_endpoint'), - url(https://github.com/r'%5Ealiyun_endpoint',%20views.aliyun_endpoint,%20name='aliyun_endpoint'), - ] - -else: - try: - from django.conf.urls import url, patterns - except ImportError: - from django.conf.urls.defaults import url, patterns # Support for Django < 1.4 - - urlpatterns = patterns( - 'dj_elastictranscoder.views', - url(https://github.com/r'%5Eendpoint/'),%20'aws_endpoint'), - url(https://github.com/r'%5Eaws_endpoint/'),%20'aws_endpoint',%20name='aws_endpoint'), - url(https://github.com/r'%5Eqiniu_endpoint/'),%20'qiniu_endpoint',%20name='qiniu_endpoint'), - url(https://github.com/r'%5Ealiyun_endpoint',%20'aliyun_endpoint',%20name='aliyun_endpoint'), - ) +from django.conf.urls import url +from dj_elastictranscoder import views + +urlpatterns = [ + url(https://github.com/r'%5Eendpoint/),%20views.aws_endpoint), + url(https://github.com/r'%5Eaws_endpoint/'),%20views.aws_endpoint,%20name='aws_endpoint'), + url(https://github.com/r'%5Eqiniu_endpoint/'),%20views.qiniu_endpoint,%20name='qiniu_endpoint'), + url(https://github.com/r'%5Ealiyun_endpoint',%20views.aliyun_endpoint,%20name='aliyun_endpoint'), +] diff --git a/setup.py b/setup.py index 6268e86..7841ce0 100644 --- a/setup.py +++ b/setup.py @@ -37,17 +37,17 @@ def get_version(): zip_safe=False, install_requires=[ "boto3 >= 1.1", - "django >= 1.3, < 2.0", + "django >= 1.11, < 3.0", "qiniu >= 7.0.8", ], classifiers=[ "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2", - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', + "Programming Language :: Python :: 3", + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', "Topic :: Software Development :: Libraries :: Python Modules", "Environment :: Web Environment", "Framework :: Django", diff --git a/testsapp/requirements.txt b/testsapp/requirements.txt index 6513ae3..8670753 100644 --- a/testsapp/requirements.txt +++ b/testsapp/requirements.txt @@ -2,4 +2,3 @@ pytest pytest-django pytest-cov boto -south \ No newline at end of file diff --git a/testsapp/tests_settings.py b/testsapp/tests_settings.py index 3eaaec3..20f02f7 100644 --- a/testsapp/tests_settings.py +++ b/testsapp/tests_settings.py @@ -15,5 +15,5 @@ ] SITE_ID = 1 DEBUG = False -ROOT_URLCONF = '' -SECRET_KEY='test' \ No newline at end of file +ROOT_URLCONF = 'dj_elastictranscoder.urls' +SECRET_KEY='test' diff --git a/tox.ini b/tox.ini index d77ba72..3b6e007 100644 --- a/tox.ini +++ b/tox.ini @@ -1,33 +1,19 @@ [tox] -# for py 3.x we are using only django 1.6.x as 1.5.x had only "experimental py3 support" -envlist = - py{27,py}-dj{14,15,16,17,18}, - py{33,34}-dj{15,16,17,18}, - py27-cov +envlist = py{35,36,37}-dj{20,21,22} skipsdist = True usedevelop = True [testenv] commands = {posargs:py.test --create-db -vv} basepython = - py27: python2.7 - py33: python3.3 - py34: python3.4 - pypy: pypy + py35: python3.5 + py36: python3.6 + py37: python3.7 deps = -rtestsapp/requirements.txt - dj14: django>=1.4,<1.4.999 - dj15: django>=1.5,<1.5.999 - dj16: django>=1.6,<1.6.999 - dj17: django>=1.7,<1.7.999 - dj18: django>=1.8,<1.8.999 - dj19: https://github.com/django/django/archive/master.tar.gz#egg=django + dj20: Django>=2.0,<2.1 + dj21: Django>=2.1,<2.2 + dj22: Django>=2.2,<3.0 setenv = DJANGO_SETTINGS_MODULE = testsapp.tests_settings PYTHONPATH = {toxinidir}/testsapp:{toxinidir} - -[testenv:py27-cov] -commands = py.test --cov=dj_elastictranscoder -deps = - -rtestsapp/requirements.txt - django>=1.8,<1.8.999