Merge lp://staging/~gary/lazr.enum/build-license-changes into lp://staging/~launchpad-pqm/lazr.enum/trunk

Proposed by Gary Poster
Status: Merged
Approved by: Francis J. Lacoste
Approved revision: 26
Merged at revision: not available
Proposed branch: lp://staging/~gary/lazr.enum/build-license-changes
Merge into: lp://staging/~launchpad-pqm/lazr.enum/trunk
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~gary/lazr.enum/build-license-changes
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) Approve
Review via email: mp+4835@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

- Change license to only specify v3 of LGPL

- Update build to mirror changes in lazr.yourpkg and lazr style guide.

Revision history for this message
Francis J. Lacoste (flacoste) wrote :

On March 24, 2009, Gary Poster wrote:
> Gary Poster has proposed merging lp:~gary/lazr.enum/build-license-changes
> into lp:~launchpad-pqm/lazr.enum/trunk.
>
> Requested reviews:
> LAZR Developers (lazr-developers)
>
> - Change license to only specify v3 of LGPL
>
> - Update build to mirror changes in lazr.yourpkg and lazr style guide.

 status approved
 review approve

All good.

--
Francis J. Lacoste
<email address hidden>

review: Approve
27. By Gary Poster

reexport more items

28. By Gary Poster

correct lazr.yourpkg reference in comment to be lazr.enum

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-03-04 14:22:39 +0000
3+++ .bzrignore 2009-03-24 14:12:06 +0000
4@@ -3,6 +3,9 @@
5 .installed.cfg
6 develop-eggs
7 parts
8-src/lazr.enum.egg-info
9+*.egg-info
10 tags
11 TAGS
12+build
13+*.egg
14+dist
15
16=== modified file 'HACKING.txt'
17--- HACKING.txt 2009-03-04 14:22:39 +0000
18+++ HACKING.txt 2009-03-24 14:12:06 +0000
19@@ -3,8 +3,7 @@
20
21 lazr.enum is free software: you can redistribute it and/or modify it
22 under the terms of the GNU Lesser General Public License as published by
23- the Free Software Foundation, either version 3 of the License, or (at your
24- option) any later version.
25+ the Free Software Foundation, version 3 of the License.
26
27 lazr.enum is distributed in the hope that it will be useful, but WITHOUT
28 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
29
30=== added file 'MANIFEST.in'
31--- MANIFEST.in 1970-01-01 00:00:00 +0000
32+++ MANIFEST.in 2009-03-24 14:12:06 +0000
33@@ -0,0 +1,2 @@
34+exclude MANIFEST.in buildout.cfg bootstrap.py .bzrignore
35+prune _bootstrap
36
37=== modified file 'README.txt'
38--- README.txt 2009-03-06 14:05:00 +0000
39+++ README.txt 2009-03-24 14:12:06 +0000
40@@ -5,8 +5,7 @@
41
42 lazr.enum is free software: you can redistribute it and/or modify it
43 under the terms of the GNU Lesser General Public License as published by
44- the Free Software Foundation, either version 3 of the License, or (at your
45- option) any later version.
46+ the Free Software Foundation, version 3 of the License.
47
48 lazr.enum is distributed in the hope that it will be useful, but WITHOUT
49 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
50
51=== added directory '_bootstrap'
52=== added file '_bootstrap/COPYRIGHT.txt'
53--- _bootstrap/COPYRIGHT.txt 1970-01-01 00:00:00 +0000
54+++ _bootstrap/COPYRIGHT.txt 2009-03-24 14:12:06 +0000
55@@ -0,0 +1,9 @@
56+Copyright (c) 2004-2009 Zope Corporation and Contributors.
57+All Rights Reserved.
58+
59+This software is subject to the provisions of the Zope Public License,
60+Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
61+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
62+WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
63+WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
64+FOR A PARTICULAR PURPOSE.
65
66=== added file '_bootstrap/LICENSE.txt'
67--- _bootstrap/LICENSE.txt 1970-01-01 00:00:00 +0000
68+++ _bootstrap/LICENSE.txt 2009-03-24 14:12:06 +0000
69@@ -0,0 +1,54 @@
70+Zope Public License (ZPL) Version 2.1
71+-------------------------------------
72+
73+A copyright notice accompanies this license document that
74+identifies the copyright holders.
75+
76+This license has been certified as open source. It has also
77+been designated as GPL compatible by the Free Software
78+Foundation (FSF).
79+
80+Redistribution and use in source and binary forms, with or
81+without modification, are permitted provided that the
82+following conditions are met:
83+
84+1. Redistributions in source code must retain the
85+ accompanying copyright notice, this list of conditions,
86+ and the following disclaimer.
87+
88+2. Redistributions in binary form must reproduce the accompanying
89+ copyright notice, this list of conditions, and the
90+ following disclaimer in the documentation and/or other
91+ materials provided with the distribution.
92+
93+3. Names of the copyright holders must not be used to
94+ endorse or promote products derived from this software
95+ without prior written permission from the copyright
96+ holders.
97+
98+4. The right to distribute this software or to use it for
99+ any purpose does not give you the right to use
100+ Servicemarks (sm) or Trademarks (tm) of the copyright
101+ holders. Use of them is covered by separate agreement
102+ with the copyright holders.
103+
104+5. If any files are modified, you must cause the modified
105+ files to carry prominent notices stating that you changed
106+ the files and the date of any change.
107+
108+Disclaimer
109+
110+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
111+ AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
112+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
113+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
114+ NO EVENT SHALL THE COPYRIGHT HOLDERS BE
115+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
116+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
117+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
118+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
119+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
120+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
121+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
122+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
123+ DAMAGE.
124\ No newline at end of file
125
126=== renamed file 'bootstrap.py' => '_bootstrap/bootstrap.py'
127=== added symlink 'bootstrap.py'
128=== target is '_bootstrap/bootstrap.py'
129=== modified file 'buildout.cfg'
130--- buildout.cfg 2009-03-05 05:27:41 +0000
131+++ buildout.cfg 2009-03-24 14:12:06 +0000
132@@ -3,6 +3,7 @@
133 interpreter
134 test
135 test_proxy
136+ docs
137 tags
138 unzip = true
139
140@@ -11,16 +12,23 @@
141 [test]
142 recipe = zc.recipe.testrunner
143 eggs = lazr.enum
144-defaults = '--tests-pattern ^test_documentation --exit-with-status'.split()
145+defaults = '--tests-pattern ^test_docs --exit-with-status --suite-name additional_tests'.split()
146
147 [test_proxy]
148 recipe = zc.recipe.testrunner
149 eggs = lazr.enum[proxy]
150 defaults = '--tests-pattern ^test_proxy --exit-with-status'.split()
151
152+[docs]
153+recipe = z3c.recipe.sphinxdoc
154+eggs = lazr.enum [docs]
155+index-doc = README
156+default.css =
157+layout.html =
158+
159 [interpreter]
160 recipe = zc.recipe.egg
161-interpreter=py
162+interpreter = py
163 eggs = lazr.enum
164 docutils
165
166
167=== added file 'ez_setup.py'
168--- ez_setup.py 1970-01-01 00:00:00 +0000
169+++ ez_setup.py 2009-03-24 14:12:06 +0000
170@@ -0,0 +1,241 @@
171+#!python
172+"""Bootstrap setuptools installation
173+
174+If you want to use setuptools in your package's setup.py, just include this
175+file in the same directory with it, and add this to the top of your setup.py::
176+
177+ from ez_setup import use_setuptools
178+ use_setuptools()
179+
180+If you want to require a specific version of setuptools, set a download
181+mirror, or use an alternate download directory, you can do so by supplying
182+the appropriate options to ``use_setuptools()``.
183+
184+This file can also be run as a script to install or upgrade setuptools.
185+"""
186+import sys
187+DEFAULT_VERSION = "0.6c8"
188+DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
189+
190+md5_data = {
191+ 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
192+ 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
193+ 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
194+ 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
195+ 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
196+ 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
197+ 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
198+ 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
199+ 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
200+ 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
201+ 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
202+ 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
203+ 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
204+ 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
205+ 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
206+ 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
207+ 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
208+ 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
209+ 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
210+ 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
211+ 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
212+ 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
213+ 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
214+ 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
215+ 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
216+ 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
217+ 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
218+ 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
219+ 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
220+ 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
221+}
222+
223+import sys, os
224+
225+def _validate_md5(egg_name, data):
226+ if egg_name in md5_data:
227+ from md5 import md5
228+ digest = md5(data).hexdigest()
229+ if digest != md5_data[egg_name]:
230+ print >>sys.stderr, (
231+ "md5 validation of %s failed! (Possible download problem?)"
232+ % egg_name
233+ )
234+ sys.exit(2)
235+ return data
236+
237+
238+def use_setuptools(
239+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
240+ download_delay=15, min_version=None
241+):
242+ """Automatically find/download setuptools and make it available on sys.path
243+
244+ `version` should be a valid setuptools version number that is available
245+ as an egg for download under the `download_base` URL (which should end with
246+ a '/'). `to_dir` is the directory where setuptools will be downloaded, if
247+ it is not already available. If `download_delay` is specified, it should
248+ be the number of seconds that will be paused before initiating a download,
249+ should one be required. If an older version of setuptools is installed,
250+ this routine will print a message to ``sys.stderr`` and raise SystemExit in
251+ an attempt to abort the calling script.
252+ """
253+ # Work around a hack in the ez_setup.py file from simplejson==1.7.3.
254+ if min_version:
255+ version = min_version
256+
257+ was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
258+ def do_download():
259+ egg = download_setuptools(version, download_base, to_dir, download_delay)
260+ sys.path.insert(0, egg)
261+ import setuptools; setuptools.bootstrap_install_from = egg
262+ try:
263+ import pkg_resources
264+ except ImportError:
265+ return do_download()
266+ try:
267+ pkg_resources.require("setuptools>="+version); return
268+ except pkg_resources.VersionConflict, e:
269+ if was_imported:
270+ print >>sys.stderr, (
271+ "The required version of setuptools (>=%s) is not available, and\n"
272+ "can't be installed while this script is running. Please install\n"
273+ " a more recent version first, using 'easy_install -U setuptools'."
274+ "\n\n(Currently using %r)"
275+ ) % (version, e.args[0])
276+ sys.exit(2)
277+ else:
278+ del pkg_resources, sys.modules['pkg_resources'] # reload ok
279+ return do_download()
280+ except pkg_resources.DistributionNotFound:
281+ return do_download()
282+
283+def download_setuptools(
284+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
285+ delay = 15
286+):
287+ """Download setuptools from a specified location and return its filename
288+
289+ `version` should be a valid setuptools version number that is available
290+ as an egg for download under the `download_base` URL (which should end
291+ with a '/'). `to_dir` is the directory where the egg will be downloaded.
292+ `delay` is the number of seconds to pause before an actual download attempt.
293+ """
294+ import urllib2, shutil
295+ egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
296+ url = download_base + egg_name
297+ saveto = os.path.join(to_dir, egg_name)
298+ src = dst = None
299+ if not os.path.exists(saveto): # Avoid repeated downloads
300+ try:
301+ from distutils import log
302+ if delay:
303+ log.warn("""
304+---------------------------------------------------------------------------
305+This script requires setuptools version %s to run (even to display
306+help). I will attempt to download it for you (from
307+%s), but
308+you may need to enable firewall access for this script first.
309+I will start the download in %d seconds.
310+
311+(Note: if this machine does not have network access, please obtain the file
312+
313+ %s
314+
315+and place it in this directory before rerunning this script.)
316+---------------------------------------------------------------------------""",
317+ version, download_base, delay, url
318+ ); from time import sleep; sleep(delay)
319+ log.warn("Downloading %s", url)
320+ src = urllib2.urlopen(url)
321+ # Read/write all in one block, so we don't create a corrupt file
322+ # if the download is interrupted.
323+ data = _validate_md5(egg_name, src.read())
324+ dst = open(saveto,"wb"); dst.write(data)
325+ finally:
326+ if src: src.close()
327+ if dst: dst.close()
328+ return os.path.realpath(saveto)
329+
330+def main(argv, version=DEFAULT_VERSION):
331+ """Install or upgrade setuptools and EasyInstall"""
332+ try:
333+ import setuptools
334+ except ImportError:
335+ egg = None
336+ try:
337+ egg = download_setuptools(version, delay=0)
338+ sys.path.insert(0,egg)
339+ from setuptools.command.easy_install import main
340+ return main(list(argv)+[egg]) # we're done here
341+ finally:
342+ if egg and os.path.exists(egg):
343+ os.unlink(egg)
344+ else:
345+ if setuptools.__version__ == '0.0.1':
346+ print >>sys.stderr, (
347+ "You have an obsolete version of setuptools installed. Please\n"
348+ "remove it from your system entirely before rerunning this script."
349+ )
350+ sys.exit(2)
351+
352+ req = "setuptools>="+version
353+ import pkg_resources
354+ try:
355+ pkg_resources.require(req)
356+ except pkg_resources.VersionConflict:
357+ try:
358+ from setuptools.command.easy_install import main
359+ except ImportError:
360+ from easy_install import main
361+ main(list(argv)+[download_setuptools(delay=0)])
362+ sys.exit(0) # try to force an exit
363+ else:
364+ if argv:
365+ from setuptools.command.easy_install import main
366+ main(argv)
367+ else:
368+ print "Setuptools version",version,"or greater has been installed."
369+ print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
370+
371+def update_md5(filenames):
372+ """Update our built-in md5 registry"""
373+
374+ import re
375+ from md5 import md5
376+
377+ for name in filenames:
378+ base = os.path.basename(name)
379+ f = open(name,'rb')
380+ md5_data[base] = md5(f.read()).hexdigest()
381+ f.close()
382+
383+ data = [" %r: %r,\n" % it for it in md5_data.items()]
384+ data.sort()
385+ repl = "".join(data)
386+
387+ import inspect
388+ srcfile = inspect.getsourcefile(sys.modules[__name__])
389+ f = open(srcfile, 'rb'); src = f.read(); f.close()
390+
391+ match = re.search("\nmd5_data = {\n([^}]+)}", src)
392+ if not match:
393+ print >>sys.stderr, "Internal error!"
394+ sys.exit(2)
395+
396+ src = src[:match.start(1)] + repl + src[match.end(1):]
397+ f = open(srcfile,'w')
398+ f.write(src)
399+ f.close()
400+
401+
402+if __name__=='__main__':
403+ if len(sys.argv)>2 and sys.argv[1]=='--md5update':
404+ update_md5(sys.argv[2:])
405+ else:
406+ main(sys.argv[1:])
407+
408+
409+
410+
411+
412
413=== modified file 'setup.py' (properties changed: -x to +x)
414--- setup.py 2009-03-05 05:27:41 +0000
415+++ setup.py 2009-03-24 14:12:06 +0000
416@@ -1,11 +1,12 @@
417+#!/usr/bin/env python
418+
419 # Copyright 2009 Canonical Ltd. All rights reserved.
420 #
421 # This file is part of lazr.enum
422 #
423 # lazr.enum is free software: you can redistribute it and/or modify it
424 # under the terms of the GNU Lesser General Public License as published by
425-# the Free Software Foundation, either version 3 of the License, or (at your
426-# option) any later version.
427+# the Free Software Foundation, version 3 of the License.
428 #
429 # lazr.enum is distributed in the hope that it will be useful, but WITHOUT
430 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
431@@ -15,6 +16,9 @@
432 # You should have received a copy of the GNU Lesser General Public License
433 # along with lazr.enum. If not, see <http://www.gnu.org/licenses/>.
434
435+import ez_setup
436+ez_setup.use_setuptools()
437+
438 import sys
439 from setuptools import setup, find_packages
440
441@@ -34,7 +38,7 @@
442
443
444 sys.path.insert(0, 'src')
445-__version__ = '0.1'
446+from lazr.enum import __version__
447
448 setup(
449 name='lazr.enum',
450@@ -56,14 +60,19 @@
451 'zope.interface',
452 'zope.schema',
453 ],
454- extras_require={
455- 'proxy': ['zope.security']
456- },
457 url='https://launchpad.net/lazr.enum',
458+ download_url= 'https://launchpad.net/lazr.enum/+download',
459 classifiers=[
460 "Development Status :: 5 - Production/Stable",
461 "Intended Audience :: Developers",
462 "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
463 "Operating System :: OS Independent",
464 "Programming Language :: Python"],
465+ extras_require=dict(
466+ proxy=['zope.security'],
467+ docs=['Sphinx',
468+ 'z3c.recipe.sphinxdoc']
469+ ),
470+ setup_requires=['eggtestinfo', 'setuptools_bzr'],
471+ test_suite='lazr.enum.tests',
472 )
473
474=== modified file 'src/lazr/__init__.py'
475--- src/lazr/__init__.py 2009-03-04 14:22:39 +0000
476+++ src/lazr/__init__.py 2009-03-24 14:12:06 +0000
477@@ -4,8 +4,7 @@
478 #
479 # lazr.enum is free software: you can redistribute it and/or modify it
480 # under the terms of the GNU Lesser General Public License as published by
481-# the Free Software Foundation, either version 3 of the License, or (at your
482-# option) any later version.
483+# the Free Software Foundation, version 3 of the License.
484 #
485 # lazr.enum is distributed in the hope that it will be useful, but WITHOUT
486 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
487
488=== modified file 'src/lazr/enum/NEWS.txt'
489--- src/lazr/enum/NEWS.txt 2009-03-04 14:22:39 +0000
490+++ src/lazr/enum/NEWS.txt 2009-03-24 14:12:06 +0000
491@@ -1,8 +1,8 @@
492-=====================
493+==================
494 NEWS for lazr.enum
495-=====================
496+==================
497
498-1.0 (200X-XX-XX)
499+1.0 (2009-03-24)
500 ================
501
502-- Initial release
503+- Initial release on PyPI
504
505=== modified file 'src/lazr/enum/README.txt'
506--- src/lazr/enum/README.txt 2009-03-04 23:07:36 +0000
507+++ src/lazr/enum/README.txt 2009-03-24 14:12:06 +0000
508@@ -3,8 +3,7 @@
509
510 lazr.enum is free software: you can redistribute it and/or modify it
511 under the terms of the GNU Lesser General Public License as published by
512- the Free Software Foundation, either version 3 of the License, or (at your
513- option) any later version.
514+ the Free Software Foundation, version 3 of the License.
515
516 lazr.enum is distributed in the hope that it will be useful, but
517 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
518@@ -377,3 +376,13 @@
519 Hosted 0
520 Mirrored 1
521 Imported 2
522+
523+===============
524+Other Documents
525+===============
526+
527+.. toctree::
528+ :glob:
529+
530+ *
531+ docs/*
532
533=== added file 'src/lazr/enum/__init__.py'
534--- src/lazr/enum/__init__.py 1970-01-01 00:00:00 +0000
535+++ src/lazr/enum/__init__.py 2009-03-24 14:12:06 +0000
536@@ -0,0 +1,29 @@
537+# Copyright 2009 Canonical Ltd. All rights reserved.
538+#
539+# This file is part of lazr.yourpkg
540+#
541+# lazr.yourpkg is free software: you can redistribute it and/or modify it
542+# under the terms of the GNU Lesser General Public License as published by
543+# the Free Software Foundation, version 3 of the License.
544+#
545+# lazr.yourpkg is distributed in the hope that it will be useful, but WITHOUT
546+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
547+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
548+# License for more details.
549+#
550+# You should have received a copy of the GNU Lesser General Public License
551+# along with lazr.yourpkg. If not, see <http://www.gnu.org/licenses/>.
552+"""Enumerations."""
553+
554+__version__ = 1.0
555+
556+# Re-export in such a way that __version__ can still be imported if
557+# dependencies are not yet available.
558+try:
559+ # While we generally frown on "*" imports, this, combined with the fact we
560+ # only test code from this module, means that we can verify what has been
561+ # exported.
562+ from lazr.enum._enum import *
563+ from lazr.enum._enum import __all__
564+except ImportError:
565+ pass
566
567=== renamed file 'src/lazr/enum/__init__.py' => 'src/lazr/enum/_enum.py'
568--- src/lazr/enum/__init__.py 2009-03-05 22:03:00 +0000
569+++ src/lazr/enum/_enum.py 2009-03-24 14:12:06 +0000
570@@ -41,6 +41,7 @@
571 'TokenizedItem',
572 'enumerated_type_registry',
573 'use_template',
574+ 'proxy_isinstance',
575 ]
576
577 def proxy_isinstance(obj, cls):
578
579=== modified file 'src/lazr/enum/interfaces.py'
580--- src/lazr/enum/interfaces.py 2009-03-05 22:03:00 +0000
581+++ src/lazr/enum/interfaces.py 2009-03-24 14:12:06 +0000
582@@ -4,8 +4,7 @@
583 #
584 # lazr.enum is free software: you can redistribute it and/or modify it
585 # under the terms of the GNU Lesser General Public License as published by
586-# the Free Software Foundation, either version 3 of the License, or (at your
587-# option) any later version.
588+# the Free Software Foundation, version 3 of the License.
589 #
590 # lazr.enum is distributed in the hope that it will be useful, but WITHOUT
591 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
592@@ -34,4 +33,3 @@
593 "An instance of `EnumItems` which allows access to the enumerated "
594 "types items by either name of database value if the items are "
595 "DBItems.")
596-
597
598=== modified file 'src/lazr/enum/tests/__init__.py'
599--- src/lazr/enum/tests/__init__.py 2009-01-09 02:10:26 +0000
600+++ src/lazr/enum/tests/__init__.py 2009-03-24 14:12:06 +0000
601@@ -0,0 +1,16 @@
602+# Copyright 2009 Canonical Ltd. All rights reserved.
603+#
604+# This file is part of lazr.enum
605+#
606+# lazr.enum is free software: you can redistribute it and/or modify it under
607+# the terms of the GNU Lesser General Public License as published by the Free
608+# Software Foundation, version 3 of the License.
609+#
610+# lazr.enum is distributed in the hope that it will be useful, but WITHOUT ANY
611+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
612+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
613+# details.
614+#
615+# You should have received a copy of the GNU Lesser General Public License
616+# along with lazr.enum. If not, see <http://www.gnu.org/licenses/>.
617+"The lazr.enum tests."
618
619=== renamed file 'src/lazr/enum/tests/test_documentation.py' => 'src/lazr/enum/tests/test_docs.py'
620--- src/lazr/enum/tests/test_documentation.py 2009-03-05 05:27:41 +0000
621+++ src/lazr/enum/tests/test_docs.py 2009-03-24 14:12:06 +0000
622@@ -1,30 +1,50 @@
623 # Copyright 2009 Canonical Ltd. All rights reserved.
624-
625-"""Test harness."""
626+#
627+# This file is part of lazr.enum
628+#
629+# lazr.enum is free software: you can redistribute it and/or modify it
630+# under the terms of the GNU Lesser General Public License as published by
631+# the Free Software Foundation, version 3 of the License.
632+#
633+# lazr.enum is distributed in the hope that it will be useful, but WITHOUT
634+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
635+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
636+# License for more details.
637+#
638+# You should have received a copy of the GNU Lesser General Public License
639+# along with lazr.enum. If not, see <http://www.gnu.org/licenses/>.
640+"Test harness for doctests."
641
642 __metaclass__ = type
643 __all__ = [
644- 'test_suite',
645+ 'additional_tests',
646 ]
647
648+import atexit
649+import doctest
650 import os
651-import doctest
652+import pkg_resources
653 import unittest
654
655-import lazr.enum
656-
657 DOCTEST_FLAGS = (
658 doctest.ELLIPSIS |
659 doctest.NORMALIZE_WHITESPACE |
660 doctest.REPORT_NDIFF)
661
662-def test_suite():
663- readme = os.path.normpath(
664+
665+def additional_tests():
666+ "Run the doc tests (README.txt and docs/*, if any exist)"
667+ doctest_files = [
668 os.path.abspath(
669- os.path.join(os.path.dirname(__file__),
670- os.path.pardir,
671- 'README.txt')))
672+ pkg_resources.resource_filename('lazr.enum', 'README.txt'))]
673+ if pkg_resources.resource_exists('lazr.enum', 'docs'):
674+ for name in pkg_resources.resource_listdir('lazr.enum', 'docs'):
675+ if name.endswith('.txt'):
676+ doctest_files.append(
677+ os.path.abspath(
678+ pkg_resources.resource_filename(
679+ 'lazr.enum', 'docs/%s' % name)))
680+ kwargs = dict(module_relative=False, optionflags=DOCTEST_FLAGS)
681+ atexit.register(pkg_resources.cleanup_resources)
682 return unittest.TestSuite((
683- doctest.DocFileSuite(
684- readme, module_relative=False, optionflags=DOCTEST_FLAGS),
685- doctest.DocTestSuite(lazr.enum)))
686+ doctest.DocFileSuite(*doctest_files, **kwargs)))
687
688=== modified file 'src/lazr/enum/tests/test_proxy.py'
689--- src/lazr/enum/tests/test_proxy.py 2009-03-05 22:03:00 +0000
690+++ src/lazr/enum/tests/test_proxy.py 2009-03-24 14:12:06 +0000
691@@ -1,6 +1,19 @@
692 # Copyright 2009 Canonical Ltd. All rights reserved.
693-
694-"""Test harness."""
695+#
696+# This file is part of lazr.enum
697+#
698+# lazr.enum is free software: you can redistribute it and/or modify it
699+# under the terms of the GNU Lesser General Public License as published by
700+# the Free Software Foundation, version 3 of the License.
701+#
702+# lazr.enum is distributed in the hope that it will be useful, but WITHOUT
703+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
704+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
705+# License for more details.
706+#
707+# You should have received a copy of the GNU Lesser General Public License
708+# along with lazr.enum. If not, see <http://www.gnu.org/licenses/>.
709+"Tests that depend on zope.security."
710
711 __all__ = [
712 'test_suite',
713@@ -38,8 +51,9 @@
714 True
715 """
716
717-
718+# this differs from the usual name we use for tests, which makes it possible
719+# for us to only run these tests with the buildout's ./bin/test_proxy command,
720+# since the tests depend on zope.security, while the package itself does not.
721 def test_suite():
722 return unittest.TestSuite((
723 doctest.DocTestSuite()))
724-

Subscribers

People subscribed via source and target branches