Skip to content

Commit 3102199

Browse files
Merge branch 'python3'
* python3: Update travis.yml to generate build matrix Add python version info to admin list view Run through 2to3 Update to support Python3 in preparation for Django 2.0 # Conflicts: # .travis.yml # README.rst # tox.ini
2 parents 7cd01ee + c714966 commit 3102199

18 files changed

+124
-40
lines changed

.travis.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
language:
2-
python
3-
2+
python
43
python:
5-
2.7
6-
4+
- "2.7"
5+
- "3.6"
76
install:
8-
pip install tox
9-
7+
pip install tox-travis
108
script:
11-
tox
9+
tox

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
.. image:: https://badge.fury.io/py/django-package-monitor.svg
55
:target: https://badge.fury.io/py/django-package-monitor
66

7-
87
Django Package Monitor
98
======================
109

package_monitor/admin.py

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def check_pypi(modeladmin, request, queryset):
2727
logger.debug("Ignoring version update '%s' is editable", p.package_name)
2828
else:
2929
p.update_from_pypi()
30+
31+
3032
check_pypi.short_description = "Update selected packages from PyPI"
3133

3234

@@ -76,15 +78,39 @@ class PackageVersionAdmin(admin.ModelAdmin):
7678
actions = (check_pypi,)
7779
change_list_template = 'change_list.html'
7880
list_display = (
79-
'package_name', 'is_editable', '_updateable', 'current_version', 'next_version',
80-
'latest_version', '_licence', 'diff_status', 'checked_pypi_at', 'is_parseable'
81+
'package_name',
82+
'_updateable',
83+
'current_version',
84+
'next_version',
85+
'latest_version',
86+
'supports_py3',
87+
'_licence',
88+
'diff_status',
89+
'checked_pypi_at',
90+
)
91+
list_filter = (
92+
'diff_status',
93+
'is_editable',
94+
'is_parseable',
95+
UpdateAvailableListFilter,
96+
'supports_py3'
8197
)
82-
list_filter = ('diff_status', 'is_editable', 'is_parseable', UpdateAvailableListFilter)
8398
ordering = ["package_name"]
8499
readonly_fields = (
85-
'package_name', 'is_editable', 'current_version', 'next_version',
86-
'latest_version', 'diff_status', 'checked_pypi_at',
87-
'url', 'licence', 'raw', 'available_updates', 'is_parseable'
100+
'package_name',
101+
'is_editable',
102+
'is_parseable',
103+
'current_version',
104+
'next_version',
105+
'latest_version',
106+
'diff_status',
107+
'checked_pypi_at',
108+
'url',
109+
'licence',
110+
'raw',
111+
'available_updates',
112+
'python_support',
113+
'supports_py3',
88114
)
89115

90116
def _licence(self, obj):
@@ -99,7 +125,7 @@ def _updateable(self, obj):
99125
else:
100126
return obj.latest_version != obj.current_version
101127
_updateable.boolean = True
102-
_updateable.short_description = u"Update available"
128+
_updateable.short_description = "Update available"
103129

104130
def available_updates(self, obj):
105131
"""Print out all versions ahead of the current one."""
@@ -108,4 +134,5 @@ def available_updates(self, obj):
108134
versions = package.all_versions()
109135
return html_list([v for v in versions if v > obj.current_version])
110136

137+
111138
admin.site.register(PackageVersion, PackageVersionAdmin)

package_monitor/compat.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- coding: utf-8 -*-
2+
"""Python 2/3 compatibility imports."""
3+
try:
4+
from unittest import mock
5+
print("Successfully imports mock from unittest")
6+
except ImportError:
7+
print("Trying to import standalone mock")
8+
import mock
9+
print("Successfully imported standalone mock")

package_monitor/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
2+
33

44
from django.db import migrations, models
55
import semantic_version.django_fields

package_monitor/migrations/0002_auto_20151126_1453.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
2+
33

44
from django.db import migrations, models
55

package_monitor/migrations/0003_packageversion_next_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
2+
33

44
from django.db import migrations, models
55
import semantic_version.django_fields

package_monitor/migrations/0004_auto_20160109_1339.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
2+
33

44
from django.db import migrations, models
55

package_monitor/migrations/0005_packageversion_is_parseable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
2+
33

44
from django.db import migrations, models
55

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('package_monitor', '0005_packageversion_is_parseable'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='packageversion',
16+
name='python_support',
17+
field=models.CharField(default='', help_text=b'Python version support as specified in the PyPI classifiers.', max_length=100),
18+
preserve_default=False,
19+
),
20+
migrations.AddField(
21+
model_name='packageversion',
22+
name='supports_py3',
23+
field=models.NullBooleanField(default=None, help_text=b'Does this package support Python3?'),
24+
),
25+
]

0 commit comments

Comments
 (0)