Merge lp:~brian.curtin/ubuntuone-dev-tools/py3-u1lint into lp:ubuntuone-dev-tools

Proposed by Brian Curtin on 2012-08-22
Status: Merged
Approved by: Roberto Alsina on 2012-08-22
Approved revision: 91
Merged at revision: 90
Proposed branch: lp:~brian.curtin/ubuntuone-dev-tools/py3-u1lint
Merge into: lp:ubuntuone-dev-tools
Diff against target: 92 lines (+24/-14)
1 file modified
bin/u1lint (+24/-14)
To merge this branch: bzr merge lp:~brian.curtin/ubuntuone-dev-tools/py3-u1lint
Reviewer Review Type Date Requested Status
Roberto Alsina (community) 2012-08-22 Approve on 2012-08-22
Review via email: mp+120819@code.launchpad.net

Commit Message

- Prepare u1lint for Python 3 usage. Update imports for 3x and use the print function.

Description of the Change

Update u1lint for Python 3. Rearrange some imports which changed in Python 3 (configparser/winreg) and use the print_function future import.

To post a comment you must log in.
Ubuntu One Auto Pilot (otto-pilot) wrote :

Voting does not meet specified criteria. Required: Approve >= 1, Disapprove == 0, Needs Fixing == 0, Needs Information == 0, Resubmit == 0, Pending == 0. Got: 1 Pending.

Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/u1lint'
2--- bin/u1lint 2012-06-08 11:55:53 +0000
3+++ bin/u1lint 2012-08-22 15:54:18 +0000
4@@ -28,7 +28,15 @@
5 # files in the program, then also delete it here.
6 """Wrapper script for pylint command."""
7
8-import ConfigParser
9+from __future__ import print_function
10+
11+# pylint: disable=F0401
12+try:
13+ import configparser
14+except ImportError:
15+ import ConfigParser as configparser
16+# pylint: disable=F0401
17+
18 import os
19 import subprocess
20 import sys
21@@ -54,31 +62,34 @@
22 return path
23
24 # pylint: disable=F0401
25- import _winreg
26+ try:
27+ import winreg
28+ except ImportError:
29+ import _winreg as winreg
30 # pylint: enable=F0401
31- software_key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'Software')
32+ software_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'Software')
33 python_key = None
34 try:
35- python_key = _winreg.OpenKey(software_key, 'Python')
36+ python_key = winreg.OpenKey(software_key, 'Python')
37 # pylint: disable=E0602
38 except WindowsError:
39 # pylint: enable=E0602
40 try:
41 # look in the WoW6432node, we are running python
42 # 32 on a 64 machine
43- wow6432node_key = _winreg.OpenKey(software_key, 'WoW6432Node')
44- python_key = _winreg.OpenKey(wow6432node_key, 'Python')
45+ wow6432node_key = winreg.OpenKey(software_key, 'WoW6432Node')
46+ python_key = winreg.OpenKey(wow6432node_key, 'Python')
47 # pylint: disable=E0602
48 except WindowsError:
49 # pylint: enable=E0602
50 raise InvalidSetupException(
51 'Could not located python installation path.')
52 try:
53- core_key = _winreg.OpenKey(python_key, 'PythonCore')
54+ core_key = winreg.OpenKey(python_key, 'PythonCore')
55 # pylint: disable=E1101
56- version_key = _winreg.OpenKey(core_key, sys.winver)
57+ version_key = winreg.OpenKey(core_key, sys.winver)
58 # pylint: enable=E1101
59- return _winreg.QueryValue(version_key, 'InstallPath')
60+ return winreg.QueryValue(version_key, 'InstallPath')
61 # pylint: disable=E0602
62 except WindowsError:
63 # pylint: enable=E0602
64@@ -139,13 +150,13 @@
65 def _read_pylintrc_ignored():
66 """Get the ignored files list from pylintrc"""
67 try:
68- config = ConfigParser.ConfigParser()
69+ config = configparser.ConfigParser()
70 config.read([PYLINTRC])
71
72 # pylint: disable=E1103
73 return [os.path.join(SRCDIR, item) for item in
74 config.get("MASTER", "ignore").split(",")]
75- except (TypeError, ConfigParser.NoOptionError):
76+ except (TypeError, configparser.NoOptionError):
77 return []
78 # pylint: enable=E1103
79
80@@ -245,10 +256,9 @@
81
82 output = "".join(notices.readlines())
83 if output != "":
84- print "== Python Lint Notices =="
85+ print("== Python Lint Notices ==")
86 (failed, grouped) = _group_lines_by_file(output)
87- print grouped
88- print ""
89+ print(grouped, end="\n\n")
90
91 returncode = sp.wait()
92 # XXX Testing that W0511 does not cause a failure

Subscribers

People subscribed via source and target branches

to all changes: