summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2016-07-30 07:43:38 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2016-07-30 16:03:56 (GMT)
commitfdf04887c09e2d1daf06dd64c67fc9db88d367ed (patch)
tree27a66ca25b6ac79ca310c801faf74a4f96aaa555
parent0bcb3351fbe3c4e75ba84e6537ac1a8a1cd422ea (diff)
downloadscrutiny-fdf04887c09e2d1daf06dd64c67fc9db88d367ed.zip
scrutiny-fdf04887c09e2d1daf06dd64c67fc9db88d367ed.tar.gz
scrutiny-fdf04887c09e2d1daf06dd64c67fc9db88d367ed.tar.bz2
misc: add python 3 compat
-rw-r--r--debian/control2
-rw-r--r--requirements.txt2
-rw-r--r--scrutiny/projects/management/commands/scrutinise.py4
-rw-r--r--scrutiny/projects/models.py4
-rw-r--r--scrutiny/projects/views.py10
-rw-r--r--scrutiny/settings.py2
-rwxr-xr-xsetup.py2
7 files changed, 13 insertions, 13 deletions
diff --git a/debian/control b/debian/control
index 8253988..fbe138f 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ X-Python-Version: >= 2.7
Package: python-scrutiny
Architecture: all
Depends: ${misc:Depends}, ${python:Depends},
- python-django (>= 1.7),
+ python-django (>= 1.8),
python-gadjo
Recommends: python-django-mellon
Description: Tracker of installed modules
diff --git a/requirements.txt b/requirements.txt
index 5f88e96..32dde67 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
-django >= 1.7, < 1.8
+django >= 1.7, < 1.9
gadjo
requests
diff --git a/scrutiny/projects/management/commands/scrutinise.py b/scrutiny/projects/management/commands/scrutinise.py
index 7e4cb67..aa99e76 100644
--- a/scrutiny/projects/management/commands/scrutinise.py
+++ b/scrutiny/projects/management/commands/scrutinise.py
@@ -15,13 +15,13 @@ class Command(BaseCommand):
if not service.url.endswith('/'):
service.url = '%s/' % service.url
if self.verbose:
- print 'Checking', service.url
+ print('Checking %s' % service.url)
try:
response = requests.get('%s__version__' % service.url,
timeout=5, verify=False)
response.raise_for_status()
except requests.RequestException as e:
- print 'Error with', service.url, e
+ print('Error with %s (%r)' % (service.url, e))
continue
versions = response.json()
diff --git a/scrutiny/projects/models.py b/scrutiny/projects/models.py
index 03b61bd..0605809 100644
--- a/scrutiny/projects/models.py
+++ b/scrutiny/projects/models.py
@@ -55,7 +55,7 @@ class Service(models.Model):
uninstalled_modules.append(installed_version.version.module)
continue
modules[installed_version.version.module.name] = installed_version.version.module
- return sorted(modules.values(), lambda x, y: cmp(x.name, y.name))
+ return sorted(modules.values(), key=lambda x: x.name)
def get_installed_service(self, platform):
try:
@@ -144,7 +144,7 @@ class Module(models.Model):
p = subprocess.Popen(cmd, **kws)
stdout = p.communicate()[0]
p.wait()
- return stdout
+ return stdout.decode('utf-8')
def get_all_installed_versions(self):
versions = set()
diff --git a/scrutiny/projects/views.py b/scrutiny/projects/views.py
index ab23642..e621ea6 100644
--- a/scrutiny/projects/views.py
+++ b/scrutiny/projects/views.py
@@ -61,7 +61,7 @@ class ModuleIssuesView(TemplateView):
issue = issues[int(issue.id)]
issue.add_commit(commit)
- issues_list = issues.items()
+ issues_list = list(issues.items())
issues_list.sort()
context['issues'] = [x[1] for x in issues_list]
@@ -118,12 +118,12 @@ class ProjectSummaryHistoryView(DetailView):
'name': installed.version.module.name,
'current_version': installed.version.version,
}
- versions_sorted_by_day = versions_and_day.values()
+ versions_sorted_by_day = list(versions_and_day.values())
versions_sorted_by_day.sort(key=lambda x: x.get('day'))
previous_versions = {}
for version_and_day in versions_sorted_by_day:
- for module_name, module_versions in version_and_day['modules'].items():
+ for module_name, module_versions in list(version_and_day['modules'].items()):
if module_name in previous_versions:
module_versions['previous_version'] = previous_versions[module_name]
if module_versions['previous_version'] == module_versions['current_version']:
@@ -235,7 +235,7 @@ class IssuesSnippet(TemplateView):
def get_context_data(self, **kwargs):
context = super(IssuesSnippet, self).get_context_data(**kwargs)
- modules = json.loads(self.request.read())
+ modules = json.loads(self.request.read().decode('utf-8'))
issues = {}
for module_info in modules.values():
@@ -258,7 +258,7 @@ class IssuesSnippet(TemplateView):
issues[int(issue.id)].modules = {}
issues[int(issue.id)].modules[module_info['name']] = True
- context['issues'] = issues.values()
+ context['issues'] = list(issues.values())
context['issues'].sort(key=lambda x: x.closed_on)
context['issues'].reverse() # most recent on top
return context
diff --git a/scrutiny/settings.py b/scrutiny/settings.py
index 2181734..2174964 100644
--- a/scrutiny/settings.py
+++ b/scrutiny/settings.py
@@ -100,4 +100,4 @@ REDMINE_API_KEY = None
local_settings_file = os.environ.get('SCRUTINY_SETTINGS_FILE',
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
if os.path.exists(local_settings_file):
- execfile(local_settings_file)
+ exec(open(local_settings_file).read())
diff --git a/setup.py b/setup.py
index 8048fcc..98da4a8 100755
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,7 @@ setup(name='scrutiny',
scripts=['manage.py'],
include_package_data = True,
install_requires=[
- 'django >= 1.7, < 1.8',
+ 'django >= 1.7, < 1.9',
'requests',
'gadjo',
],