Merge lp:~frgomes/setuptoolsbzr/lp1254288 into lp:setuptoolsbzr

Proposed by Richard Gomes on 2014-01-09
Status: Merged
Approved by: Richard Gomes on 2014-01-09
Approved revision: 24
Merged at revision: 16
Proposed branch: lp:~frgomes/setuptoolsbzr/lp1254288
Merge into: lp:setuptoolsbzr
Diff against target: 376 lines (+46/-248)
4 files modified
README.txt (+1/-0)
ez_setup.py (+0/-228)
setup.py (+21/-8)
setuptools_bzr/__init__.py (+24/-12)
To merge this branch: bzr merge lp:~frgomes/setuptoolsbzr/lp1254288
Reviewer Review Type Date Requested Status
Richard Gomes Pending
Review via email: mp+201116@code.launchpad.net

Commit message

Merged with branch: ~frgomes/setuptoolsbzr/lp1254288

Description of the change

Merge for release 2.2

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.txt'
2--- README.txt 2008-04-02 21:24:27 +0000
3+++ README.txt 2014-01-09 22:49:08 +0000
4@@ -57,6 +57,7 @@
5 ===================
6
7 Author: Barry Warsaw <barry@python.org>
8+Maintainer: Richard Gomes <rgomes.info@gmail.com>
9
10 This package is developed on Launchpad_. Please see the `project page`_ for
11 submitting bug reports.
12
13=== removed file 'ez_setup.py'
14--- ez_setup.py 2007-07-20 23:02:07 +0000
15+++ ez_setup.py 1970-01-01 00:00:00 +0000
16@@ -1,228 +0,0 @@
17-#!python
18-"""Bootstrap setuptools installation
19-
20-If you want to use setuptools in your package's setup.py, just include this
21-file in the same directory with it, and add this to the top of your setup.py::
22-
23- from ez_setup import use_setuptools
24- use_setuptools()
25-
26-If you want to require a specific version of setuptools, set a download
27-mirror, or use an alternate download directory, you can do so by supplying
28-the appropriate options to ``use_setuptools()``.
29-
30-This file can also be run as a script to install or upgrade setuptools.
31-"""
32-import sys
33-DEFAULT_VERSION = "0.6c5"
34-DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3]
35-
36-md5_data = {
37- 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
38- 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
39- 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
40- 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
41- 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
42- 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
43- 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
44- 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
45- 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
46- 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
47- 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
48- 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
49- 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
50- 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
51- 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
52- 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
53- 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
54- 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
55- 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
56- 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
57- 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
58-}
59-
60-import sys, os
61-
62-def _validate_md5(egg_name, data):
63- if egg_name in md5_data:
64- from md5 import md5
65- digest = md5(data).hexdigest()
66- if digest != md5_data[egg_name]:
67- print >>sys.stderr, (
68- "md5 validation of %s failed! (Possible download problem?)"
69- % egg_name
70- )
71- sys.exit(2)
72- return data
73-
74-
75-def use_setuptools(
76- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
77- download_delay=15
78-):
79- """Automatically find/download setuptools and make it available on sys.path
80-
81- `version` should be a valid setuptools version number that is available
82- as an egg for download under the `download_base` URL (which should end with
83- a '/'). `to_dir` is the directory where setuptools will be downloaded, if
84- it is not already available. If `download_delay` is specified, it should
85- be the number of seconds that will be paused before initiating a download,
86- should one be required. If an older version of setuptools is installed,
87- this routine will print a message to ``sys.stderr`` and raise SystemExit in
88- an attempt to abort the calling script.
89- """
90- try:
91- import setuptools
92- if setuptools.__version__ == '0.0.1':
93- print >>sys.stderr, (
94- "You have an obsolete version of setuptools installed. Please\n"
95- "remove it from your system entirely before rerunning this script."
96- )
97- sys.exit(2)
98- except ImportError:
99- egg = download_setuptools(version, download_base, to_dir, download_delay)
100- sys.path.insert(0, egg)
101- import setuptools; setuptools.bootstrap_install_from = egg
102-
103- import pkg_resources
104- try:
105- pkg_resources.require("setuptools>="+version)
106-
107- except pkg_resources.VersionConflict, e:
108- # XXX could we install in a subprocess here?
109- print >>sys.stderr, (
110- "The required version of setuptools (>=%s) is not available, and\n"
111- "can't be installed while this script is running. Please install\n"
112- " a more recent version first.\n\n(Currently using %r)"
113- ) % (version, e.args[0])
114- sys.exit(2)
115-
116-def download_setuptools(
117- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
118- delay = 15
119-):
120- """Download setuptools from a specified location and return its filename
121-
122- `version` should be a valid setuptools version number that is available
123- as an egg for download under the `download_base` URL (which should end
124- with a '/'). `to_dir` is the directory where the egg will be downloaded.
125- `delay` is the number of seconds to pause before an actual download attempt.
126- """
127- import urllib2, shutil
128- egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
129- url = download_base + egg_name
130- saveto = os.path.join(to_dir, egg_name)
131- src = dst = None
132- if not os.path.exists(saveto): # Avoid repeated downloads
133- try:
134- from distutils import log
135- if delay:
136- log.warn("""
137----------------------------------------------------------------------------
138-This script requires setuptools version %s to run (even to display
139-help). I will attempt to download it for you (from
140-%s), but
141-you may need to enable firewall access for this script first.
142-I will start the download in %d seconds.
143-
144-(Note: if this machine does not have network access, please obtain the file
145-
146- %s
147-
148-and place it in this directory before rerunning this script.)
149----------------------------------------------------------------------------""",
150- version, download_base, delay, url
151- ); from time import sleep; sleep(delay)
152- log.warn("Downloading %s", url)
153- src = urllib2.urlopen(url)
154- # Read/write all in one block, so we don't create a corrupt file
155- # if the download is interrupted.
156- data = _validate_md5(egg_name, src.read())
157- dst = open(saveto,"wb"); dst.write(data)
158- finally:
159- if src: src.close()
160- if dst: dst.close()
161- return os.path.realpath(saveto)
162-
163-def main(argv, version=DEFAULT_VERSION):
164- """Install or upgrade setuptools and EasyInstall"""
165-
166- try:
167- import setuptools
168- except ImportError:
169- egg = None
170- try:
171- egg = download_setuptools(version, delay=0)
172- sys.path.insert(0,egg)
173- from setuptools.command.easy_install import main
174- return main(list(argv)+[egg]) # we're done here
175- finally:
176- if egg and os.path.exists(egg):
177- os.unlink(egg)
178- else:
179- if setuptools.__version__ == '0.0.1':
180- # tell the user to uninstall obsolete version
181- use_setuptools(version)
182-
183- req = "setuptools>="+version
184- import pkg_resources
185- try:
186- pkg_resources.require(req)
187- except pkg_resources.VersionConflict:
188- try:
189- from setuptools.command.easy_install import main
190- except ImportError:
191- from easy_install import main
192- main(list(argv)+[download_setuptools(delay=0)])
193- sys.exit(0) # try to force an exit
194- else:
195- if argv:
196- from setuptools.command.easy_install import main
197- main(argv)
198- else:
199- print "Setuptools version",version,"or greater has been installed."
200- print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
201-
202-
203-
204-def update_md5(filenames):
205- """Update our built-in md5 registry"""
206-
207- import re
208- from md5 import md5
209-
210- for name in filenames:
211- base = os.path.basename(name)
212- f = open(name,'rb')
213- md5_data[base] = md5(f.read()).hexdigest()
214- f.close()
215-
216- data = [" %r: %r,\n" % it for it in md5_data.items()]
217- data.sort()
218- repl = "".join(data)
219-
220- import inspect
221- srcfile = inspect.getsourcefile(sys.modules[__name__])
222- f = open(srcfile, 'rb'); src = f.read(); f.close()
223-
224- match = re.search("\nmd5_data = {\n([^}]+)}", src)
225- if not match:
226- print >>sys.stderr, "Internal error!"
227- sys.exit(2)
228-
229- src = src[:match.start(1)] + repl + src[match.end(1):]
230- f = open(srcfile,'w')
231- f.write(src)
232- f.close()
233-
234-
235-if __name__=='__main__':
236- if len(sys.argv)>2 and sys.argv[1]=='--md5update':
237- update_md5(sys.argv[2:])
238- else:
239- main(sys.argv[1:])
240-
241-
242-
243-
244-
245
246=== modified file 'setup.py'
247--- setup.py 2010-11-04 20:23:07 +0000
248+++ setup.py 2014-01-09 22:49:08 +0000
249@@ -15,10 +15,6 @@
250 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
251 # USA.
252
253-
254-import ez_setup
255-ez_setup.use_setuptools()
256-
257 from setuptools import setup, find_packages
258 from setuptools_bzr import __version__
259
260@@ -29,17 +25,34 @@
261 description = 'setuptools plugin for bzr',
262 author = 'Barry Warsaw',
263 author_email = 'barry@python.org',
264+ maintainer = 'Richard Gomes',
265+ maintainer_email= 'rgomes.info@gmail.com',
266 license = 'LGPLv3',
267 # For historical reasons, the code lives under a different project name.
268 url = 'https://launchpad.net/setuptoolsbzr',
269- keywords = 'distutils setuptools setup',
270+ keywords = 'distutils setuptools setup bzr bazaar',
271 packages = find_packages(),
272+ classifiers=[
273+ "Development Status :: 5 - Production/Stable",
274+ "Programming Language :: Python",
275+ "Programming Language :: Python :: 2",
276+ "Programming Language :: Python :: 2.4",
277+ "Programming Language :: Python :: 2.5",
278+ "Programming Language :: Python :: 2.6",
279+ "Programming Language :: Python :: 2.7",
280+ "Programming Language :: Python :: 3",
281+ "Programming Language :: Python :: 3.1",
282+ "Programming Language :: Python :: 3.2",
283+ "Programming Language :: Python :: 3.3",
284+ "Intended Audience :: Developers",
285+ "Operating System :: OS Independent",
286+ "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
287+ "Topic :: Software Development :: Version Control",
288+ "Framework :: Setuptools Plugin",
289+ ],
290 entry_points = {
291 'setuptools.file_finders': [
292 'bzr = setuptools_bzr:find_files_for_bzr',
293 ],
294 },
295- install_requires = {
296- 'bzr': ['bzr'],
297- },
298 )
299
300=== modified file 'setuptools_bzr/__init__.py'
301--- setuptools_bzr/__init__.py 2010-11-04 20:23:07 +0000
302+++ setuptools_bzr/__init__.py 2014-01-09 22:49:08 +0000
303@@ -15,15 +15,17 @@
304 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
305 # USA.
306
307+from __future__ import print_function
308+
309 """setuptools plugin for projects maintained under Bazaar."""
310
311-__version__ = '2.1'
312+__version__ = '2.2'
313 __all__ = [
314 'find_files_for_bzr',
315 ]
316
317
318-import os
319+import os, sys
320 import subprocess
321
322 try:
323@@ -34,6 +36,9 @@
324 Branch = None
325
326
327+PY3 = sys.version[0] == "3"
328+
329+
330 if os.getenv('BZR_SETUPTOOLS_FORCE_CMD'):
331 Branch = None
332
333@@ -47,11 +52,11 @@
334 branch.lock_read()
335 try:
336 # Get the inventory of the branch's last revision.
337- inv = branch.repository.get_revision_inventory(branch.last_revision())
338+ inv = branch.repository.get_inventory(branch.last_revision())
339 # Get the inventory entry for the path.
340 entry = inv[inv.path2id(path)]
341 # Return the names of the children.
342- return [os.path.join(path, child) for child in entry.children.keys()]
343+ return [os.path.join(path, child) for child in list(entry.children.keys())]
344 finally:
345 branch.unlock()
346
347@@ -76,14 +81,21 @@
348
349 def bzr_find_files_for_bzr(dirname):
350 """Use the program bzr(1) to recursively find versioned files."""
351- cmd = 'bzr ls --versioned ' + dirname
352- proc = subprocess.Popen(cmd.split(),
353- stdin=subprocess.PIPE,
354- stdout=subprocess.PIPE,
355- stderr=subprocess.PIPE)
356- stdout, stderr = proc.communicate()
357- # XXX check for errors and log stderr
358- return stdout.splitlines()
359+ cmd = 'bzr ls --recursive --versioned ' + dirname
360+ try:
361+ proc = subprocess.Popen(cmd.split(),
362+ stdin=subprocess.PIPE,
363+ stdout=subprocess.PIPE,
364+ stderr=subprocess.PIPE)
365+ stdout, stderr = proc.communicate()
366+ except Exception as e:
367+ print('WARNING: bzr: {}'.format(e), file=sys.stderr)
368+ return []
369+
370+ if not PY3:
371+ return stdout.splitlines()
372+ else:
373+ return (line.decode('utf-8') for line in stdout.splitlines())
374
375
376 def find_files_for_bzr(dirname):

Subscribers

People subscribed via source and target branches

to all changes: