Merge lp:~barry/ubuntu/natty/python-distutils-extra/670188-ftbfs into lp:ubuntu/natty/python-distutils-extra
- Natty (11.04)
- 670188-ftbfs
- Merge into natty
Proposed by
Barry Warsaw
Status: | Merged |
---|---|
Merge reported by: | Barry Warsaw |
Merged at revision: | not available |
Proposed branch: | lp:~barry/ubuntu/natty/python-distutils-extra/670188-ftbfs |
Merge into: | lp:ubuntu/natty/python-distutils-extra |
Diff against target: |
1183 lines (+71/-1041) 10 files modified
.bzrignore (+1/-0) .pc/.version (+0/-1) .pc/applied-patches (+0/-1) .pc/debian-changes-2.22-2/DistUtilsExtra/command/check.py (+0/-105) .pc/debian-changes-2.22-2/test/auto.py (+0/-930) DistUtilsExtra/command/check.py (+13/-0) debian/changelog (+7/-0) debian/patches/fix-pythonpath (+49/-0) debian/patches/series (+1/-0) test/auto.py (+0/-4) |
To merge this branch: | bzr merge lp:~barry/ubuntu/natty/python-distutils-extra/670188-ftbfs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pitt | Needs Fixing | ||
Ubuntu branches | Pending | ||
Review via email: mp+39993@code.launchpad.net |
Commit message
Description of the change
Handles the case that $PYTHONPATH is in the user's environment. Probably not important for the buildd's but it makes sbuilds less sensitive to environmental differences. This branch also cleans up a few pyflakes warnings.
With this branch, I can build the binary package in my sbuilds for natty.
To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote : | # |
Hi Martin,
The merge only looks crazy because it removes the .pc directory from version control. IIUC, that quilt artifact should not be in bzr, but you're probably right that it was too much distraction from the meat of the change.
I'll redo the patch against lp:python-distutils-extra and submit a merge proposal against that.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file '.bzrignore' |
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 |
3 | +++ .bzrignore 2010-11-03 17:39:44 +0000 |
4 | @@ -0,0 +1,1 @@ |
5 | +.pc |
6 | |
7 | === removed directory '.pc' |
8 | === removed file '.pc/.version' |
9 | --- .pc/.version 2010-09-23 16:00:58 +0000 |
10 | +++ .pc/.version 1970-01-01 00:00:00 +0000 |
11 | @@ -1,1 +0,0 @@ |
12 | -2 |
13 | |
14 | === removed file '.pc/applied-patches' |
15 | --- .pc/applied-patches 2010-09-23 16:00:58 +0000 |
16 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 |
17 | @@ -1,1 +0,0 @@ |
18 | -debian-changes-2.22-2 |
19 | |
20 | === removed directory '.pc/debian-changes-2.22-2' |
21 | === removed directory '.pc/debian-changes-2.22-2/DistUtilsExtra' |
22 | === removed directory '.pc/debian-changes-2.22-2/DistUtilsExtra/command' |
23 | === removed file '.pc/debian-changes-2.22-2/DistUtilsExtra/command/check.py' |
24 | --- .pc/debian-changes-2.22-2/DistUtilsExtra/command/check.py 2010-09-23 16:00:58 +0000 |
25 | +++ .pc/debian-changes-2.22-2/DistUtilsExtra/command/check.py 1970-01-01 00:00:00 +0000 |
26 | @@ -1,105 +0,0 @@ |
27 | -# DistUtilsExtra.command.check - check command for DistUtilsExtra |
28 | -# |
29 | -# Author: Rodney Dawes <rodney.dawes@canonical.com> |
30 | -# |
31 | -# Copyright 2009 Canonical Ltd. |
32 | -# |
33 | -# This program is free software: you can redistribute it and/or modify it |
34 | -# under the terms of the GNU General Public License version 3, as published |
35 | -# by the Free Software Foundation. |
36 | -# |
37 | -# This program is distributed in the hope that it will be useful, but |
38 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
39 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
40 | -# PURPOSE. See the GNU General Public License for more details. |
41 | -# |
42 | -# You should have received a copy of the GNU General Public License along |
43 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
44 | - |
45 | -"""DistUtilsExtra.command.check |
46 | - |
47 | -Implements the DistUtilsExtra 'check' command. |
48 | -""" |
49 | - |
50 | -import os |
51 | -import subprocess |
52 | - |
53 | -from distutils.core import Command |
54 | - |
55 | - |
56 | -class check (Command): |
57 | - """Command to run lint and tests on a module.""" |
58 | - |
59 | - description = "integrate pylint checks" |
60 | - |
61 | - user_options = [("config-file=", None, |
62 | - "pylint config file to use"), |
63 | - ("exclude-files=", None, |
64 | - "list of files to exclude from lint checks"), |
65 | - ("lint-files=", None, |
66 | - "list of modules or packages to run lint checks on") |
67 | - ] |
68 | - |
69 | - def initialize_options (self): |
70 | - self.config_file = None |
71 | - self.exclude_files = None |
72 | - self.lint_files = None |
73 | - |
74 | - def finalize_options (self): |
75 | - if self.config_file is None: |
76 | - self.config_file = "" |
77 | - if self.exclude_files is None: |
78 | - self.exclude_files = "[]" |
79 | - if self.lint_files is None: |
80 | - self.lint_files = "[" + self.__find_files() + "]" |
81 | - |
82 | - def run (self): |
83 | - pylint_args = ["--output-format=parseable", |
84 | - "--include-ids=yes"] |
85 | - |
86 | - if self.config_file: |
87 | - pylint_args.append("--rcfile=" + self.config_file) |
88 | - |
89 | - for file in eval(self.lint_files): |
90 | - pylint_args.append(file) |
91 | - |
92 | - p = subprocess.Popen(["pylint"] + pylint_args, |
93 | - bufsize=4096, stdout=subprocess.PIPE) |
94 | - notices = p.stdout |
95 | - |
96 | - output = "".join(notices.readlines()) |
97 | - if output != "": |
98 | - print "== Pylint notices ==" |
99 | - print self.__group_lines_by_file(output) |
100 | - |
101 | - def __group_lines_by_file(self, input): |
102 | - """Format file:line:message output as lines grouped by file.""" |
103 | - outputs = [] |
104 | - filename = "" |
105 | - excludes = eval(self.exclude_files) |
106 | - for line in input.splitlines(): |
107 | - current = line.split(":", 3) |
108 | - if line.startswith(" "): |
109 | - outputs.append(" " + current[0] + "") |
110 | - elif line.startswith("build/") or current[0] in excludes or \ |
111 | - len(current) < 3: |
112 | - pass |
113 | - elif filename == current[0]: |
114 | - outputs.append(" " + current[1] + ": " + current[2]) |
115 | - elif filename != current[0]: |
116 | - filename = current[0] |
117 | - outputs.append("") |
118 | - outputs.append(filename + ":") |
119 | - outputs.append(" " + current[1] + ": " + current[2]) |
120 | - |
121 | - return "\n".join(outputs) |
122 | - |
123 | - def __find_files(self): |
124 | - """Find all Python files under the current tree.""" |
125 | - pyfiles = [] |
126 | - for root, dirs, files in os.walk(os.getcwd(), topdown=False): |
127 | - for file in files: |
128 | - if file.endswith(".py"): |
129 | - pyfiles.append("'" + os.path.join(root, file) + "'") |
130 | - pyfiles.sort() |
131 | - return ",".join(pyfiles) |
132 | |
133 | === removed directory '.pc/debian-changes-2.22-2/test' |
134 | === removed file '.pc/debian-changes-2.22-2/test/auto.py' |
135 | --- .pc/debian-changes-2.22-2/test/auto.py 2010-09-23 16:00:58 +0000 |
136 | +++ .pc/debian-changes-2.22-2/test/auto.py 1970-01-01 00:00:00 +0000 |
137 | @@ -1,930 +0,0 @@ |
138 | -#!/usr/bin/python |
139 | - |
140 | -# test DistUtilsExtra.auto |
141 | - |
142 | -import sys, unittest, shutil, tempfile, os, os.path, subprocess, re |
143 | - |
144 | -class T(unittest.TestCase): |
145 | - def setUp(self): |
146 | - self.src = tempfile.mkdtemp() |
147 | - |
148 | - self._mksrc('setup.py', ''' |
149 | -from DistUtilsExtra.auto import setup |
150 | - |
151 | -setup( |
152 | - name='foo', |
153 | - version='0.1', |
154 | - description='Test suite package', |
155 | - url='https://foo.example.com', |
156 | - license='GPL v2 or later', |
157 | - author='Martin Pitt', |
158 | - author_email='martin.pitt@example.com', |
159 | -) |
160 | -''') |
161 | - self.snapshot = None |
162 | - self.install_tree = None |
163 | - |
164 | - def tearDown(self): |
165 | - try: |
166 | - # check that setup.py clean removes everything |
167 | - (o, e, s) = self.setup_py(['clean', '-a']) |
168 | - self.assertEqual(s, 0) |
169 | - cruft = self.diff_snapshot() |
170 | - self.assertEqual(cruft, '', 'no cruft after cleaning:\n' + cruft) |
171 | - finally: |
172 | - shutil.rmtree(self.src) |
173 | - if self.snapshot: |
174 | - shutil.rmtree(self.snapshot) |
175 | - if self.install_tree: |
176 | - shutil.rmtree(self.install_tree) |
177 | - self.src = None |
178 | - self.snapshot = None |
179 | - self.install_tree = None |
180 | - |
181 | - # |
182 | - # actual tests come here |
183 | - # |
184 | - |
185 | - def test_empty(self): |
186 | - '''empty source tree (just setup.py)''' |
187 | - |
188 | - (o, e, s) = self.do_install() |
189 | - self.assertEqual(e, '') |
190 | - self.assertEqual(s, 0) |
191 | - self.failIf('following files are not recognized' in o) |
192 | - |
193 | - f = self.installed_files() |
194 | - # just installs the .egg_info |
195 | - self.assertEqual(len(f), 1) |
196 | - self.assert_(f[0].endswith('.egg-info')) |
197 | - |
198 | - def test_vcs(self): |
199 | - '''Ignores revision control files''' |
200 | - |
201 | - self._mksrc('.shelf/1') |
202 | - self._mksrc('.bzr/revs') |
203 | - self._mksrc('.git/config') |
204 | - self._mksrc('.svn/revs') |
205 | - |
206 | - (o, e, s) = self.do_install() |
207 | - self.assertEqual(e, '') |
208 | - self.assertEqual(s, 0) |
209 | - self.failIf('following files are not recognized' in o) |
210 | - |
211 | - f = self.installed_files() |
212 | - # just installs the .egg_info |
213 | - self.assertEqual(len(f), 1) |
214 | - self.assert_(f[0].endswith('.egg-info')) |
215 | - |
216 | - def test_modules(self): |
217 | - '''Python modules''' |
218 | - |
219 | - self._mksrc('yesme.py') |
220 | - self._mksrc('stuff/notme.py') |
221 | - |
222 | - (o, e, s) = self.do_install() |
223 | - self.assertEqual(e, '') |
224 | - self.assertEqual(s, 0) |
225 | - self.assert_('following files are not recognized' in o) |
226 | - self.assert_('\n stuff/notme.py\n' in o) |
227 | - |
228 | - f = '\n'.join(self.installed_files()) |
229 | - self.assert_('-packages/yesme.py' in f) |
230 | - self.failIf('notme' in f) |
231 | - |
232 | - def test_packages(self): |
233 | - '''Python packages''' |
234 | - |
235 | - self._mksrc('foopkg/__init__.py', '') |
236 | - self._mksrc('foopkg/bar.py') |
237 | - self._mksrc('foopkg/baz.py') |
238 | - self._mksrc('noinit/notme.py') |
239 | - |
240 | - (o, e, s) = self.do_install() |
241 | - self.assertEqual(e, '') |
242 | - self.assertEqual(s, 0) |
243 | - self.assert_('following files are not recognized' in o) |
244 | - self.assert_('\n noinit/notme.py\n' in o) |
245 | - |
246 | - f = '\n'.join(self.installed_files()) |
247 | - self.assert_('foopkg/__init__.py' in f) |
248 | - self.assert_('foopkg/bar.py' in f) |
249 | - self.failIf('noinit' in f) |
250 | - |
251 | - def test_dbus(self): |
252 | - '''D-BUS configuration and service files''' |
253 | - |
254 | - # D-BUS ACL configuration file |
255 | - self._mksrc('daemon/com.example.foo.conf', '''<!DOCTYPE busconfig PUBLIC |
256 | - "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" |
257 | - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> |
258 | -<busconfig> |
259 | -</busconfig>''') |
260 | - |
261 | - # non-D-BUS configuration file |
262 | - self._mksrc('daemon/defaults.conf', 'start = True\nlog = syslog') |
263 | - |
264 | - # D-BUS system service |
265 | - self._mksrc('daemon/com.example.foo.service', '''[D-BUS Service] |
266 | -Name=com.example.Foo |
267 | -Exec=/usr/lib/foo/foo_daemon |
268 | -User=root''') |
269 | - |
270 | - # D-BUS session service |
271 | - self._mksrc('gui/com.example.foo.gui.service', '''[D-BUS Service] |
272 | -Name=com.example.Foo.GUI |
273 | -Exec=/usr/bin/foo-gtk |
274 | -''') |
275 | - |
276 | - # non-D-BUS .service file |
277 | - self._mksrc('stuff/super.service', 'I am a file') |
278 | - |
279 | - (o, e, s) = self.do_install() |
280 | - self.assertEqual(e, '') |
281 | - self.assertEqual(s, 0) |
282 | - self.assert_('following files are not recognized' in o) |
283 | - self.assert_('\n stuff/super.service\n' in o) |
284 | - |
285 | - f = self.installed_files() |
286 | - self.assertEqual(len(f), 4) # 3 D-BUS files plus .egg-info |
287 | - self.assert_('/etc/dbus-1/system.d/com.example.foo.conf' in f) |
288 | - self.assert_('/usr/share/dbus-1/system-services/com.example.foo.service' in f) |
289 | - self.assert_('/usr/share/dbus-1/services/com.example.foo.gui.service' in f) |
290 | - self.failIf('super.service' in '\n'.join(f)) |
291 | - |
292 | - def test_apport_hook(self): |
293 | - '''Apport hooks''' |
294 | - |
295 | - self._mksrc('apport/foo.py', '''import os, apport |
296 | -def add_info(report): |
297 | - pass |
298 | -''') |
299 | - |
300 | - self._mksrc('apport/source_foo.py', '''import os, apport |
301 | -def add_info(report): |
302 | - pass |
303 | -''') |
304 | - |
305 | - (o, e, s) = self.do_install() |
306 | - self.failIf('following files are not recognized' in o, o) |
307 | - |
308 | - f = self.installed_files() |
309 | - self.assertEqual(len(f), 3, f) # 2 hook files plus .egg-info |
310 | - self.assert_('/usr/share/apport/package-hooks/foo.py' in f, f) |
311 | - self.assert_('/usr/share/apport/package-hooks/source_foo.py' in f, f) |
312 | - |
313 | - def test_po(self): |
314 | - '''gettext *.po files''' |
315 | - |
316 | - self._mkpo() |
317 | - |
318 | - (o, e, s) = self.do_install() |
319 | - self.assertEqual(e, '') |
320 | - self.assertEqual(s, 0) |
321 | - self.failIf('following files are not recognized' in o) |
322 | - f = self.installed_files() |
323 | - self.assert_('/usr/share/locale/de/LC_MESSAGES/foo.mo' in f) |
324 | - self.assert_('/usr/share/locale/fr/LC_MESSAGES/foo.mo' in f) |
325 | - self.failIf('junk' in '\n'.join(f)) |
326 | - |
327 | - msgunfmt = subprocess.Popen(['msgunfmt', |
328 | - os.path.join(self.install_tree, |
329 | - 'usr/share/locale/de/LC_MESSAGES/foo.mo')], |
330 | - stdout=subprocess.PIPE) |
331 | - out = msgunfmt.communicate()[0].decode() |
332 | - self.assertEqual(out, open(os.path.join(self.src, 'po/de.po')).read()) |
333 | - |
334 | - def test_policykit(self): |
335 | - '''*.policy.in PolicyKit files''' |
336 | - |
337 | - self._mksrc('daemon/com.example.foo.policy.in', '''<?xml version="1.0" encoding="UTF-8"?> |
338 | -<!DOCTYPE policyconfig PUBLIC |
339 | - "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" |
340 | - "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd"> |
341 | -<policyconfig> |
342 | - <vendor>Foo project</vendor> |
343 | - <vendor_url>https://foo.example.com</vendor_url> |
344 | - |
345 | - <action id="com.example.foo.greet"> |
346 | - <_description>Good morning</_description> |
347 | - <_message>Hello</_message> |
348 | - <defaults> |
349 | - <allow_active>yes</allow_active> |
350 | - </defaults> |
351 | - </action> |
352 | -</policyconfig>''') |
353 | - |
354 | - self._mkpo() |
355 | - (o, e, s) = self.do_install() |
356 | - self.assertEqual(e, '') |
357 | - self.assertEqual(s, 0) |
358 | - self.failIf('following files are not recognized' in o) |
359 | - |
360 | - f = self.installed_files() |
361 | - self.assert_('/usr/share/PolicyKit/policy/com.example.foo.policy' in f) |
362 | - p = open(os.path.join(self.install_tree, |
363 | - 'usr/share/PolicyKit/policy/com.example.foo.policy')).read() |
364 | - self.assert_('<description>Good morning</description>' in p) |
365 | - self.assert_('<description xml:lang="de">Guten Morgen</description>' in p) |
366 | - self.assert_('<message>Hello</message>' in p) |
367 | - self.assert_('<message xml:lang="de">Hallo</message>' in p) |
368 | - |
369 | - # polkit-1 |
370 | - self._mksrc('foo.py', '''polkit = dbus.Interface(dbus.SystemBus().get_object( |
371 | - 'org.freedesktop.PolicyKit1', |
372 | - '/org/freedesktop/PolicyKit1/Authority', False), |
373 | - 'org.freedesktop.PolicyKit1.Authority') |
374 | -''') |
375 | - self.setup_py(['clean', '-a']) |
376 | - self.snapshot = None |
377 | - (o, e, s) = self.do_install() |
378 | - self.assertEqual(e, '') |
379 | - self.assertEqual(s, 0) |
380 | - self.failIf('following files are not recognized' in o) |
381 | - |
382 | - f = self.installed_files() |
383 | - self.failIf('/usr/share/PolicyKit/policy/com.example.foo.policy' in f) |
384 | - self.assert_('/usr/share/polkit-1/actions/com.example.foo.policy' in f) |
385 | - |
386 | - def test_desktop(self): |
387 | - '''*.desktop.in files''' |
388 | - |
389 | - self._mksrc('gui/foogtk.desktop.in', '''[Desktop Entry] |
390 | -_Name=Hello |
391 | -_Comment=Good morning |
392 | -Exec=/bin/foo''') |
393 | - self._mksrc('gui/autostart/fooapplet.desktop.in', '''[Desktop Entry] |
394 | -_Name=Hello |
395 | -_Comment=Good morning |
396 | -Exec=/usr/bin/fooapplet''') |
397 | - self._mkpo() |
398 | - self._mksrc('data/foosettings.desktop.in', '''[Desktop Entry] |
399 | -_Name=Hello |
400 | -_Comment=Good morning |
401 | -Exec=/bin/foosettings''') |
402 | - |
403 | - (o, e, s) = self.do_install() |
404 | - self.assertEqual(e, '') |
405 | - self.assertEqual(s, 0) |
406 | - self.failIf('following files are not recognized' in o) |
407 | - |
408 | - f = self.installed_files() |
409 | - self.assert_('/usr/share/autostart/fooapplet.desktop' in f) |
410 | - self.assert_('/usr/share/applications/foogtk.desktop' in f) |
411 | - self.assert_('/usr/share/applications/foosettings.desktop' in f) |
412 | - # data/*.desktop.in shouldn't go to data dir |
413 | - self.failIf('/usr/share/foo/' in f) |
414 | - |
415 | - p = open(os.path.join(self.install_tree, |
416 | - 'usr/share/autostart/fooapplet.desktop')).read() |
417 | - self.assert_('\nName=Hello\n' in p) |
418 | - self.assert_('\nName[de]=Hallo\n' in p) |
419 | - self.assert_('\nComment[fr]=Bonjour\n' in p) |
420 | - |
421 | - def test_icons(self): |
422 | - '''data/icons/''' |
423 | - |
424 | - self._mksrc('data/icons/scalable/actions/press.png') |
425 | - self._mksrc('data/icons/48x48/apps/foo.png') |
426 | - action_icon_path = os.path.join(self.src, 'data', 'icons', 'scalable', |
427 | - 'actions') |
428 | - os.symlink(os.path.join(action_icon_path, 'press.png'), |
429 | - os.path.join(action_icon_path, 'crunch.png')) |
430 | - |
431 | - (o, e, s) = self.do_install() |
432 | - self.assertEqual(e, '') |
433 | - self.assertEqual(s, 0) |
434 | - self.failIf('following files are not recognized' in o) |
435 | - |
436 | - f = self.installed_files() |
437 | - self.assert_('/usr/share/icons/hicolor/scalable/actions/press.png' in f) |
438 | - self.assert_('/usr/share/icons/hicolor/scalable/actions/crunch.png' in f) |
439 | - self.assert_('/usr/share/icons/hicolor/48x48/apps/foo.png' in f) |
440 | - self.assert_(os.path.islink(os.path.join(self.install_tree, |
441 | - 'usr/share/icons/hicolor/scalable/actions/crunch.png'))) |
442 | - |
443 | - def test_data(self): |
444 | - '''Auxiliary files in data/''' |
445 | - |
446 | - # have some explicitly covered files, to check that they don't get |
447 | - # installed into prefix/share/foo/ again |
448 | - self._mksrc('setup.py', ''' |
449 | -from DistUtilsExtra.auto import setup |
450 | -from glob import glob |
451 | - |
452 | -setup( |
453 | - name='foo', |
454 | - version='0.1', |
455 | - description='Test suite package', |
456 | - url='https://foo.example.com', |
457 | - license='GPL v2 or later', |
458 | - author='Martin Pitt', |
459 | - author_email='martin.pitt@example.com', |
460 | - |
461 | - data_files = [ |
462 | - ('/lib/udev/rules.d', ['data/40-foo.rules']), |
463 | - ('/etc/foo', glob('data/*.conf')), |
464 | - ] |
465 | -) |
466 | -''') |
467 | - |
468 | - self._mksrc('data/stuff') |
469 | - self._mksrc('data/handlers/red.py', 'import sys\nprint ("RED")') |
470 | - self._mksrc('data/handlers/blue.py', 'import sys\nprint ("BLUE")') |
471 | - self._mksrc('data/40-foo.rules') |
472 | - self._mksrc('data/blob1.conf') |
473 | - self._mksrc('data/blob2.conf') |
474 | - os.symlink('stuff', os.path.join(self.src, 'data', 'stufflink')) |
475 | - |
476 | - (o, e, s) = self.do_install() |
477 | - self.assertEqual(e, '') |
478 | - self.assertEqual(s, 0) |
479 | - self.failIf('following files are not recognized' in o) |
480 | - |
481 | - f = self.installed_files() |
482 | - self.assert_('/usr/share/foo/stuff' in f) |
483 | - self.assert_('/usr/share/foo/stufflink' in f) |
484 | - self.assert_(os.path.islink(os.path.join(self.install_tree, 'usr', |
485 | - 'share', 'foo', 'stufflink'))) |
486 | - self.assert_('/usr/share/foo/handlers/red.py' in f) |
487 | - self.assert_('/usr/share/foo/handlers/blue.py' in f) |
488 | - self.assert_('/lib/udev/rules.d/40-foo.rules' in f) |
489 | - self.assert_('/etc/foo/blob1.conf' in f) |
490 | - self.assert_('/etc/foo/blob2.conf' in f) |
491 | - self.failIf('/usr/share/foo/blob1.conf' in f) |
492 | - self.failIf('/usr/share/foo/40-foo.rules' in f) |
493 | - |
494 | - def test_scripts(self): |
495 | - '''scripts''' |
496 | - |
497 | - # these should get autoinstalled |
498 | - self._mksrc('bin/yell', '#!/bin/sh', True) |
499 | - self._mksrc('bin/shout', '#!/bin/sh', True) |
500 | - self._mksrc('bin/foo', '#!/bin/sh', True) |
501 | - os.symlink('shout', os.path.join(self.src, 'bin', 'shoutlink')) |
502 | - |
503 | - # these shouldn't |
504 | - self._mksrc('daemon/food', '#!/bin/sh', True) # not in bin/ |
505 | - self._mksrc('foob', '#!/bin/sh', True) # not named like project |
506 | - self._mksrc('bin/whisper', '#!/bin/sh') # not executable |
507 | - |
508 | - (o, e, s) = self.do_install() |
509 | - self.assertEqual(e, '') |
510 | - self.assertEqual(s, 0) |
511 | - self.assert_('following files are not recognized' in o) |
512 | - self.assert_('\n foob' in o) |
513 | - self.assert_('\n bin/whisper' in o) |
514 | - self.assert_('\n daemon/food' in o) |
515 | - |
516 | - f = self.installed_files() |
517 | - self.assert_('/usr/bin/yell' in f) |
518 | - self.assert_('/usr/bin/shout' in f) |
519 | - self.assert_('/usr/bin/shoutlink' in f) |
520 | - self.assert_(os.path.islink(os.path.join(self.install_tree, 'usr', |
521 | - 'bin', 'shoutlink'))) |
522 | - self.assert_('/usr/bin/foo' in f) |
523 | - ftext = '\n'.join(f) |
524 | - self.failIf('food' in ftext) |
525 | - self.failIf('foob' in ftext) |
526 | - self.failIf('whisper' in ftext) |
527 | - |
528 | - # verify that they are executable |
529 | - binpath = os.path.join(self.install_tree, 'usr', 'bin') |
530 | - self.assert_(os.access(os.path.join(binpath, 'yell'), os.X_OK)) |
531 | - self.assert_(os.access(os.path.join(binpath, 'shout'), os.X_OK)) |
532 | - self.assert_(os.access(os.path.join(binpath, 'foo'), os.X_OK)) |
533 | - |
534 | - def test_pot_manual(self): |
535 | - '''PO template creation with manual POTFILES.in''' |
536 | - |
537 | - self._mk_i18n_source() |
538 | - self._mksrc('po/foo.pot', '') |
539 | - # only do a subset here |
540 | - self._mksrc('po/POTFILES.in', ''' |
541 | -gtk/main.py |
542 | -gui/foo.desktop.in |
543 | -[type: gettext/glade]gtk/test.ui''') |
544 | - |
545 | - (o, e, s) = self.setup_py(['build']) |
546 | - self.assertEqual(e, '') |
547 | - self.assertEqual(s, 0) |
548 | - # POT file should not be shown as not recognized |
549 | - self.failIf('\n po/foo.pot\n' in o) |
550 | - |
551 | - pot_path = os.path.join(self.src, 'po', 'foo.pot') |
552 | - self.assert_(os.path.exists(pot_path)) |
553 | - pot = open(pot_path).read() |
554 | - |
555 | - self.failIf('msgid "no"' in pot) |
556 | - self.assert_('msgid "yes1"' in pot) |
557 | - self.assert_('msgid "yes2 %s"' in pot) |
558 | - self.failIf('msgid "yes5"' in pot) # we didn't add helpers.py |
559 | - self.assert_('msgid "yes7"' in pot) # we did include the desktop file |
560 | - self.failIf('msgid "yes5"' in pot) # we didn't add helpers.py |
561 | - self.assert_('msgid "yes11"' in pot) # we added one GTKBuilder file |
562 | - self.failIf('msgid "yes12"' in pot) # ... but not the other |
563 | - |
564 | - def test_pot_auto(self): |
565 | - '''PO template creation with automatic POTFILES.in''' |
566 | - |
567 | - self._mk_i18n_source() |
568 | - |
569 | - (o, e, s) = self.setup_py(['build']) |
570 | - self.assertEqual(e, '') |
571 | - self.assertEqual(s, 0) |
572 | - # POT file should not be shown as not recognized |
573 | - self.failIf('\n po/foo.pot\n' in o) |
574 | - |
575 | - pot_path = os.path.join(self.src, 'po', 'foo.pot') |
576 | - self.assert_(os.path.exists(pot_path)) |
577 | - pot = open(pot_path).read() |
578 | - |
579 | - self.failIf('msgid "no"' in pot) |
580 | - for i in range(2, 15): |
581 | - self.assert_('msgid "yes%i' % i in pot or |
582 | - 'msgid ""\n"yes%i' % i in pot, |
583 | - 'yes%i' % i) |
584 | - # above loop would match yes11 to yes1 as well, so test it explicitly |
585 | - self.assert_('msgid "yes1"' in pot) |
586 | - |
587 | - def test_pot_auto_explicit(self): |
588 | - '''PO template creation with automatic POTFILES.in and explicit scripts''' |
589 | - |
590 | - self._mk_i18n_source() |
591 | - |
592 | - # add some additional binaries here which aren't caught by default |
593 | - self._mksrc('cli/client-cli', "#!/usr/bin/python\nprint (_('yes15'))", True) |
594 | - self._mksrc('gtk/client-gtk', '#!/usr/bin/python\nprint (_("yes16"))', True) |
595 | - # this is the most tricky case: intltool doesn't consider them Python |
596 | - # files by default and thus just looks for _(""): |
597 | - self._mksrc('kde/client-kde', "#!/usr/bin/python\nprint (_('yes17'))", True) |
598 | - self._mksrc('po/POTFILES.in.in', 'gtk/client-gtk\nkde/client-kde') |
599 | - self._mksrc('setup.py', ''' |
600 | -from DistUtilsExtra.auto import setup |
601 | - |
602 | -setup( |
603 | - name='foo', |
604 | - version='0.1', |
605 | - data_files=[('share/foo', ['gtk/client-gtk', 'kde/client-kde'])], |
606 | - scripts=['cli/client-cli'], |
607 | -) |
608 | -''') |
609 | - |
610 | - (o, e, s) = self.setup_py(['build']) |
611 | - self.assertEqual(e, '') |
612 | - self.assertEqual(s, 0) |
613 | - # POT file should not be shown as not recognized |
614 | - self.failIf('\n po/foo.pot\n' in o) |
615 | - |
616 | - pot_path = os.path.join(self.src, 'po', 'foo.pot') |
617 | - self.assert_(os.path.exists(pot_path)) |
618 | - pot = open(pot_path).read() |
619 | - |
620 | - self.failIf('msgid "no"' in pot) |
621 | - for i in range(2, 18): |
622 | - self.assert_('msgid "yes%i' % i in pot or |
623 | - 'msgid ""\n"yes%i' % i in pot, |
624 | - 'yes%i' % i) |
625 | - # above loop would match yes11 to yes1 as well, so test it explicitly |
626 | - self.assert_('msgid "yes1"' in pot) |
627 | - |
628 | - def test_standard_files(self): |
629 | - '''Standard files (MANIFEST.in, COPYING, etc.)''' |
630 | - |
631 | - self._mksrc('AUTHORS') |
632 | - self._mksrc('COPYING') |
633 | - self._mksrc('LICENSE') |
634 | - self._mksrc('COPYING.LIB') |
635 | - self._mksrc('README.txt') |
636 | - self._mksrc('MANIFEST.in') |
637 | - self._mksrc('MANIFEST') |
638 | - self._mksrc('NEWS') |
639 | - self._mksrc('TODO') |
640 | - |
641 | - (o, e, s) = self.do_install() |
642 | - self.assertEqual(e, '') |
643 | - self.assertEqual(s, 0) |
644 | - self.failIf('following files are not recognized' in o, o) |
645 | - |
646 | - f = self.installed_files() |
647 | - self.assert_('/usr/share/doc/foo/README.txt' in f) |
648 | - self.assert_('/usr/share/doc/foo/NEWS' in f) |
649 | - ftext = '\n'.join(f) |
650 | - self.failIf('MANIFEST' in ftext) |
651 | - self.failIf('COPYING' in ftext) |
652 | - self.failIf('COPYING' in ftext) |
653 | - self.failIf('AUTHORS' in ftext) |
654 | - self.failIf('TODO' in ftext) |
655 | - |
656 | - # sub-dir READMEs shouldn't be installed by default |
657 | - self.snapshot = None |
658 | - self._mksrc('extra/README') |
659 | - (o, e, s) = self.do_install() |
660 | - self.assertEqual(e, '') |
661 | - self.assertEqual(s, 0) |
662 | - self.assert_('following files are not recognized' in o) |
663 | - self.assert_('\n extra/README\n' in o) |
664 | - |
665 | - def test_sdist(self): |
666 | - '''default MANIFEST''' |
667 | - |
668 | - good = ['AUTHORS', 'README.txt', 'COPYING', 'helpers.py', |
669 | - 'foo/__init__.py', 'foo/bar.py', 'tests/all.py', |
670 | - 'gui/x.desktop.in', 'backend/foo.policy.in', |
671 | - 'daemon/backend.conf', 'x/y', 'po/de.po', 'po/foo.pot', |
672 | - '.quickly', 'data/icons/16x16/apps/foo.png', 'bin/foo', |
673 | - 'backend/food', 'backend/com.example.foo.service', |
674 | - 'gtk/main.glade', 'dist/extra.tar.gz'] |
675 | - bad = ['po/de.mo', '.helpers.py.swp', '.bzr/index', '.svn/index', |
676 | - '.git/index', 'bin/foo~', 'backend/foo.pyc', |
677 | - 'dist/foo-0.1.tar.gz', '.shelf/1', '.bzr/revs', '.git/config'] |
678 | - |
679 | - for f in good + bad: |
680 | - self._mksrc(f) |
681 | - |
682 | - (o, e, s) = self.setup_py(['sdist', '-o']) |
683 | - self.assert_("'MANIFEST.in' does not exist" in e) |
684 | - self.assertEqual(s, 0) |
685 | - |
686 | - manifest = open(os.path.join(self.src, 'MANIFEST')).read().splitlines() |
687 | - |
688 | - for f in good: |
689 | - self.assert_(f in manifest, '%s in manifest' % f) |
690 | - for f in bad: |
691 | - self.failIf(f in manifest, '%s not in manifest' % f) |
692 | - os.unlink(os.path.join(self.src, 'MANIFEST')) |
693 | - |
694 | - def test_gtkbuilder(self): |
695 | - '''GtkBuilder *.ui''' |
696 | - |
697 | - self._mksrc('gtk/test.ui', '''<?xml version="1.0"?> |
698 | -<interface> |
699 | - <requires lib="gtk+" version="2.16"/> |
700 | - <object class="GtkWindow" id="window1"> |
701 | - <property name="title" translatable="yes">yes11</property> |
702 | - <child><placeholder/></child> |
703 | - </object> |
704 | -</interface>''') |
705 | - |
706 | - self._mksrc('gtk/settings.ui', '''<?xml version="1.0"?> |
707 | -<interface domain="foobar"> |
708 | - <requires lib="gtk+" version="2.16"/> |
709 | - <object class="GtkWindow" id="window2"> |
710 | - <property name="title" translatable="yes">yes12</property> |
711 | - <child><placeholder/></child> |
712 | - </object> |
713 | -</interface>''') |
714 | - |
715 | - self._mksrc('someweird.ui') |
716 | - |
717 | - (o, e, s) = self.do_install() |
718 | - self.assertEqual(e, '') |
719 | - self.assertEqual(s, 0) |
720 | - self.assert_('following files are not recognized' in o) |
721 | - self.assert_('\n someweird.ui\n' in o) |
722 | - |
723 | - f = self.installed_files() |
724 | - self.assert_('/usr/share/foo/test.ui' in f) |
725 | - self.assert_('/usr/share/foo/settings.ui' in f) |
726 | - ftext = '\n'.join(f) |
727 | - self.failIf('someweird' in ftext) |
728 | - |
729 | - def test_manpages(self): |
730 | - '''manpages''' |
731 | - |
732 | - self._mksrc('man/foo.1', '.TH foo 1 "Jan 01, 1900" "Joe Developer"') |
733 | - self._mksrc('daemon/food.8', '.TH food 8 "Jan 01, 1900" "Joe Developer"') |
734 | - self._mksrc('cruft/food.1', '') |
735 | - self._mksrc('daemon/notme.s', '.TH food 8 "Jan 01, 1900" "Joe Developer"') |
736 | - |
737 | - (o, e, s) = self.do_install() |
738 | - self.assertEqual(e, '') |
739 | - self.assertEqual(s, 0) |
740 | - self.assert_('following files are not recognized' in o) |
741 | - self.assert_('\n cruft/food.1\n' in o) |
742 | - self.assert_('\n daemon/notme.s\n' in o) |
743 | - |
744 | - f = self.installed_files() |
745 | - self.assert_('/usr/share/man/man1/foo.1' in f) |
746 | - self.assert_('/usr/share/man/man8/food.8' in f) |
747 | - ftext = '\n'.join(f) |
748 | - self.failIf('food.1' in ftext) |
749 | - self.failIf('notme' in ftext) |
750 | - |
751 | - def test_etc(self): |
752 | - '''etc/*''' |
753 | - |
754 | - self._mksrc('etc/cron.daily/foo') |
755 | - self._mksrc('etc/foo.conf') |
756 | - self._mksrc('etc/init.d/foo', executable=True) |
757 | - d = os.path.join(self.src, 'etc', 'cron.weekly') |
758 | - os.mkdir(d) |
759 | - os.symlink(os.path.join('..', 'cron.daily', 'foo'), |
760 | - os.path.join(d, 'foo')) |
761 | - |
762 | - (o, e, s) = self.do_install() |
763 | - self.assertEqual(e, '') |
764 | - self.assertEqual(s, 0) |
765 | - self.failIf('following files are not recognized' in o, o) |
766 | - |
767 | - f = self.installed_files() |
768 | - self.assert_('/etc/cron.daily/foo' in f) |
769 | - self.assert_('/etc/cron.weekly/foo' in f) |
770 | - self.assert_('/etc/init.d/foo' in f) |
771 | - self.assert_('/etc/foo.conf' in f) |
772 | - |
773 | - # verify that init script is executable |
774 | - self.assert_(os.access(os.path.join(self.install_tree, 'etc', 'init.d', |
775 | - 'foo'), os.X_OK)) |
776 | - # verify that symlinks get preserved |
777 | - self.assert_(os.path.islink(os.path.join(self.install_tree, 'etc', |
778 | - 'cron.weekly', 'foo'))) |
779 | - |
780 | - # check that we can install again into the same source tree |
781 | - (o, e, s) = self.setup_py(['install', '--no-compile', '--prefix=/usr', |
782 | - '--root=' + self.install_tree]) |
783 | - self.assertEqual(e, '') |
784 | - self.assertEqual(s, 0) |
785 | - self.failIf('following files are not recognized' in o, o) |
786 | - |
787 | - def test_requires_provides(self): |
788 | - '''automatic requires/provides''' |
789 | - |
790 | - try: |
791 | - __import__('pkg_resources') |
792 | - __import__('httplib2') |
793 | - except ImportError: |
794 | - self.fail('You need to have pkg_resources and httplib2 installed for this test suite to work') |
795 | - |
796 | - self._mksrc('foo/__init__.py', '') |
797 | - self._mksrc('foo/stuff.py', '''import xml.parsers.expat |
798 | -import os, os.path, email.mime, distutils.command.register |
799 | -from email import header as h |
800 | -import httplib2.iri2uri, unknown |
801 | -''') |
802 | - |
803 | - self._mksrc('foo/bar/__init__.py', '') |
804 | - self._mksrc('foo/bar/poke.py', 'def x(): pass') |
805 | - |
806 | - self._mksrc('mymod.py', 'import foo\nfrom foo.bar.poke import x') |
807 | - |
808 | - self._mksrc('bin/foo-cli', '''#!/usr/bin/python |
809 | -import sys |
810 | -import pkg_resources |
811 | -import foo.bar |
812 | -from httplib2 import iri2uri |
813 | - |
814 | -print ('import iamnota.module') |
815 | -''', executable=True) |
816 | - |
817 | - # this shouldn't be treated specially |
818 | - self._mksrc('data/example-code/template.py', 'import example.module') |
819 | - self._mksrc('data/example-code/mymod/__init__.py', '') |
820 | - self._mksrc('data/example-code/mymod/shiny.py', 'import example.othermod') |
821 | - |
822 | - (o, e, s) = self.do_install() |
823 | - self.assertEqual(s, 0) |
824 | - self.assertEqual(e, 'ERROR: Python module unknown not found\n') |
825 | - self.failIf('following files are not recognized' in o) |
826 | - |
827 | - inst = self.installed_files() |
828 | - self.assert_('/usr/share/foo/example-code/template.py' in inst) |
829 | - self.assert_('/usr/share/foo/example-code/mymod/shiny.py' in inst) |
830 | - for f in inst: |
831 | - if 'template.py' in f or 'shiny' in f: |
832 | - self.failIf('packages' in f) |
833 | - |
834 | - # parse .egg-info |
835 | - (o, e, s) = self.setup_py(['install_egg_info', '-d', self.install_tree]) |
836 | - self.assertEqual(e, 'ERROR: Python module unknown not found\n') |
837 | - egg = open(os.path.join(self.install_tree, |
838 | - 'foo-0.1.egg-info')).read().splitlines() |
839 | - self.assert_('Name: foo' in egg) |
840 | - |
841 | - # check provides |
842 | - prov = [prop.split(' ', 1)[1] for prop in egg if prop.startswith('Provides: ')] |
843 | - self.assertEqual(set(prov), set(['foo', 'mymod'])) |
844 | - |
845 | - # check requires |
846 | - req = [prop.split(' ', 1)[1] for prop in egg if prop.startswith('Requires: ')] |
847 | - self.assertEqual(set(req), set(['DistUtilsExtra.auto', 'httplib2', 'pkg_resources'])) |
848 | - |
849 | - def test_help(self): |
850 | - '''Docbook XML help''' |
851 | - |
852 | - self._mksrc('help/C/myprogram-C.omf') |
853 | - self._mksrc('help/C/myprogram.xml') |
854 | - self._mksrc('help/C/legal.xml') |
855 | - self._mksrc('help/C/figures/mainscreen.png') |
856 | - self._mksrc('help/de/myprogram-de.omf') |
857 | - self._mksrc('help/de/myprogram.xml') |
858 | - self._mksrc('help/de/legal.xml') |
859 | - self._mksrc('help/de/figures/mainscreen.png') |
860 | - |
861 | - self._mksrc('help/weird.xml') |
862 | - self._mksrc('help/notme.png') |
863 | - |
864 | - (o, e, s) = self.do_install() |
865 | - self.assertEqual(e, '') |
866 | - self.assertEqual(s, 0) |
867 | - self.assert_('following files are not recognized' in o) |
868 | - self.assert_('\n help/weird.xml\n' in o) |
869 | - self.assert_('\n help/notme.png\n' in o) |
870 | - |
871 | - f = self.installed_files() |
872 | - self.assert_('/usr/share/omf/foo/myprogram-C.omf' in f) |
873 | - self.assert_('/usr/share/omf/foo/myprogram-de.omf' in f) |
874 | - self.assert_('/usr/share/gnome/help/foo/C/myprogram.xml' in f) |
875 | - self.assert_('/usr/share/gnome/help/foo/C/legal.xml' in f) |
876 | - self.assert_('/usr/share/gnome/help/foo/C/figures/mainscreen.png' in f) |
877 | - self.assert_('/usr/share/gnome/help/foo/de/myprogram.xml' in f) |
878 | - self.assert_('/usr/share/gnome/help/foo/de/legal.xml' in f) |
879 | - self.assert_('/usr/share/gnome/help/foo/de/figures/mainscreen.png' in f) |
880 | - |
881 | - # |
882 | - # helper methods |
883 | - # |
884 | - |
885 | - def setup_py(self, args): |
886 | - '''Run setup.py with given arguments. |
887 | - |
888 | - For convenience, this snapshots the tree if no snapshot exists yet. |
889 | - |
890 | - Return (out, err, exitcode) triple. |
891 | - ''' |
892 | - if not self.snapshot: |
893 | - self.do_snapshot() |
894 | - |
895 | - env = os.environ |
896 | - oldcwd = os.getcwd() |
897 | - if 'PYTHONPATH' not in env: |
898 | - env['PYTHONPATH'] = oldcwd |
899 | - os.chdir(self.src) |
900 | - s = subprocess.Popen(['/proc/self/exe', 'setup.py'] + args, env=env, |
901 | - stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
902 | - (out, err) = s.communicate() |
903 | - out = out.decode() |
904 | - err = err.decode() |
905 | - os.chdir(oldcwd) |
906 | - |
907 | - # python3 distutils bug workaround, filter out bogus errors |
908 | - bogus_re = re.compile('^file .* \(for module .*\) not found$') |
909 | - err = '\n'.join([l for l in err.splitlines() if not bogus_re.match(l)]) |
910 | - if err: |
911 | - err += '\n' |
912 | - |
913 | - return (out, err, s.returncode) |
914 | - |
915 | - def do_install(self): |
916 | - '''Run setup.py install into temporary tree. |
917 | - |
918 | - Return (out, err, exitcode) triple. |
919 | - ''' |
920 | - self.install_tree = tempfile.mkdtemp() |
921 | - |
922 | - return self.setup_py(['install', '--no-compile', '--prefix=/usr', |
923 | - '--root=' + self.install_tree]) |
924 | - |
925 | - def installed_files(self): |
926 | - '''Return list of file paths in install tree.''' |
927 | - |
928 | - result = [] |
929 | - for root, _, files in os.walk(self.install_tree): |
930 | - assert root.startswith(self.install_tree) |
931 | - r = root[len(self.install_tree):] |
932 | - for f in files: |
933 | - result.append(os.path.join(r, f)) |
934 | - return result |
935 | - |
936 | - def _mksrc(self, path, content=None, executable=False): |
937 | - '''Create a file in the test source tree.''' |
938 | - |
939 | - path = os.path.join(self.src, path) |
940 | - dir = os.path.dirname(path) |
941 | - if not os.path.isdir(dir): |
942 | - os.makedirs(dir) |
943 | - f = open(path, 'w') |
944 | - if content is None: |
945 | - # default content, to spot with diff |
946 | - f.write('dummy') |
947 | - else: |
948 | - f.write(content + '\n') |
949 | - f.close() |
950 | - |
951 | - if executable: |
952 | - os.chmod(path, 0o755) |
953 | - |
954 | - def do_snapshot(self): |
955 | - '''Snapshot source tree. |
956 | - |
957 | - This should be called after a test set up all source files. |
958 | - ''' |
959 | - assert self.snapshot is None, 'snapshot already taken' |
960 | - |
961 | - self.snapshot = tempfile.mkdtemp() |
962 | - shutil.copytree(self.src, os.path.join(self.snapshot, 's')) |
963 | - |
964 | - def diff_snapshot(self): |
965 | - '''Compare source tree to snapshot. |
966 | - |
967 | - Return diff -Nur output. |
968 | - ''' |
969 | - assert self.snapshot, 'no snapshot taken' |
970 | - diff = subprocess.Popen(['diff', '-x', 'foo.pot', '-Nur', os.path.join(self.snapshot, 's'), |
971 | - self.src], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
972 | - (out, err) = diff.communicate() |
973 | - out = out.decode() |
974 | - self.assertEqual(err, b'', 'diff error messages') |
975 | - return out |
976 | - |
977 | - def _mkpo(self): |
978 | - '''Create some example po files.''' |
979 | - |
980 | - self._mksrc('po/POTFILES.in', '') |
981 | - self._mksrc('po/de.po', '''msgid "" |
982 | -msgstr "Content-Type: text/plain; charset=UTF-8\\n" |
983 | - |
984 | -msgid "Good morning" |
985 | -msgstr "Guten Morgen" |
986 | - |
987 | -msgid "Hello" |
988 | -msgstr "Hallo"''') |
989 | - self._mksrc('po/fr.po', '''msgid "" |
990 | -msgstr "Content-Type: text/plain; charset=UTF-8\\n" |
991 | - |
992 | -msgid "Good morning" |
993 | -msgstr "Bonjour"''') |
994 | - |
995 | - def _mk_i18n_source(self): |
996 | - '''Create some example source files with gettext calls''' |
997 | - |
998 | - self._mksrc('gtk/main.py', '''print (_("yes1")) |
999 | -print ("no1") |
1000 | -print (__("no2")) |
1001 | -x = _('yes2 %s') % y |
1002 | - |
1003 | -def f(): |
1004 | - print (_("yes3")) |
1005 | - return _('yes6')''') |
1006 | - |
1007 | - self._mksrc('helpers.py', ''' |
1008 | -print (f(_("yes4"))) |
1009 | -print (_(\'\'\'yes5 |
1010 | -even more |
1011 | -lines\'\'\')) |
1012 | -print (_("""yes6 |
1013 | -more lines""")) |
1014 | -print (\'\'\'no3 |
1015 | -boo\'\'\') |
1016 | -print ("""no4 |
1017 | -more""")''') |
1018 | - |
1019 | - self._mksrc('gui/foo.desktop.in', '''[Desktop Entry] |
1020 | -_Name=yes7 |
1021 | -_Comment=yes8 |
1022 | -Icon=no5 |
1023 | -Exec=/usr/bin/foo''') |
1024 | - |
1025 | - self._mksrc('daemon/com.example.foo.policy.in', '''<?xml version="1.0" encoding="UTF-8"?> |
1026 | -<!DOCTYPE policyconfig PUBLIC |
1027 | - "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" |
1028 | - "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd"> |
1029 | -<policyconfig> |
1030 | - <action id="com.example.foo.greet"> |
1031 | - <_description>yes9</_description> |
1032 | - <_message>yes10</_message> |
1033 | - <defaults> |
1034 | - <allow_active>no6</allow_active> |
1035 | - </defaults> |
1036 | - </action> |
1037 | -</policyconfig>''') |
1038 | - |
1039 | - self._mksrc('gtk/test.ui', '''<?xml version="1.0"?> |
1040 | -<interface> |
1041 | - <requires lib="gtk+" version="2.16"/> |
1042 | - <object class="GtkWindow" id="window1"> |
1043 | - <property name="title" translatable="yes">yes11</property> |
1044 | - <child><placeholder/></child> |
1045 | - </object> |
1046 | -</interface>''') |
1047 | - |
1048 | - self._mksrc('data/settings.ui', '''<?xml version="1.0"?> |
1049 | -<interface domain="foobar"> |
1050 | - <requires lib="gtk+" version="2.16"/> |
1051 | - <object class="GtkWindow" id="window1"> |
1052 | - <property name="title" translatable="yes">yes12</property> |
1053 | - <child><placeholder/></child> |
1054 | - </object> |
1055 | -</interface>''') |
1056 | - |
1057 | - self._mksrc('Makefile', 'echo _("no7")') |
1058 | - |
1059 | - # Executables without *.py extension |
1060 | - self._mksrc('gtk/foo-gtk', '#!/usr/bin/python\nprint (_("yes13"))', |
1061 | - executable=True) |
1062 | - self._mksrc('cli/foo-cli', '#!/usr/bin/env python\nprint (_(\'yes14\'))', |
1063 | - executable=True) |
1064 | - self._mksrc('daemon/foobarize', '#!/usr/bin/flex\np _("no8")', |
1065 | - executable=True) |
1066 | - |
1067 | -unittest.main() |
1068 | |
1069 | === modified file 'DistUtilsExtra/command/check.py' |
1070 | --- DistUtilsExtra/command/check.py 2010-09-23 16:00:58 +0000 |
1071 | +++ DistUtilsExtra/command/check.py 2010-11-03 17:39:44 +0000 |
1072 | @@ -1,7 +1,20 @@ |
1073 | # DistUtilsExtra.command.check - check command for DistUtilsExtra |
1074 | # |
1075 | # Author: Rodney Dawes <rodney.dawes@canonical.com> |
1076 | +# |
1077 | # Copyright 2009 Canonical Ltd. |
1078 | +# |
1079 | +# This program is free software: you can redistribute it and/or modify it |
1080 | +# under the terms of the GNU General Public License version 3, as published |
1081 | +# by the Free Software Foundation. |
1082 | +# |
1083 | +# This program is distributed in the hope that it will be useful, but |
1084 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
1085 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
1086 | +# PURPOSE. See the GNU General Public License for more details. |
1087 | +# |
1088 | +# You should have received a copy of the GNU General Public License along |
1089 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
1090 | |
1091 | """DistUtilsExtra.command.check |
1092 | |
1093 | |
1094 | === modified file 'debian/changelog' |
1095 | --- debian/changelog 2010-09-23 16:00:58 +0000 |
1096 | +++ debian/changelog 2010-11-03 17:39:44 +0000 |
1097 | @@ -1,3 +1,10 @@ |
1098 | +python-distutils-extra (2.22-2ubuntu1) natty; urgency=low |
1099 | + |
1100 | + * When the environment has $PYTHONPATH in it, we still need to prepend |
1101 | + oldcwd so that the DistUtilsExtra package can be found. (LP: #670188) |
1102 | + |
1103 | + -- Barry Warsaw <barry@ubuntu.com> Wed, 03 Nov 2010 13:31:44 -0400 |
1104 | + |
1105 | python-distutils-extra (2.22-2) unstable; urgency=low |
1106 | |
1107 | * Upload to unstable, now that the current python3 is in unstable. |
1108 | |
1109 | === added file 'debian/patches/fix-pythonpath' |
1110 | --- debian/patches/fix-pythonpath 1970-01-01 00:00:00 +0000 |
1111 | +++ debian/patches/fix-pythonpath 2010-11-03 17:39:44 +0000 |
1112 | @@ -0,0 +1,49 @@ |
1113 | +=== modified file 'setup.py' |
1114 | +--- setup.py 2010-09-17 13:42:32 +0000 |
1115 | ++++ setup.py 2010-11-03 16:46:34 +0000 |
1116 | +@@ -1,7 +1,7 @@ |
1117 | + #!/usr/bin/env python |
1118 | + |
1119 | + from setuptools import setup |
1120 | +-import glob, os, sys |
1121 | ++import sys |
1122 | + |
1123 | + sys.path.insert(0, '.') |
1124 | + from DistUtilsExtra import __version__ as pkgversion |
1125 | + |
1126 | +=== modified file 'test/auto.py' |
1127 | +--- test/auto.py 2010-09-23 16:00:58 +0000 |
1128 | ++++ test/auto.py 2010-11-03 17:19:17 +0000 |
1129 | +@@ -2,7 +2,7 @@ |
1130 | + |
1131 | + # test DistUtilsExtra.auto |
1132 | + |
1133 | +-import sys, unittest, shutil, tempfile, os, os.path, subprocess, re |
1134 | ++import unittest, shutil, tempfile, os, os.path, subprocess, re |
1135 | + |
1136 | + class T(unittest.TestCase): |
1137 | + def setUp(self): |
1138 | +@@ -32,7 +32,7 @@ |
1139 | + try: |
1140 | + # check that setup.py clean removes everything |
1141 | + (o, e, s) = self.setup_py(['clean', '-a']) |
1142 | +- self.assertEqual(s, 0) |
1143 | ++ self.assertEqual(s, 0, o+e) |
1144 | + cruft = self.diff_snapshot() |
1145 | + self.assertEqual(cruft, '', 'no cruft after cleaning:\n' + cruft) |
1146 | + finally: |
1147 | +@@ -759,9 +759,11 @@ |
1148 | + if not self.snapshot: |
1149 | + self.do_snapshot() |
1150 | + |
1151 | +- env = os.environ |
1152 | ++ env = os.environ.copy() |
1153 | + oldcwd = os.getcwd() |
1154 | +- if 'PYTHONPATH' not in env: |
1155 | ++ if 'PYTHONPATH' in env: |
1156 | ++ env['PYTHONPATH'] = oldcwd + os.pathsep + env['PYTHONPATH'] |
1157 | ++ else: |
1158 | + env['PYTHONPATH'] = oldcwd |
1159 | + os.chdir(self.src) |
1160 | + s = subprocess.Popen(['/proc/self/exe', 'setup.py'] + args, env=env, |
1161 | + |
1162 | |
1163 | === modified file 'debian/patches/series' |
1164 | --- debian/patches/series 2010-09-23 16:00:58 +0000 |
1165 | +++ debian/patches/series 2010-11-03 17:39:44 +0000 |
1166 | @@ -1,1 +1,2 @@ |
1167 | debian-changes-2.22-2 |
1168 | +fix-pythonpath -p0 |
1169 | |
1170 | === modified file 'test/auto.py' |
1171 | --- test/auto.py 2010-09-23 16:00:58 +0000 |
1172 | +++ test/auto.py 2010-11-03 17:39:44 +0000 |
1173 | @@ -9,10 +9,6 @@ |
1174 | self.src = tempfile.mkdtemp() |
1175 | |
1176 | self._mksrc('setup.py', ''' |
1177 | -# ignore warning about import from local path |
1178 | -import warnings |
1179 | -warnings.filterwarnings('ignore', 'Module DistUtilsExtra was already imported from.*') |
1180 | - |
1181 | from DistUtilsExtra.auto import setup |
1182 | |
1183 | setup( |
Barry,
unfortuately this merge went totally wrong (see generated diff). Even looking at r21 in your branch doesn't give me a sensible patch.
Perhaps you can re-do this against lp:python-distutils-extra, or just send me a plain patch?