Hello community, here is the log from the commit of package python-pep8 for openSUSE:Factory checked in at 2012-05-29 10:35:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pep8 (Old) and /work/SRC/openSUSE:Factory/.python-pep8.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pep8", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-pep8/python-pep8.changes 2012-04-17 07:49:02.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-pep8.new/python-pep8.changes 2012-05-29 10:35:44.000000000 +0200 @@ -1,0 +2,13 @@ +Wed May 23 10:55:29 UTC 2012 - [email protected] + +- Add python 3 package +- Clean up spec file +- Update to release 1.1 + * Add E901 for syntax errors. (Issues #63 and #30) + * Add E271, E272, E273 and E274 for extraneous whitespace around + keywords. (Issue #57) + * Add ``tox.ini`` configuration file for tests. (Issue #61) + * Add ``.travis.yml`` configuration file for continuous integration. + (Issue #62) + +------------------------------------------------------------------- New Changes file: --- /dev/null 2012-05-03 01:24:41.895590051 +0200 +++ /work/SRC/openSUSE:Factory/.python-pep8.new/python3-pep8.changes 2012-05-29 10:35:44.000000000 +0200 @@ -0,0 +1,13 @@ +------------------------------------------------------------------- +Wed May 23 10:55:29 UTC 2012 - [email protected] + +- Add python 3 package +- Clean up spec file +- Update to release 1.1 + * Add E901 for syntax errors. (Issues #63 and #30) + * Add E271, E272, E273 and E274 for extraneous whitespace around + keywords. (Issue #57) + * Add ``tox.ini`` configuration file for tests. (Issue #61) + * Add ``.travis.yml`` configuration file for continuous integration. + (Issue #62) + Old: ---- pep8-1.0.1.tar.gz New: ---- pep8-1.1.tar.gz python3-pep8.changes python3-pep8.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pep8.spec ++++++ --- /var/tmp/diff_new_pack.kEZHQF/_old 2012-05-29 10:35:45.000000000 +0200 +++ /var/tmp/diff_new_pack.kEZHQF/_new 2012-05-29 10:35:45.000000000 +0200 @@ -15,51 +15,47 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - -Name: python-pep8 -Version: 1.0.1 +%define modname pep8 +Name: python-%{modname} +Version: 1.1 Release: 0 Url: http://github.com/jcrocholl/pep8 Summary: Python style guide checker License: MIT Group: Development/Languages/Python -Source: pep8-%{version}.tar.gz +Source: http://pypi.python.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: fdupes BuildRequires: python-devel BuildRequires: python-distribute -Requires: python-distribute -%if 0%{?suse_version} +%if 0%{?suse_version} <= 1110 +%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%else %py_requires -%if 0%{?suse_version} > 1010 -BuildRequires: fdupes -%endif -%if 0%{?suse_version} > 1110 BuildArch: noarch %endif -%endif -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + %description Pep8 is a tool to check your Python code against some of the style conventions in PEP 8. %prep -%setup -q -n pep8-%{version} -sed -i '1d' pep8.py # Remove she-bang line +%setup -q -n %{modname}-%{version} +sed -i '1d' %{modname}.py # Remove she-bang line %build python setup.py build %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} -%if 0%{?suse_version} > 1010 %fdupes %{buildroot} -%endif %files %defattr(-,root,root) %doc CHANGES.txt README.rst TODO.txt -%{_bindir}/pep8 -%{python_sitelib}/* +%{_bindir}/%{modname} +%{python_sitelib}/%{modname}.py* +%{python_sitelib}/%{modname}-%{version}-py%{py_ver}.egg-info/ %changelog ++++++ python3-pep8.spec ++++++ # # spec file for package python3-pep8 # # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %define modname pep8 Name: python3-%{modname} Version: 1.1 Release: 0 Url: http://github.com/jcrocholl/pep8 Summary: Python style guide checker License: MIT Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: fdupes BuildRequires: python3 BuildRequires: python3-2to3 BuildRequires: python3-devel BuildRequires: python3-distribute %if 0%{?suse_version} <= 1140 %{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)} %endif Requires: python3 >= %{py3_ver} BuildArch: noarch %description Pep8 is a tool to check your Python code against some of the style conventions in PEP 8. %prep %setup -q -n %{modname}-%{version} sed -i '1d' %{modname}.py # Remove she-bang line %build python3 setup.py build %install python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} mv %{buildroot}%{_bindir}/%{modname} %{buildroot}%{_bindir}/%{modname}-python%{py3_ver} %if 0%{?suse_version} > 1210 rm -r %{buildroot}%{python3_sitelib}/__pycache__/ %endif %fdupes %{buildroot} %files %defattr(-,root,root) %doc CHANGES.txt README.rst TODO.txt %{_bindir}/%{modname}-python%{py3_ver} %{python3_sitelib}/%{modname}.py* %{python3_sitelib}/%{modname}-%{version}-py%{py3_ver}.egg-info/ %if 0%{?suse_version} <= 1140 %dir %{_prefix}/lib/python%{py3_ver} %endif %changelog ++++++ pep8-1.0.1.tar.gz -> pep8-1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.0.1/CHANGES.txt new/pep8-1.1/CHANGES.txt --- old/pep8-1.0.1/CHANGES.txt 2012-04-06 17:36:47.000000000 +0200 +++ new/pep8-1.1/CHANGES.txt 2012-05-24 10:02:37.000000000 +0200 @@ -2,6 +2,20 @@ ========= +1.1 (2012-05-24) +---------------- + +* Add E901 for syntax errors. (Issues #63 and #30) + +* Add E271, E272, E273 and E274 for extraneous whitespace around + keywords. (Issue #57) + +* Add ``tox.ini`` configuration file for tests. (Issue #61) + +* Add ``.travis.yml`` configuration file for continuous integration. + (Issue #62) + + 1.0.1 (2012-04-06) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.0.1/PKG-INFO new/pep8-1.1/PKG-INFO --- old/pep8-1.0.1/PKG-INFO 2012-04-06 17:41:22.000000000 +0200 +++ new/pep8-1.1/PKG-INFO 2012-05-24 10:04:57.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: pep8 -Version: 1.0.1 +Version: 1.1 Summary: Python style guide checker Home-page: http://github.com/jcrocholl/pep8 Author: Johann C. Rocholl @@ -141,6 +141,20 @@ ========= + 1.1 (2012-05-24) + ---------------- + + * Add E901 for syntax errors. (Issues #63 and #30) + + * Add E271, E272, E273 and E274 for extraneous whitespace around + keywords. (Issue #57) + + * Add ``tox.ini`` configuration file for tests. (Issue #61) + + * Add ``.travis.yml`` configuration file for continuous integration. + (Issue #62) + + 1.0.1 (2012-04-06) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.0.1/pep8.egg-info/PKG-INFO new/pep8-1.1/pep8.egg-info/PKG-INFO --- old/pep8-1.0.1/pep8.egg-info/PKG-INFO 2012-04-06 17:41:20.000000000 +0200 +++ new/pep8-1.1/pep8.egg-info/PKG-INFO 2012-05-24 10:04:57.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: pep8 -Version: 1.0.1 +Version: 1.1 Summary: Python style guide checker Home-page: http://github.com/jcrocholl/pep8 Author: Johann C. Rocholl @@ -141,6 +141,20 @@ ========= + 1.1 (2012-05-24) + ---------------- + + * Add E901 for syntax errors. (Issues #63 and #30) + + * Add E271, E272, E273 and E274 for extraneous whitespace around + keywords. (Issue #57) + + * Add ``tox.ini`` configuration file for tests. (Issue #61) + + * Add ``.travis.yml`` configuration file for continuous integration. + (Issue #62) + + 1.0.1 (2012-04-06) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.0.1/pep8.egg-info/SOURCES.txt new/pep8-1.1/pep8.egg-info/SOURCES.txt --- old/pep8-1.0.1/pep8.egg-info/SOURCES.txt 2012-04-06 17:41:22.000000000 +0200 +++ new/pep8-1.1/pep8.egg-info/SOURCES.txt 2012-05-24 10:04:57.000000000 +0200 @@ -21,11 +21,13 @@ testsuite/E24.py testsuite/E25.py testsuite/E26.py +testsuite/E27.py testsuite/E30.py testsuite/E30not.py testsuite/E40.py testsuite/E50.py testsuite/E70.py +testsuite/E90.py testsuite/W19.py testsuite/W29.py testsuite/W39.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.0.1/pep8.py new/pep8-1.1/pep8.py --- old/pep8-1.0.1/pep8.py 2012-04-06 17:36:47.000000000 +0200 +++ new/pep8-1.1/pep8.py 2012-05-24 09:24:41.000000000 +0200 @@ -42,6 +42,7 @@ 500 line length 600 deprecation 700 statements +900 syntax error You can add checks to this program by writing plugins. Each plugin is a simple function that is called for each line of source code, either @@ -92,7 +93,7 @@ """ -__version__ = '1.0.1' +__version__ = '1.1' import os import sys @@ -121,6 +122,8 @@ DOCSTRING_REGEX = re.compile(r'u?r?["\']') WHITESPACE_AROUND_OPERATOR_REGEX = \ re.compile('([^\w\s]*)\s*(\t| )\s*([^\w\s]*)') +WHITESPACE_AROUND_KEYWORD_REGEX = \ + re.compile('([^\s]*)\s*(\t| )\s*([^\s]*)') EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]') WHITESPACE_AROUND_NAMED_PARAMETER_REGEX = \ re.compile(r'[()]|\s=[^=]|[^=!<>]=\s') @@ -136,8 +139,8 @@ OPERATORS = BINARY_OPERATORS | UNARY_OPERATORS SKIP_TOKENS = frozenset([tokenize.COMMENT, tokenize.NL, tokenize.INDENT, tokenize.DEDENT, tokenize.NEWLINE]) -E225NOT_KEYWORDS = (frozenset(keyword.kwlist + ['print']) - - frozenset(['False', 'None', 'True'])) +KEYWORDS = (frozenset(keyword.kwlist + ['print']) - + frozenset(['False', 'None', 'True'])) BENCHMARK_KEYS = ('directories', 'files', 'logical lines', 'physical lines') options = None @@ -338,6 +341,28 @@ return found, "E203 whitespace before '%s'" % char +def whitespace_around_keywords(logical_line): + """ + Avoid extraneous whitespace around keywords. + + Okay: True and False + E271: True and False + E272: True and False + E273: True and\tFalse + E274: True\tand False + """ + for match in WHITESPACE_AROUND_KEYWORD_REGEX.finditer(logical_line): + before, whitespace, after = match.groups() + tab = whitespace == '\t' + offset = match.start(2) + if before in KEYWORDS: + return offset, (tab and "E273 tab after keyword" or + "E271 multiple spaces after keyword") + elif after in KEYWORDS: + return offset, (tab and "E274 tab before keyword" or + "E272 multiple spaces before keyword") + + def missing_whitespace(logical_line): """ JCR: Each comma, semicolon or colon should be followed by whitespace. @@ -514,7 +539,7 @@ if prev_text in '}])': need_space = True elif prev_type == tokenize.NAME: - if prev_text not in E225NOT_KEYWORDS: + if prev_text not in KEYWORDS: need_space = True else: need_space = True @@ -931,6 +956,23 @@ text, check) self.previous_logical = self.logical_line + def generate_tokens(self): + """ + Check if the syntax is valid. + """ + tokengen = tokenize.generate_tokens(self.readline_check_physical) + try: + for token in tokengen: + yield token + except (SyntaxError, tokenize.TokenError): + exc_type, exc = sys.exc_info()[:2] + offset = exc.args[1] + if len(offset) > 2: + offset = offset[1:3] + self.report_error(offset[0], offset[1], + 'E901 %s: %s' % (exc_type.__name__, exc.args[0]), + self.generate_tokens) + def check_all(self, expected=None, line_offset=0): """ Run all checks on the input file. @@ -946,7 +988,7 @@ self.blank_lines_before_comment = 0 self.tokens = [] parens = 0 - for token in tokenize.generate_tokens(self.readline_check_physical): + for token in self.generate_tokens(): if options.verbose >= 3: if token[2][0] == token[3][0]: pos = '[%s:%s]' % (token[2][1] or '', token[3][1]) @@ -956,21 +998,22 @@ (token[2][0], pos, tokenize.tok_name[token[0]], token[1])) self.tokens.append(token) token_type, text = token[0:2] - if token_type == tokenize.OP and text in '([{': - parens += 1 - if token_type == tokenize.OP and text in '}])': - parens -= 1 - if token_type == tokenize.NEWLINE and not parens: + if token_type == tokenize.OP: + if text in '([{': + parens += 1 + elif text in '}])': + parens -= 1 + elif token_type == tokenize.NEWLINE and not parens: self.check_logical() self.blank_lines = 0 self.blank_lines_before_comment = 0 self.tokens = [] - if token_type == tokenize.NL and not parens: + elif token_type == tokenize.NL and not parens: if len(self.tokens) <= 1: # The physical line contains only this token. self.blank_lines += 1 self.tokens = [] - if token_type == tokenize.COMMENT: + elif token_type == tokenize.COMMENT: source_line = token[4] token_start = token[2][1] if source_line[:token_start].strip() == '': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.0.1/testsuite/E27.py new/pep8-1.1/testsuite/E27.py --- old/pep8-1.0.1/testsuite/E27.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pep8-1.1/testsuite/E27.py 2012-05-23 21:07:52.000000000 +0200 @@ -0,0 +1,14 @@ +#: Okay +True and False +#: E271 +True and False +#: E272 +True and False +#: E273 +True and False +#: E274 +True and False +#: E272 +this and False +#: E274 +this and False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.0.1/testsuite/E90.py new/pep8-1.1/testsuite/E90.py --- old/pep8-1.0.1/testsuite/E90.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pep8-1.1/testsuite/E90.py 2012-05-23 21:07:52.000000000 +0200 @@ -0,0 +1,10 @@ +#: E901 +} +#: E901 += [x +#: E901 E101 W191 +while True: + try: + pass + except: + print 'Whoops' -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
