Hello community, here is the log from the commit of package python-distutils-extra for openSUSE:Factory checked in at 2012-09-21 14:55:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-distutils-extra (Old) and /work/SRC/openSUSE:Factory/.python-distutils-extra.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-distutils-extra", Maintainer is "cth...@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/python-distutils-extra/python-distutils-extra.changes 2012-03-20 11:32:09.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-distutils-extra.new/python-distutils-extra.changes 2012-09-21 14:55:58.000000000 +0200 @@ -1,0 +2,15 @@ +Wed Sep 12 03:20:46 UTC 2012 - os-...@jacraig.com + +- Update to version 2.36: + * Use python 2.6 friendly sys.version_info test. + * Do not call decode() with an "errors" keyword, as this does not + yet work with Python 2.6. +- No changelog provided for 2.35. +- Changes from 2.34: + * Fix *.ui detection to be robust for non-ASCII files. + * Fix a regression with python2 if files have some utf-8 directives. +- Changes from 2.33: + * Fix crash when encountering binary files with Python 3. + * Fix crash when encountering an UTF-8 Python source code file. + +------------------------------------------------------------------- Old: ---- python-distutils-extra-2.32.tar.gz New: ---- python-distutils-extra-2.36.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-distutils-extra.spec ++++++ --- /var/tmp/diff_new_pack.Y9s1pD/_old 2012-09-21 14:55:59.000000000 +0200 +++ /var/tmp/diff_new_pack.Y9s1pD/_new 2012-09-21 14:55:59.000000000 +0200 @@ -17,7 +17,7 @@ Name: python-distutils-extra -Version: 2.32 +Version: 2.36 Release: 0 Summary: Distutils/Setuptools Adapter License: GPL-2.0 ++++++ python-distutils-extra-2.32.tar.gz -> python-distutils-extra-2.36.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-distutils-extra-2.32/DistUtilsExtra/__init__.py new/python-distutils-extra-2.36/DistUtilsExtra/__init__.py --- old/python-distutils-extra-2.32/DistUtilsExtra/__init__.py 2012-03-02 17:46:22.000000000 +0100 +++ new/python-distutils-extra-2.36/DistUtilsExtra/__init__.py 2012-08-15 11:12:23.000000000 +0200 @@ -1 +1 @@ -__version__ = '2.32' +__version__ = '2.36' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-distutils-extra-2.32/DistUtilsExtra/auto.py new/python-distutils-extra-2.36/DistUtilsExtra/auto.py --- old/python-distutils-extra-2.32/DistUtilsExtra/auto.py 2012-03-02 17:45:10.000000000 +0100 +++ new/python-distutils-extra-2.36/DistUtilsExtra/auto.py 2012-08-15 11:14:16.000000000 +0200 @@ -39,7 +39,7 @@ # Author: Martin Pitt <martin.p...@ubuntu.com> import os, os.path, fnmatch, stat, sys, subprocess -import ast +import ast, locale import distutils.core from functools import reduce @@ -101,8 +101,15 @@ if src: print('WARNING: the following files are not recognized by DistUtilsExtra.auto:') + enc = locale.getpreferredencoding() for f in sorted(src): - print (' ' + f) + # ensure that we can always print the file name + if(sys.version_info[0] < 3): + # hack to make this work with Python 2 + f_loc = f.decode('ascii', 'ignore') + else: + f_loc = f.encode(enc, errors='replace').decode(enc, errors='replace') + print (' ' + f_loc) # # parts of setup() @@ -295,11 +302,11 @@ ui = [] for f in src_fileglob(src, '*.ui'): - fd = open(f) + fd = open(f, 'rb') firstlines = fd.readline() - firstlines += '\n' + fd.readline() + firstlines += b'\n' + fd.readline() fd.close() - if '<interface' in firstlines or '<ui version=' in firstlines: + if b'<interface' in firstlines or b'<ui version=' in firstlines: src_mark(src, f) ui.append(f) if ui: @@ -377,7 +384,14 @@ cur_module = None try: - tree = ast.parse(open(file).read(), file) + with open(file, 'rb') as f: + # send binary blob for python2, otherwise sending an unicode object with + # "encoding" directive makes ast triggering an exception in python2 + if(sys.version_info[0] < 3): + file_content = f.read() + else: + file_content = f.read().decode('UTF-8') + tree = ast.parse(file_content, file) for node in ast.walk(tree): if isinstance(node, ast.Import): @@ -439,8 +453,11 @@ continue ext = os.path.splitext(s)[1] if ext == '': - f = open(s) - line = f.readline() + try: + with open(s) as f: + line = f.readline() + except (UnicodeDecodeError, IOError): + continue if not line.startswith('#!') or 'python' not in line: continue elif ext != '.py': @@ -600,8 +617,8 @@ files.update(src_fileglob(src_all, '*.policy.in')) for f in src_fileglob(src_all, '*.ui'): - contents = open(f).read() - if ('<interface>\n' in contents or '<interface ' in contents) and 'class="Gtk' in contents: + contents = open(f, 'rb').read() + if (b'<interface>\n' in contents or b'<interface ' in contents) and b'class="Gtk' in contents: files.add('[type: gettext/glade]' + f) # find extensionless executable scripts which are Python files, and @@ -611,8 +628,8 @@ f_py = f + '.py' if os.access(f, os.X_OK) and os.path.splitext(f)[1] == '' and \ not os.path.exists(f_py): - line = open(f).readline() - if line.startswith('#!') and 'python' in line: + line = open(f, 'rb').readline() + if line.startswith(b'#!') and b'python' in line: os.symlink(os.path.basename(f), f_py) files.add(f_py) exe_symlinks.append(f_py) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-distutils-extra-2.32/PKG-INFO new/python-distutils-extra-2.36/PKG-INFO --- old/python-distutils-extra-2.32/PKG-INFO 2012-03-02 17:50:39.000000000 +0100 +++ new/python-distutils-extra-2.36/PKG-INFO 2012-08-15 11:20:06.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: python-distutils-extra -Version: 2.32 +Version: 2.36 Summary: Add support for i18n, documentation and icons to distutils Home-page: UNKNOWN Author: Sebastian Heinlein, Martin Pitt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-distutils-extra-2.32/python_distutils_extra.egg-info/PKG-INFO new/python-distutils-extra-2.36/python_distutils_extra.egg-info/PKG-INFO --- old/python-distutils-extra-2.32/python_distutils_extra.egg-info/PKG-INFO 2012-03-02 17:50:39.000000000 +0100 +++ new/python-distutils-extra-2.36/python_distutils_extra.egg-info/PKG-INFO 2012-08-15 11:20:06.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: python-distutils-extra -Version: 2.32 +Version: 2.36 Summary: Add support for i18n, documentation and icons to distutils Home-page: UNKNOWN Author: Sebastian Heinlein, Martin Pitt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-distutils-extra-2.32/test/auto.py new/python-distutils-extra-2.36/test/auto.py --- old/python-distutils-extra-2.32/test/auto.py 2012-03-02 17:45:10.000000000 +0100 +++ new/python-distutils-extra-2.36/test/auto.py 2012-07-18 15:16:37.000000000 +0200 @@ -85,8 +85,9 @@ def test_modules(self): '''Python modules''' - self._mksrc('yesme.py') - self._mksrc('stuff/notme.py') + self._mksrc('yesme.py', b'x ="a\xc3\xa4b\xe2\x99\xa5"'.decode('UTF-8')) + self._mksrc('stuff/notme.py', b'x ="a\xc3\xa4b\xe2\x99\xa5"'.decode('UTF-8')) + self._mksrc('stuff/withencoding.py', b'# -*- Mode: Python; coding: utf-8; -*- \nfoo = 1'.decode('UTF-8')) (o, e, s) = self.do_install() self.assertEqual(e, '') @@ -351,7 +352,7 @@ (o, e, s) = self.do_install() self.assertEqual(e, '') self.assertEqual(s, 0) - self.assertFalse('following files are not recognized' in o) + self.assertFalse('following files are not recognized' in o, o) f = self.installed_files() self.assertTrue('/usr/share/foo/stuff' in f) @@ -372,13 +373,14 @@ # these should get autoinstalled self._mksrc('bin/yell', '#!/bin/sh', True) self._mksrc('bin/shout', '#!/bin/sh', True) - self._mksrc('bin/foo', '#!/bin/sh', True) + self._mksrc('bin/foo', b'#!/usr/bin/python\n# \xc2\xa9 copyright'.decode('UTF-8'), True) os.symlink('shout', os.path.join(self.src, 'bin', 'shoutlink')) # these shouldn't self._mksrc('daemon/food', '#!/bin/sh', True) # not in bin/ self._mksrc('foob', '#!/bin/sh', True) # not named like project - self._mksrc('bin/whisper', '#!/bin/sh') # not executable + # not executable + self._mksrc('bin/whisper', b'#!/usr/bin/python\n# \xc2\xa9 copyright'.decode('UTF-8')) (o, e, s) = self.do_install() self.assertEqual(e, '') @@ -566,14 +568,14 @@ def test_ui(self): '''GtkBuilder/Qt *.ui''' - self._mksrc('gtk/test.ui', '''<?xml version="1.0"?> + self._mksrc('gtk/test.ui', b'''<?xml version="1.0"?> <interface> <requires lib="gtk+" version="2.16"/> <object class="GtkWindow" id="window1"> - <property name="title" translatable="yes">yes11</property> + <property name="title" translatable="yes">my\xe2\x99\xa5</property> <child><placeholder/></child> </object> -</interface>''') +</interface>'''.decode('UTF-8')) self._mksrc('gtk/settings.ui', '''<?xml version="1.0"?> <interface domain="foobar"> @@ -799,6 +801,40 @@ self.assertTrue('/usr/share/gnome/help/foo/de/legal.page' in f) self.assertTrue('/usr/share/gnome/help/foo/de/figures/mainscreen.png' in f) + def test_binary_files(self): + '''Binary files are ignored''' + + with open(os.path.join(self.src, 'binary_trap'), 'wb') as f: + f.write(b'\x00\x01abc\xFF\xFE') + (o, e, s) = self.do_install() + self.assertEqual(e, '') + self.assertEqual(s, 0) + self.assertTrue('following files are not recognized' in o, o) + self.assertTrue('\n binary_trap\n' in o) + + f = self.installed_files() + self.assertEqual(len(f), 1, f) + self.assertTrue('egg-info' in f[0]) + + def test_utf8_filenames(self): + '''UTF-8 file names''' + + bin_fname = b'a\xc3\xa4b.bin'.decode('UTF-8') + with open(os.path.join(self.src, bin_fname).encode('UTF-8'), 'wb') as f: + f.write(b'\x00\x01abc\xFF\xFE') + + (o, e, s) = self.do_install() + self.assertEqual(e, '') + self.assertEqual(s, 0) + + f = self.installed_files() + self.assertEqual(len(f), 1, f) + self.assertTrue('egg-info' in f[0]) + + self.assertTrue('following files are not recognized' in o) + # this might not be the correct file name when the locale is e. g. C + self.assertTrue('b.bin\n' in o, o) + # # helper methods # @@ -857,13 +893,12 @@ dir = os.path.dirname(path) if not os.path.isdir(dir): os.makedirs(dir) - f = open(path, 'w') - if content is None: - # default content, to spot with diff - f.write('dummy') - else: - f.write(content + '\n') - f.close() + with open(path, 'wb') as f: + if content is None: + # default content, to spot with diff + f.write(b'dummy') + else: + f.write((content + '\n').encode('UTF-8')) if executable: os.chmod(path, 0o755) -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org