Merge lp:~ubuntu-branches/ubuntu/quantal/python-django-compressor/quantal-201208160040 into lp:ubuntu/quantal/python-django-compressor
- Quantal (12.10)
- quantal-201208160040
- Merge into quantal
Status: | Rejected |
---|---|
Rejected by: | James Westby |
Proposed branch: | lp:~ubuntu-branches/ubuntu/quantal/python-django-compressor/quantal-201208160040 |
Merge into: | lp:ubuntu/quantal/python-django-compressor |
Diff against target: |
1217 lines (+0/-1129) 14 files modified
.pc/applied-patches (+0/-1) versiontools-1.9.1-py2.7.egg/EGG-INFO/PKG-INFO (+0/-22) versiontools-1.9.1-py2.7.egg/EGG-INFO/SOURCES.txt (+0/-22) versiontools-1.9.1-py2.7.egg/EGG-INFO/dependency_links.txt (+0/-1) versiontools-1.9.1-py2.7.egg/EGG-INFO/entry_points.txt (+0/-8) versiontools-1.9.1-py2.7.egg/EGG-INFO/top_level.txt (+0/-1) versiontools-1.9.1-py2.7.egg/EGG-INFO/zip-safe (+0/-1) versiontools-1.9.1-py2.7.egg/versiontools/__init__.py (+0/-411) versiontools-1.9.1-py2.7.egg/versiontools/bzr_support.py (+0/-97) versiontools-1.9.1-py2.7.egg/versiontools/git_support.py (+0/-113) versiontools-1.9.1-py2.7.egg/versiontools/hg_support.py (+0/-87) versiontools-1.9.1-py2.7.egg/versiontools/setuptools_hooks.py (+0/-71) versiontools-1.9.1-py2.7.egg/versiontools/tests.py (+0/-149) versiontools-1.9.1-py2.7.egg/versiontools/versiontools_support.py (+0/-145) |
To merge this branch: | bzr merge lp:~ubuntu-branches/ubuntu/quantal/python-django-compressor/quantal-201208160040 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Development Team | Pending | ||
Review via email: mp+119817@code.launchpad.net |
Commit message
Description of the change
The package importer has detected a possible inconsistency between the package history in the archive and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/quantal/python-django-compressor reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/quantal/python-django-compressor/quantal-201208160040. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.
If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https:/
(this is an automatically generated message)
Unmerged revisions
- 4. By Chuck Short
-
debian/control: Add 'Provides: ${python:Provides}' to fix package
installation. (LP: #1036907)
Preview Diff
1 | === removed file '.pc/applied-patches' |
2 | --- .pc/applied-patches 2012-07-15 19:02:17 +0000 |
3 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 |
4 | @@ -1,1 +0,0 @@ |
5 | -build-tools.patch |
6 | |
7 | === removed directory '.pc/build-tools.patch' |
8 | === removed directory '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg' |
9 | === removed directory '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/EGG-INFO' |
10 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/EGG-INFO/PKG-INFO' |
11 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/EGG-INFO/SOURCES.txt' |
12 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/EGG-INFO/dependency_links.txt' |
13 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/EGG-INFO/entry_points.txt' |
14 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/EGG-INFO/top_level.txt' |
15 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/EGG-INFO/zip-safe' |
16 | === removed directory '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools' |
17 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools/__init__.py' |
18 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools/bzr_support.py' |
19 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools/git_support.py' |
20 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools/hg_support.py' |
21 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools/setuptools_hooks.py' |
22 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools/tests.py' |
23 | === removed file '.pc/build-tools.patch/versiontools-1.9.1-py2.7.egg/versiontools/versiontools_support.py' |
24 | === removed file 'versiontools-1.9.1-py2.7.egg/EGG-INFO/PKG-INFO' |
25 | --- versiontools-1.9.1-py2.7.egg/EGG-INFO/PKG-INFO 2012-07-15 19:02:17 +0000 |
26 | +++ versiontools-1.9.1-py2.7.egg/EGG-INFO/PKG-INFO 1970-01-01 00:00:00 +0000 |
27 | @@ -1,22 +0,0 @@ |
28 | -Metadata-Version: 1.1 |
29 | -Name: versiontools |
30 | -Version: 1.9.1 |
31 | -Summary: Smart replacement for plain tuple used in __version__ |
32 | -Home-page: https://launchpad.net/versiontools |
33 | -Author: Zygmunt Krynicki |
34 | -Author-email: zygmunt.krynicki@linaro.org |
35 | -License: UNKNOWN |
36 | -Description: UNKNOWN |
37 | -Platform: UNKNOWN |
38 | -Classifier: Development Status :: 5 - Production/Stable |
39 | -Classifier: Intended Audience :: Developers |
40 | -Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) |
41 | -Classifier: Operating System :: OS Independent |
42 | -Classifier: Programming Language :: Python :: 2.4 |
43 | -Classifier: Programming Language :: Python :: 2.5 |
44 | -Classifier: Programming Language :: Python :: 2.6 |
45 | -Classifier: Programming Language :: Python :: 2.7 |
46 | -Classifier: Programming Language :: Python :: 3.0 |
47 | -Classifier: Programming Language :: Python :: 3.1 |
48 | -Classifier: Programming Language :: Python :: 3.2 |
49 | -Classifier: Topic :: Software Development :: Version Control |
50 | |
51 | === removed file 'versiontools-1.9.1-py2.7.egg/EGG-INFO/SOURCES.txt' |
52 | --- versiontools-1.9.1-py2.7.egg/EGG-INFO/SOURCES.txt 2012-07-15 19:02:17 +0000 |
53 | +++ versiontools-1.9.1-py2.7.egg/EGG-INFO/SOURCES.txt 1970-01-01 00:00:00 +0000 |
54 | @@ -1,22 +0,0 @@ |
55 | -MANIFEST.in |
56 | -setup.cfg |
57 | -setup.py |
58 | -doc/changes.rst |
59 | -doc/conf.py |
60 | -doc/index.rst |
61 | -doc/reference.rst |
62 | -doc/usage.rst |
63 | -doc/vcs-integration.rst |
64 | -versiontools/__init__.py |
65 | -versiontools/bzr_support.py |
66 | -versiontools/git_support.py |
67 | -versiontools/hg_support.py |
68 | -versiontools/setuptools_hooks.py |
69 | -versiontools/tests.py |
70 | -versiontools/versiontools_support.py |
71 | -versiontools.egg-info/PKG-INFO |
72 | -versiontools.egg-info/SOURCES.txt |
73 | -versiontools.egg-info/dependency_links.txt |
74 | -versiontools.egg-info/entry_points.txt |
75 | -versiontools.egg-info/top_level.txt |
76 | -versiontools.egg-info/zip-safe |
77 | \ No newline at end of file |
78 | |
79 | === removed file 'versiontools-1.9.1-py2.7.egg/EGG-INFO/dependency_links.txt' |
80 | --- versiontools-1.9.1-py2.7.egg/EGG-INFO/dependency_links.txt 2012-07-15 19:02:17 +0000 |
81 | +++ versiontools-1.9.1-py2.7.egg/EGG-INFO/dependency_links.txt 1970-01-01 00:00:00 +0000 |
82 | @@ -1,1 +0,0 @@ |
83 | - |
84 | |
85 | === removed file 'versiontools-1.9.1-py2.7.egg/EGG-INFO/entry_points.txt' |
86 | --- versiontools-1.9.1-py2.7.egg/EGG-INFO/entry_points.txt 2012-07-15 19:02:17 +0000 |
87 | +++ versiontools-1.9.1-py2.7.egg/EGG-INFO/entry_points.txt 1970-01-01 00:00:00 +0000 |
88 | @@ -1,8 +0,0 @@ |
89 | - |
90 | - [versiontools.vcs_integration] |
91 | - bzr=versiontools.bzr_support:BzrIntegration |
92 | - git=versiontools.git_support:GitIntegration |
93 | - hg=versiontools.hg_support:HgIntegration |
94 | - [distutils.setup_keywords] |
95 | - version=versiontools.setuptools_hooks:version |
96 | - |
97 | \ No newline at end of file |
98 | |
99 | === removed file 'versiontools-1.9.1-py2.7.egg/EGG-INFO/top_level.txt' |
100 | --- versiontools-1.9.1-py2.7.egg/EGG-INFO/top_level.txt 2012-07-15 19:02:17 +0000 |
101 | +++ versiontools-1.9.1-py2.7.egg/EGG-INFO/top_level.txt 1970-01-01 00:00:00 +0000 |
102 | @@ -1,1 +0,0 @@ |
103 | -versiontools |
104 | |
105 | === removed file 'versiontools-1.9.1-py2.7.egg/EGG-INFO/zip-safe' |
106 | --- versiontools-1.9.1-py2.7.egg/EGG-INFO/zip-safe 2012-07-15 19:02:17 +0000 |
107 | +++ versiontools-1.9.1-py2.7.egg/EGG-INFO/zip-safe 1970-01-01 00:00:00 +0000 |
108 | @@ -1,1 +0,0 @@ |
109 | - |
110 | |
111 | === removed file 'versiontools-1.9.1-py2.7.egg/versiontools/__init__.py' |
112 | --- versiontools-1.9.1-py2.7.egg/versiontools/__init__.py 2012-07-15 19:02:17 +0000 |
113 | +++ versiontools-1.9.1-py2.7.egg/versiontools/__init__.py 1970-01-01 00:00:00 +0000 |
114 | @@ -1,411 +0,0 @@ |
115 | -# Copyright (C) 2010-2012 Linaro Limited |
116 | -# |
117 | -# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> |
118 | -# |
119 | -# This file is part of versiontools. |
120 | -# |
121 | -# versiontools is free software: you can redistribute it and/or modify |
122 | -# it under the terms of the GNU Lesser General Public License version 3 |
123 | -# as published by the Free Software Foundation |
124 | -# |
125 | -# versiontools is distributed in the hope that it will be useful, |
126 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
127 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
128 | -# GNU General Public License for more details. |
129 | -# |
130 | -# You should have received a copy of the GNU Lesser General Public License |
131 | -# along with versiontools. If not, see <http://www.gnu.org/licenses/>. |
132 | - |
133 | -""" |
134 | -versiontools |
135 | -============ |
136 | - |
137 | -Define *single* and *useful* ``__version__`` of a project. |
138 | - |
139 | -.. note: Since version 1.1 we should conform to PEP 386 |
140 | -""" |
141 | - |
142 | -__version__ = (1, 9, 1, "final", 0) |
143 | - |
144 | - |
145 | -import inspect |
146 | -import operator |
147 | -import os |
148 | -import sys |
149 | - |
150 | - |
151 | -class Version(tuple): |
152 | - """ |
153 | - Smart version class. |
154 | - |
155 | - Version class is a tuple of five elements and has the same logical |
156 | - components as :data:`sys.version_info`. |
157 | - |
158 | - In addition to the tuple elements there is a special :attr:`vcs` attribute |
159 | - that has all of the data exported by the version control system. |
160 | - """ |
161 | - |
162 | - _RELEASELEVEL_TO_TOKEN = { |
163 | - "alpha": "a", |
164 | - "beta": "b", |
165 | - "candidate": "c", |
166 | - } |
167 | - |
168 | - def __new__(cls, major, minor, micro=0, releaselevel="final", serial=0): |
169 | - """ |
170 | - Construct a new version tuple. |
171 | - |
172 | - There is some extra logic when initializing tuple elements. All |
173 | - variables except for releaselevel are silently converted to integers |
174 | - That is:: |
175 | - |
176 | - >>> Version("1.2.3.dev".split(".")) |
177 | - (1, 2, 3, "dev", 0) |
178 | - |
179 | - :param major: |
180 | - Major version number |
181 | - |
182 | - :type major: |
183 | - :class:`int` or :class:`str` |
184 | - |
185 | - :param minor: |
186 | - Minor version number |
187 | - |
188 | - :type minor: |
189 | - :class:`int` or :class:`str` |
190 | - |
191 | - :param micro: |
192 | - Micro version number, defaults to ``0``. |
193 | - |
194 | - :type micro: |
195 | - :class:`int` or :class:`str` |
196 | - |
197 | - :param releaselevel: |
198 | - Release level name. |
199 | - |
200 | - There is a constraint on allowed values of releaselevel. Only the |
201 | - following values are permitted: |
202 | - |
203 | - * 'dev' |
204 | - * 'alpha' |
205 | - * 'beta' |
206 | - * 'candidate' |
207 | - * 'final' |
208 | - |
209 | - :type releaselevel: |
210 | - :class:`str` |
211 | - |
212 | - :param serial: |
213 | - Serial number, usually zero, only used for alpha, beta and |
214 | - candidate versions where it must be greater than zero. |
215 | - |
216 | - :type micro: |
217 | - :class:`int` or :class:`str` |
218 | - |
219 | - :raises ValueError: |
220 | - If releaselevel is incorrect, a version component is negative or |
221 | - serial is 0 and releaselevel is alpha, beta or candidate. |
222 | - """ |
223 | - def to_int(v): |
224 | - v = int(v) |
225 | - if v < 0: |
226 | - raise ValueError("Version components cannot be negative") |
227 | - return v |
228 | - |
229 | - major = to_int(major) |
230 | - minor = to_int(minor) |
231 | - micro = to_int(micro) |
232 | - serial = to_int(serial) |
233 | - if releaselevel not in ('dev', 'alpha', 'beta', 'candidate', 'final'): |
234 | - raise ValueError( |
235 | - "releaselevel %r is not permitted" % (releaselevel,)) |
236 | - if releaselevel in ('alpha', 'beta', 'candidate') and serial == 0: |
237 | - raise ValueError( |
238 | - ("serial must be greater than zero for" |
239 | - " %s releases") % releaselevel) |
240 | - obj = tuple.__new__(cls, (major, minor, micro, releaselevel, serial)) |
241 | - object.__setattr__(obj, '_source_tree', cls._find_source_tree()) |
242 | - object.__setattr__(obj, '_vcs', None) |
243 | - return obj |
244 | - |
245 | - major = property( |
246 | - operator.itemgetter(0), |
247 | - doc="Major version number") |
248 | - |
249 | - minor = property( |
250 | - operator.itemgetter(1), |
251 | - doc="Minor version number") |
252 | - |
253 | - micro = property( |
254 | - operator.itemgetter(2), |
255 | - doc="Micro version number") |
256 | - |
257 | - releaselevel = property( |
258 | - operator.itemgetter(3), |
259 | - doc="Release level string") |
260 | - |
261 | - serial = property( |
262 | - operator.itemgetter(4), |
263 | - doc="Serial number") |
264 | - |
265 | - @property |
266 | - def vcs(self): |
267 | - """ |
268 | - Return VCS integration object, if any. |
269 | - |
270 | - Accessing this attribute for the first time will query VCS lookup (may |
271 | - be slower, will trigger imports of various VCS plugins). |
272 | - |
273 | - The returned object, if not None, should have at least the `revno` |
274 | - property. For details see your particular version control integration |
275 | - plugin. |
276 | - |
277 | - .. note:: |
278 | - This attribute is **not** an element of the version tuple |
279 | - and thus does not break sorting. |
280 | - |
281 | - .. versionadded:: 1.0.4 |
282 | - """ |
283 | - if self._vcs is None: |
284 | - self._vcs = self._query_vcs() |
285 | - return self._vcs |
286 | - |
287 | - @classmethod |
288 | - def from_tuple(cls, version_tuple): |
289 | - """ |
290 | - Create version from 5-element tuple |
291 | - |
292 | - .. note:: |
293 | - This method is identical to the constructor, just spelled in a way |
294 | - that is more obvious to use. |
295 | - |
296 | - .. versionadded:: 1.1 |
297 | - """ |
298 | - return cls(*version_tuple) |
299 | - |
300 | - @classmethod |
301 | - def from_tuple_and_hint(cls, version_tuple, hint): |
302 | - """ |
303 | - Create version from a 5-element tuple and VCS location hint. |
304 | - |
305 | - Similar to :meth:`~versiontools.Version.from_tuple` but uses the hint |
306 | - object to locate the source tree if needed. A good candidate for hint |
307 | - object is the module that contains the version_tuple. In general |
308 | - anything that works with :meth:`inspect.getsourcefile()` is good. |
309 | - |
310 | - .. versionadded:: 1.4 |
311 | - """ |
312 | - self = cls.from_tuple(version_tuple) |
313 | - if self._source_tree is None: |
314 | - path = inspect.getsourcefile(hint) |
315 | - if path is not None: |
316 | - self._source_tree = os.path.dirname(os.path.abspath(path)) |
317 | - return self |
318 | - |
319 | - @classmethod |
320 | - def from_expression(cls, pkg_expression): |
321 | - """ |
322 | - Create a version from a python module name. |
323 | - |
324 | - The argument must describe a module to import. The module must declare |
325 | - a variable that holds the actual version. The version cannot be a plain |
326 | - string and instead must be a tuple of five elements as described by the |
327 | - :class:`~versiontools.Version` class. |
328 | - |
329 | - The variable that holds the version should be called ``__version__``. |
330 | - If it is called something else the actual name has to be specified |
331 | - explicitly in ``pkg_expression`` by appending a colon (``:``) and the |
332 | - name of the variable (for example ``package:version``). |
333 | - |
334 | - .. versionadded:: 1.9 |
335 | - """ |
336 | - # Parse the version string |
337 | - if ":" in pkg_expression: |
338 | - module_or_package, identifier = pkg_expression.split(":", 1) |
339 | - else: |
340 | - # Allow people not to include the identifier separator |
341 | - module_or_package = pkg_expression |
342 | - identifier = "" |
343 | - # Use __version__ unless specified otherwise |
344 | - if identifier == "": |
345 | - identifier = "__version__" |
346 | - # Import module / package |
347 | - try: |
348 | - obj = __import__(module_or_package, globals(), locals(), ['']) |
349 | - except ImportError: |
350 | - message = _get_exception_message(*sys.exc_info()) |
351 | - raise ValueError( |
352 | - "Unable to import %r%s" % (module_or_package, message)) |
353 | - # Look up the version identifier. |
354 | - try: |
355 | - version = getattr(obj, identifier) |
356 | - except AttributeError: |
357 | - message = _get_exception_message(*sys.exc_info()) |
358 | - raise ValueError( |
359 | - "Unable to access %r in %r%s" % ( |
360 | - identifier, module_or_package, message)) |
361 | - return cls.from_tuple_and_hint(version, hint=obj) |
362 | - |
363 | - def __str__(self): |
364 | - """ |
365 | - Return a string representation of the version tuple. |
366 | - |
367 | - The string is not a direct concatenation of all version components. |
368 | - Instead it's a more natural 'human friendly' version where components |
369 | - with certain values are left out. |
370 | - |
371 | - The following table shows how a version tuple gets converted to a |
372 | - version string. |
373 | - |
374 | - +-------------------------------+-------------------+ |
375 | - | __version__ | Formatter version | |
376 | - +===============================+===================+ |
377 | - | ``(1, 2, 0, "final", 0)`` | ``"1.2"`` | |
378 | - +-------------------------------+-------------------+ |
379 | - | ``(1, 2, 3, "final", 0)`` | ``"1.2.3"`` | |
380 | - +-------------------------------+-------------------+ |
381 | - | ``(1, 3, 0, "alpha", 1)`` | ``"1.3a1"`` | |
382 | - +-------------------------------+-------------------+ |
383 | - | ``(1, 3, 0, "beta", 1)`` | ``"1.3b1"`` | |
384 | - +-------------------------------+-------------------+ |
385 | - | ``(1, 3, 0, "candidate", 1)`` | ``"1.3c1"`` | |
386 | - +-------------------------------+-------------------+ |
387 | - | ``(1, 3, 0, "dev", 0)`` | ``"1.3.dev"`` | |
388 | - +-------------------------------+-------------------+ |
389 | - |
390 | - Now when release level is set to ``"dev"`` then interesting things |
391 | - start to happen. When possible, version control system is queried for |
392 | - revision or changeset identifier. This information gets used to create |
393 | - a more useful version string. The suffix gets appended to the base |
394 | - version string. So for example a full version string, when using Bazaar |
395 | - might look like this: ``"1.3.dev54"`` which indicates that the tree was |
396 | - at revision 54 at that time. |
397 | - |
398 | - The following table describes what gets appended by each version |
399 | - control system. |
400 | - |
401 | - +-----------+------------------------------------------------+ |
402 | - | VCS | Formatted version suffix | |
403 | - +===========+================================================+ |
404 | - | Bazaar | Revision number (revno), e.g. ``54`` | |
405 | - +-----------+------------------------------------------------+ |
406 | - | Git | Short commit ID of the current branch | |
407 | - | | e.g. ``"763fbe3"`` | |
408 | - +-----------+------------------------------------------------+ |
409 | - | Mercurial | Tip revision number, e.g. ``54`` | |
410 | - +-----------+------------------------------------------------+ |
411 | - """ |
412 | - version = "%s.%s" % (self.major, self.minor) |
413 | - if self.micro != 0: |
414 | - version += ".%s" % self.micro |
415 | - token = self._RELEASELEVEL_TO_TOKEN.get(self.releaselevel) |
416 | - if token: |
417 | - version += "%s%d" % (token, self.serial) |
418 | - if self.releaselevel == "dev": |
419 | - if self.vcs is not None: |
420 | - version += ".dev%s" % self.vcs.revno |
421 | - else: |
422 | - version += ".dev" |
423 | - return version |
424 | - |
425 | - @classmethod |
426 | - def _find_source_tree(cls): |
427 | - """ |
428 | - Find the absolute pathname of the tree that contained the file that |
429 | - called our __init__() |
430 | - """ |
431 | - frame = inspect.currentframe() |
432 | - outer_frames = inspect.getouterframes(frame) |
433 | - for index0, record in enumerate(outer_frames): |
434 | - frame, filename, lineno, func_name, context, context_index = record |
435 | - if context is None or context_index >= len(context): |
436 | - continue |
437 | - if (func_name == "<module>" and "__version__" in |
438 | - context[context_index]): |
439 | - caller = frame |
440 | - break |
441 | - else: |
442 | - caller = None |
443 | - if caller: |
444 | - return os.path.dirname( |
445 | - os.path.abspath( |
446 | - inspect.getsourcefile(caller))) |
447 | - |
448 | - def _query_vcs(self): |
449 | - """ |
450 | - Attempt to build a VCS object for the directory refrenced in |
451 | - self._source_tree. |
452 | - |
453 | - The actual version control integration is pluggable, anything that |
454 | - provides an entrypoint for ``versintools.vcs_integration`` is |
455 | - considered. The first version control system that indicates support for |
456 | - the directory wins. |
457 | - |
458 | - In practice you'd want to use the vcs property. |
459 | - """ |
460 | - import pkg_resources |
461 | - if self._source_tree is None: |
462 | - return |
463 | - for entrypoint in pkg_resources.iter_entry_points( |
464 | - "versiontools.vcs_integration"): |
465 | - try: |
466 | - integration_cls = entrypoint.load() |
467 | - integration = integration_cls.from_source_tree( |
468 | - self._source_tree) |
469 | - if integration: |
470 | - return integration |
471 | - except ImportError: |
472 | - pass |
473 | - |
474 | - |
475 | -def format_version(version, hint=None): |
476 | - """ |
477 | - Pretty formatting for 5-element version tuple. |
478 | - |
479 | - Instead of using :class:`~versiontools.Version` class directly you may want |
480 | - to use this simplified interface where you simply interpret an arbitrary |
481 | - five-element version tuple as a version to get the pretty and |
482 | - :pep:`386`-compliant version string. |
483 | - |
484 | - :param version: |
485 | - The version to format |
486 | - |
487 | - :type version: |
488 | - A :class:`tuple` with five elements, as the one provided to |
489 | - :meth:`versiontools.Version.from_tuple`, or an existing instance of |
490 | - :class:`versiontools.Version`. |
491 | - |
492 | - :param hint: |
493 | - The hint object, if provided, helps versiontools to locate the |
494 | - directory which might host the project's source code. The idea is to |
495 | - pass `module.__version__` as the first argument and `module` as the |
496 | - hint. This way we can lookup where module came from, and look for |
497 | - version control system data in that directory. Technically passing hint |
498 | - will make us call :meth:`~versiontools.Version.from_tuple_and_hint()` |
499 | - instead of :meth:`~versiontools.Version.from_tuple()`. |
500 | - |
501 | - :type hint: |
502 | - either :obj:`None`, or a module. |
503 | - |
504 | - .. versionadded:: 1.1 |
505 | - """ |
506 | - if isinstance(version, Version): |
507 | - return str(version) |
508 | - elif isinstance(version, tuple) and len(version) == 5 and hint is not None: |
509 | - return str(Version.from_tuple_and_hint(version, hint)) |
510 | - elif isinstance(version, tuple) and len(version) == 5: |
511 | - return str(Version.from_tuple(version)) |
512 | - else: |
513 | - raise ValueError("version must be a tuple of five items") |
514 | - |
515 | - |
516 | -def _get_exception_message(exception, value, traceback): |
517 | - """ |
518 | - Helper for compatibility with older python versions |
519 | - """ |
520 | - if value is not None: # the exception value |
521 | - return ": %s" % value |
522 | - return "" |
523 | - |
524 | - |
525 | -from versiontools.setuptools_hooks import version as handle_version |
526 | |
527 | === removed file 'versiontools-1.9.1-py2.7.egg/versiontools/bzr_support.py' |
528 | --- versiontools-1.9.1-py2.7.egg/versiontools/bzr_support.py 2012-07-15 19:02:17 +0000 |
529 | +++ versiontools-1.9.1-py2.7.egg/versiontools/bzr_support.py 1970-01-01 00:00:00 +0000 |
530 | @@ -1,97 +0,0 @@ |
531 | -# Copyright (C) 2010 -2012 Linaro Limited |
532 | -# |
533 | -# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> |
534 | -# |
535 | -# This file is part of versiontools. |
536 | -# |
537 | -# versiontools is free software: you can redistribute it and/or modify |
538 | -# it under the terms of the GNU Lesser General Public License version 3 |
539 | -# as published by the Free Software Foundation |
540 | -# |
541 | -# versiontools is distributed in the hope that it will be useful, |
542 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
543 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
544 | -# GNU General Public License for more details. |
545 | -# |
546 | -# You should have received a copy of the GNU Lesser General Public License |
547 | -# along with versiontools. If not, see <http://www.gnu.org/licenses/>. |
548 | - |
549 | -""" |
550 | -.. _bzr: |
551 | - |
552 | -versiontools.bzr_support |
553 | -======================== |
554 | - |
555 | -Bazaar support for versiontools |
556 | - |
557 | -.. note:: |
558 | - |
559 | - To work with Bazaar repositories you will need bzrlib. You can install it |
560 | - with pip or from the ``bzr`` package on Ubuntu. |
561 | - |
562 | -.. warning:: |
563 | - |
564 | - On Windows the typical Bazaar installation bundles both the python |
565 | - interpreter and a host of libraries and those libraries are not accessible |
566 | - by the typically-installed python interpreter. If you wish to use Bazaar on |
567 | - windows we would recommend to install Bazaar directly from pypi. |
568 | -""" |
569 | -import logging |
570 | -import sys |
571 | - |
572 | - |
573 | -class BzrIntegration(object): |
574 | - """ |
575 | - Bazaar integration for versiontools |
576 | - """ |
577 | - def __init__(self, branch): |
578 | - self._revno = branch.last_revision_info()[0] |
579 | - self._branch_nick = branch._get_nick(local=True) |
580 | - |
581 | - @property |
582 | - def revno(self): |
583 | - """ |
584 | - Revision number of the branch |
585 | - """ |
586 | - return self._revno |
587 | - |
588 | - @property |
589 | - def branch_nick(self): |
590 | - """ |
591 | - Nickname of the branch |
592 | - |
593 | - .. versionadded:: 1.0.4 |
594 | - """ |
595 | - return self._branch_nick |
596 | - |
597 | - @classmethod |
598 | - def from_source_tree(cls, source_tree): |
599 | - """ |
600 | - Initialize :class:`~versiontools.bzr_support.BzrIntegration` by |
601 | - pointing at the source tree. Any file or directory inside the |
602 | - source tree may be used. |
603 | - """ |
604 | - branch = None |
605 | - try: |
606 | - import bzrlib |
607 | - if bzrlib.__version__ >= (2, 2, 1): |
608 | - # Python 2.4 the with keyword is not supported |
609 | - # and so you need to use the context manager manually, sigh. |
610 | - library_state = bzrlib.initialize() |
611 | - library_state.__enter__() |
612 | - try: |
613 | - from bzrlib.branch import Branch |
614 | - branch = Branch.open_containing(source_tree)[0] |
615 | - finally: |
616 | - library_state.__exit__(None, None, None) |
617 | - else: |
618 | - from bzrlib.branch import Branch |
619 | - branch = Branch.open_containing(source_tree)[0] |
620 | - except Exception: |
621 | - from versiontools import _get_exception_message |
622 | - message = _get_exception_message(*sys.exc_info()) |
623 | - logging.debug("Unable to get branch revision because " |
624 | - "directory %r is not a bzr branch. Erorr: %s", |
625 | - (source_tree, message)) |
626 | - if branch: |
627 | - return cls(branch) |
628 | |
629 | === removed file 'versiontools-1.9.1-py2.7.egg/versiontools/git_support.py' |
630 | --- versiontools-1.9.1-py2.7.egg/versiontools/git_support.py 2012-07-15 19:02:17 +0000 |
631 | +++ versiontools-1.9.1-py2.7.egg/versiontools/git_support.py 1970-01-01 00:00:00 +0000 |
632 | @@ -1,113 +0,0 @@ |
633 | -# -*- coding: utf-8 -*-" |
634 | -# Copyright (C) 2011 enn.io UG (haftungsbeschränkt) |
635 | -# Copyright (C) 2011-2012 Linaro Limited |
636 | -# |
637 | -# Author: Jannis Leidel <jannis@leidel.info> |
638 | -# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> |
639 | -# |
640 | -# This file is part of versiontools. |
641 | -# |
642 | -# versiontools is free software: you can redistribute it and/or modify |
643 | -# it under the terms of the GNU Lesser General Public License version 3 |
644 | -# as published by the Free Software Foundation |
645 | -# |
646 | -# versiontools is distributed in the hope that it will be useful, |
647 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
648 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
649 | -# GNU General Public License for more details. |
650 | -# |
651 | -# You should have received a copy of the GNU Lesser General Public License |
652 | -# along with versiontools. If not, see <http://www.gnu.org/licenses/>. |
653 | - |
654 | -""" |
655 | -.. _git: |
656 | - |
657 | -versiontools.git_support |
658 | -======================== |
659 | - |
660 | -Git support for versiontools |
661 | - |
662 | -.. note:: |
663 | - |
664 | - To work with Git repositories you will need `GitPython |
665 | - <http://pypi.python.org/pypi/GitPython>`_. Version 0.1.6 is sufficient to |
666 | - run the code. You can install it with pip. |
667 | -""" |
668 | - |
669 | -import logging |
670 | -import sys |
671 | - |
672 | - |
673 | -class GitIntegration(object): |
674 | - """ |
675 | - Git integration for versiontools |
676 | - """ |
677 | - def __init__(self, repo): |
678 | - head = None |
679 | - try: |
680 | - # This path is for 0.3RC from pypi |
681 | - head = repo.head |
682 | - self._branch_nick = head.name |
683 | - self._commit_id = head.commit.hexsha |
684 | - except AttributeError: |
685 | - pass |
686 | - try: |
687 | - # This is for python-git 0.1.6 (that is in debian and ubuntu) |
688 | - head = [head for head in repo.heads if head.name==repo.active_branch][0] |
689 | - self._branch_nick = head.name |
690 | - self._commit_id = head.commit.id |
691 | - except (IndexError, KeyError): |
692 | - pass |
693 | - if head is None: |
694 | - raise ValueError("Unable to lookup head in %r" % repo) |
695 | - |
696 | - @property |
697 | - def revno(self): |
698 | - """ |
699 | - Same as |
700 | - :attr:`~versiontools.git_support.GitIntegration.commit_id_abbrev` |
701 | - """ |
702 | - return self.commit_id_abbrev |
703 | - |
704 | - @property |
705 | - def commit_id(self): |
706 | - """ |
707 | - The full commit id |
708 | - """ |
709 | - return self._commit_id |
710 | - |
711 | - @property |
712 | - def commit_id_abbrev(self): |
713 | - """ |
714 | - The abbreviated, 7 character commit id |
715 | - """ |
716 | - return self._commit_id[:7] |
717 | - |
718 | - @property |
719 | - def branch_nick(self): |
720 | - """ |
721 | - Nickname of the branch |
722 | - |
723 | - .. versionadded:: 1.0.4 |
724 | - """ |
725 | - return self._branch_nick |
726 | - |
727 | - @classmethod |
728 | - def from_source_tree(cls, source_tree): |
729 | - """ |
730 | - Initialize :class:`~versiontools.git_support.GitIntegration` by |
731 | - pointing at the source tree. Any file or directory inside the |
732 | - source tree may be used. |
733 | - """ |
734 | - repo = None |
735 | - try: |
736 | - from git import Repo |
737 | - repo = Repo(source_tree) |
738 | - except Exception: |
739 | - from versiontools import _get_exception_message |
740 | - message = _get_exception_message(*sys.exc_info()) |
741 | - logging.debug("Unable to get branch revision because " |
742 | - "directory %r is not a git repo. Error: %s", |
743 | - (source_tree, message)) |
744 | - if repo: |
745 | - return cls(repo) |
746 | |
747 | === removed file 'versiontools-1.9.1-py2.7.egg/versiontools/hg_support.py' |
748 | --- versiontools-1.9.1-py2.7.egg/versiontools/hg_support.py 2012-07-15 19:02:17 +0000 |
749 | +++ versiontools-1.9.1-py2.7.egg/versiontools/hg_support.py 1970-01-01 00:00:00 +0000 |
750 | @@ -1,87 +0,0 @@ |
751 | -# -*- coding: utf-8 -*-" |
752 | -# Copyright (C) 2011 enn.io UG (haftungsbeschränkt) |
753 | -# Copyright (C) 2011-2012 Linaro Limited |
754 | -# |
755 | -# Author: Jannis Leidel <jannis@leidel.info> |
756 | -# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> |
757 | -# |
758 | -# This file is part of versiontools. |
759 | -# |
760 | -# versiontools is free software: you can redistribute it and/or modify |
761 | -# it under the terms of the GNU Lesser General Public License version 3 |
762 | -# as published by the Free Software Foundation |
763 | -# |
764 | -# versiontools is distributed in the hope that it will be useful, |
765 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
766 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
767 | -# GNU General Public License for more details. |
768 | -# |
769 | -# You should have received a copy of the GNU Lesser General Public License |
770 | -# along with versiontools. If not, see <http://www.gnu.org/licenses/>. |
771 | - |
772 | -""" |
773 | -.. _hg: |
774 | - |
775 | -versiontools.hg_support |
776 | -======================= |
777 | - |
778 | -Mercurial (Hg) support for versiontools. |
779 | - |
780 | -.. note:: |
781 | - |
782 | - To work with Mercurial repositories you will need `Mercurial |
783 | - <http://mercurial.selenic.com/>`_. You can install it with pip or from the |
784 | - `mercurial` package on Ubuntu. |
785 | -""" |
786 | -import logging |
787 | -import sys |
788 | - |
789 | - |
790 | -class HgIntegration(object): |
791 | - """ |
792 | - Hg integration for versiontools |
793 | - """ |
794 | - def __init__(self, repo): |
795 | - tip = repo.changectx('tip') |
796 | - self._revno = tip.rev() |
797 | - try: |
798 | - self._branch_nick = tip.branch() |
799 | - except Exception: |
800 | - self._branch_nick = None |
801 | - |
802 | - @property |
803 | - def revno(self): |
804 | - """ |
805 | - Revision number of the branch |
806 | - """ |
807 | - return self._revno |
808 | - |
809 | - @property |
810 | - def branch_nick(self): |
811 | - """ |
812 | - Nickname of the branch |
813 | - |
814 | - .. versionadded:: 1.0.4 |
815 | - """ |
816 | - return self._branch_nick |
817 | - |
818 | - @classmethod |
819 | - def from_source_tree(cls, source_tree): |
820 | - """ |
821 | - Initialize :class:`~versiontools.hg_support.HgIntegration` by |
822 | - pointing at the source tree. Any file or directory inside the |
823 | - source tree may be used. |
824 | - """ |
825 | - repo = None |
826 | - try: |
827 | - from mercurial.hg import repository |
828 | - from mercurial.ui import ui |
829 | - repo = repository(ui(), source_tree) |
830 | - except Exception: |
831 | - from versiontools import _get_exception_message |
832 | - message = _get_exception_message(*sys.exc_info()) |
833 | - logging.debug("Unable to get branch revision because " |
834 | - "directory %r is not a hg repo. Error: %s", |
835 | - (source_tree, message)) |
836 | - if repo: |
837 | - return cls(repo) |
838 | |
839 | === removed file 'versiontools-1.9.1-py2.7.egg/versiontools/setuptools_hooks.py' |
840 | --- versiontools-1.9.1-py2.7.egg/versiontools/setuptools_hooks.py 2012-07-15 19:02:17 +0000 |
841 | +++ versiontools-1.9.1-py2.7.egg/versiontools/setuptools_hooks.py 1970-01-01 00:00:00 +0000 |
842 | @@ -1,71 +0,0 @@ |
843 | -# Copyright (C) 2010-2012 Linaro Limited |
844 | -# |
845 | -# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> |
846 | -# |
847 | -# This file is part of versiontools. |
848 | -# |
849 | -# versiontools is free software: you can redistribute it and/or modify |
850 | -# it under the terms of the GNU Lesser General Public License version 3 |
851 | -# as published by the Free Software Foundation |
852 | -# |
853 | -# versiontools is distributed in the hope that it will be useful, |
854 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
855 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
856 | -# GNU General Public License for more details. |
857 | -# |
858 | -# You should have received a copy of the GNU Lesser General Public License |
859 | -# along with versiontools. If not, see <http://www.gnu.org/licenses/>. |
860 | - |
861 | -""" |
862 | -versiontools.setuptools_hooks |
863 | -============================= |
864 | - |
865 | -Plugins for setuptools that add versintools features. |
866 | - |
867 | -Setuptools has a framework where external packages, such as versiontools, can |
868 | -hook into setup.py metadata and commands. We use this feature to intercept |
869 | -special values of the ``version`` keyword argument to ``setup()``. This |
870 | -argument handled by the following method: |
871 | -""" |
872 | - |
873 | -import sys |
874 | - |
875 | -from distutils.errors import DistutilsSetupError |
876 | -from versiontools import Version, _get_exception_message |
877 | - |
878 | - |
879 | -def version(dist, attr, value): |
880 | - """ |
881 | - Handle the ``version`` keyword to setuptools.setup() |
882 | - |
883 | - .. note:: |
884 | - This function is normally called by setuptools, it is advertised in the |
885 | - entry points of versiontools as setuptools extension. There is no need |
886 | - to call in manually. |
887 | - |
888 | - .. versionadded:: 1.3 |
889 | - """ |
890 | - # We need to look at dist.metadata.version to actually see the version |
891 | - # that was passed to setup. Something in between does not seem to like our |
892 | - # version string and we get 0 here, odd. |
893 | - if value == 0: |
894 | - value = dist.metadata.version |
895 | - if sys.version_info[:1] < (3,): |
896 | - isstring = lambda string: isinstance(string, basestring) |
897 | - else: |
898 | - isstring = lambda string: isinstance(string, str) |
899 | - if not (isstring(value) |
900 | - and value.startswith(":versiontools:")): |
901 | - return |
902 | - # Peel away the magic tag |
903 | - value = value[len(":versiontools:"):] |
904 | - try: |
905 | - # Lookup the version object |
906 | - version = Version.from_expression(value) |
907 | - # Update distribution metadata |
908 | - dist.metadata.version = str(version) |
909 | - except ValueError: |
910 | - message = _get_exception_message(*sys.exc_info()) |
911 | - if message.startswith(": "): |
912 | - message = message[2:] |
913 | - raise DistutilsSetupError(message) |
914 | |
915 | === removed file 'versiontools-1.9.1-py2.7.egg/versiontools/tests.py' |
916 | --- versiontools-1.9.1-py2.7.egg/versiontools/tests.py 2012-07-15 19:02:17 +0000 |
917 | +++ versiontools-1.9.1-py2.7.egg/versiontools/tests.py 1970-01-01 00:00:00 +0000 |
918 | @@ -1,149 +0,0 @@ |
919 | -# Copyright (C) 2010, 2011 Linaro Limited |
920 | -# |
921 | -# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> |
922 | -# |
923 | -# This file is part of versiontools. |
924 | -# |
925 | -# versiontools is free software: you can redistribute it and/or modify |
926 | -# it under the terms of the GNU Lesser General Public License version 3 |
927 | -# as published by the Free Software Foundation |
928 | -# |
929 | -# versiontools is distributed in the hope that it will be useful, |
930 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
931 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
932 | -# GNU General Public License for more details. |
933 | -# |
934 | -# You should have received a copy of the GNU Lesser General Public License |
935 | -# along with versiontools. If not, see <http://www.gnu.org/licenses/>. |
936 | -import sys |
937 | - |
938 | -from distutils.dist import Distribution |
939 | -from distutils.errors import DistutilsSetupError |
940 | - |
941 | -from unittest import TestCase |
942 | - |
943 | -from versiontools import Version |
944 | -from versiontools.setuptools_hooks import version as handle_version |
945 | - |
946 | - |
947 | -class VersionFormattingTests(TestCase): |
948 | - |
949 | - def setUp(self): |
950 | - # Inhibit Version.vcs from working |
951 | - self._real_vcs = Version.vcs |
952 | - Version.vcs = property(lambda self: None) |
953 | - |
954 | - def tearDown(self): |
955 | - Version.vcs = self._real_vcs |
956 | - |
957 | - def test_defaults(self): |
958 | - self.assertEqual(Version(1, 0), (1, 0, 0, "final", 0)) |
959 | - |
960 | - def test_serial_cannot_be_zero_for_certain_releaselevel(self): |
961 | - self.assertRaises(ValueError, Version, 1, 2, 3, "alpha", 0) |
962 | - self.assertRaises(ValueError, Version, 1, 2, 3, "beta", 0) |
963 | - self.assertRaises(ValueError, Version, 1, 2, 3, "candidate", 0) |
964 | - |
965 | - def test_serial_can_be_zero_for_certain_releaselevel(self): |
966 | - self.assertEqual(Version(1, 2, 3, "final", 0).serial, 0) |
967 | - self.assertEqual(Version(1, 2, 3, "dev", 0).serial, 0) |
968 | - |
969 | - def test_releaselevel_values(self): |
970 | - self.assertRaises(ValueError, Version, 1, 2, 3, "foobar", 0) |
971 | - |
972 | - def test_accessors(self): |
973 | - version = Version(1, 2, 3, "dev", 4) |
974 | - self.assertEqual(version.major, 1) |
975 | - self.assertEqual(version.minor, 2) |
976 | - self.assertEqual(version.micro, 3) |
977 | - self.assertEqual(version.releaselevel, "dev") |
978 | - self.assertEqual(version.serial, 4) |
979 | - |
980 | - def test_positional_accessors(self): |
981 | - version = Version(1, 2, 3, "dev", 4) |
982 | - self.assertEqual(version[0], 1) |
983 | - self.assertEqual(version[1], 2) |
984 | - self.assertEqual(version[2], 3) |
985 | - self.assertEqual(version[3], "dev") |
986 | - self.assertEqual(version[4], 4) |
987 | - |
988 | - def test_formatting_zero_micro_discarded(self): |
989 | - self.assertEqual(str(Version(1, 0)), "1.0") |
990 | - self.assertEqual(str(Version(1, 0, 0)), "1.0") |
991 | - |
992 | - def test_formatting_nonzero_micro_retained(self): |
993 | - self.assertEqual(str(Version(1, 0, 1)), "1.0.1") |
994 | - |
995 | - def test_formatting_serial_not_used_for_development(self): |
996 | - self.assertEqual(str(Version(1, 2, 3, "dev", 4)), "1.2.3.dev") |
997 | - |
998 | - def test_formatting_serial_not_used_for_final(self): |
999 | - self.assertEqual(str(Version(1, 2, 3, "final", 4)), "1.2.3") |
1000 | - |
1001 | - def test_formatting_serial_used_for_alpha_beta_and_candidate(self): |
1002 | - self.assertEqual(str(Version(1, 2, 3, "alpha", 4)), "1.2.3a4") |
1003 | - self.assertEqual(str(Version(1, 2, 3, "beta", 4)), "1.2.3b4") |
1004 | - self.assertEqual(str(Version(1, 2, 3, "candidate", 4)), "1.2.3c4") |
1005 | - |
1006 | - |
1007 | -class MockedVCS(object): |
1008 | - |
1009 | - def __init__(self, revno): |
1010 | - self.revno = revno |
1011 | - |
1012 | - |
1013 | -class VersionFormattingTestsWithMockedVCS(TestCase): |
1014 | - |
1015 | - def setUp(self): |
1016 | - # Inhibit Version.vcs from working |
1017 | - self._real_vcs = Version.vcs |
1018 | - self.mocked_vcs = None |
1019 | - Version.vcs = property(lambda x: self.mocked_vcs) |
1020 | - |
1021 | - def mock_vcs_revno(self, revno): |
1022 | - self.mocked_vcs = MockedVCS(revno) |
1023 | - |
1024 | - def tearDown(self): |
1025 | - Version.vcs = self._real_vcs |
1026 | - |
1027 | - def test_formatting_without_vcs(self): |
1028 | - version = Version(1, 2, 3, "dev", 4) |
1029 | - self.assertEqual(str(version), "1.2.3.dev") |
1030 | - |
1031 | - def test_formatting_with_vcs_and_revno(self): |
1032 | - self.mock_vcs_revno(5) |
1033 | - version = Version(1, 2, 3, "dev", 4) |
1034 | - self.assertEqual(str(version), "1.2.3.dev5") |
1035 | - |
1036 | - def test_formatting_no_dev_suffix_for_alpha_beta_and_candidate(self): |
1037 | - self.mock_vcs_revno(5) |
1038 | - self.assertEqual(str(Version(1, 2, 3, "alpha", 4)), "1.2.3a4") |
1039 | - self.assertEqual(str(Version(1, 2, 3, "beta", 4)), "1.2.3b4") |
1040 | - self.assertEqual(str(Version(1, 2, 3, "candidate", 4)), "1.2.3c4") |
1041 | - |
1042 | - |
1043 | -class HandleVersionTests(TestCase): |
1044 | - |
1045 | - def setUp(self): |
1046 | - self.dist = Distribution() |
1047 | - |
1048 | - def test_cant_import(self): |
1049 | - version = ':versiontools:nonexisting:' |
1050 | - try: |
1051 | - handle_version(self.dist, None, version) |
1052 | - except Exception: |
1053 | - e = sys.exc_info()[1] |
1054 | - self.assertTrue(isinstance(e, DistutilsSetupError)) |
1055 | - self.assertEqual(str(e), "Unable to import 'nonexisting': " |
1056 | - "No module named nonexisting") |
1057 | - |
1058 | - def test_not_found(self): |
1059 | - version = ':versiontools:versiontools:__nonexisting__' |
1060 | - try: |
1061 | - handle_version(self.dist, None, version) |
1062 | - except Exception: |
1063 | - e = sys.exc_info()[1] |
1064 | - self.assertTrue(isinstance(e, DistutilsSetupError)) |
1065 | - self.assertEqual(str(e), "Unable to access '__nonexisting__' in " |
1066 | - "'versiontools': 'module' object has " |
1067 | - "no attribute '__nonexisting__'") |
1068 | |
1069 | === removed file 'versiontools-1.9.1-py2.7.egg/versiontools/versiontools_support.py' |
1070 | --- versiontools-1.9.1-py2.7.egg/versiontools/versiontools_support.py 2012-07-15 19:02:17 +0000 |
1071 | +++ versiontools-1.9.1-py2.7.egg/versiontools/versiontools_support.py 1970-01-01 00:00:00 +0000 |
1072 | @@ -1,145 +0,0 @@ |
1073 | -# Copyright (C) 2012 Linaro Limited |
1074 | -# |
1075 | -# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> |
1076 | -# |
1077 | -# This file is part of versiontools. |
1078 | -# |
1079 | -# versiontools is free software: you can redistribute it and/or modify |
1080 | -# it under the terms of the GNU Lesser General Public License version 3 |
1081 | -# as published by the Free Software Foundation |
1082 | -# |
1083 | -# versiontools is distributed in the hope that it will be useful, |
1084 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1085 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1086 | -# GNU General Public License for more details. |
1087 | -# |
1088 | -# You should have received a copy of the GNU Lesser General Public License |
1089 | -# along with versiontools. If not, see <http://www.gnu.org/licenses/>. |
1090 | - |
1091 | -""" |
1092 | -versiontools.versiontools_support |
1093 | -================================= |
1094 | - |
1095 | -A small standalone module that allows any package to use versiontools. |
1096 | - |
1097 | -Typically you should copy this file verbatim into your source distribution. |
1098 | - |
1099 | -Historically versiontools was depending on a exotic feature of setuptools to |
1100 | -work. Setuptools has so-called setup-time dependencies, that is modules that |
1101 | -need to be downloaded and imported/interrogated for setup.py to run |
1102 | -successfully. Versiontools supports this by installing a handler for the |
1103 | -'version' keyword of the setup() function. |
1104 | - |
1105 | -This approach was always a little annoying as this setuptools feature is rather |
1106 | -odd and very few other packages made any use of it. In the future the standard |
1107 | -tools for python packaging (especially in python3 world) this feature may be |
1108 | -removed or have equivalent thus rendering versiontools completely broken. |
1109 | - |
1110 | -Currently the biggest practical issue is the apparent inability to prevent |
1111 | -setuptools from downloading packages designated as setup_requires. This is |
1112 | -discussed in this pip issue: https://github.com/pypa/pip/issues/410 |
1113 | - |
1114 | -To counter this issue I've redesigned versiontools to be a little smarter. The |
1115 | -old mode stays as-is for compatibility. The new mode works differently, without |
1116 | -the need for using setup_requires in your setup() call. Instead it requires |
1117 | -each package that uses versiontools to ship a verbatim copy of this module and |
1118 | -to import it in their setup.py script. This module helps setuptools find |
1119 | -package version in the standard PKG-INFO file that is created for all source |
1120 | -distributions. Remember that you only need this mode when you don't want to add |
1121 | -a dependency on versiontools. This will still allow you to use versiontools (in |
1122 | -a limited way) in your setup.py file. |
1123 | - |
1124 | -Technically this module defines an improved version of one of |
1125 | -distutils.dist.DistributionMetadata class and monkey-patches distutils to use |
1126 | -it. To retain backward compatibility the new feature is only active when a |
1127 | -special version string is passed to the setup() call. |
1128 | -""" |
1129 | - |
1130 | -__version__ = (1, 0, 0, "final", 0) |
1131 | - |
1132 | -import distutils.dist |
1133 | -import distutils.errors |
1134 | - |
1135 | - |
1136 | -class VersiontoolsEnchancedDistributionMetadata(distutils.dist.DistributionMetadata): |
1137 | - """ |
1138 | - A subclass of distutils.dist.DistributionMetadata that uses versiontools |
1139 | - |
1140 | - Typically you would not instantiate this class directly. It is constructed |
1141 | - by distutils.dist.Distribution.__init__() method. Since there is no other |
1142 | - way to do it, this module monkey-patches distutils to override the original |
1143 | - version of DistributionMetadata |
1144 | - """ |
1145 | - |
1146 | - # Reference to the original class. This is only required because distutils |
1147 | - # was created before the introduction of new-style classes to python. |
1148 | - __base = distutils.dist.DistributionMetadata |
1149 | - |
1150 | - def get_version(self): |
1151 | - """ |
1152 | - Get distribution version. |
1153 | - |
1154 | - This method is enhanced compared to original distutils implementation. |
1155 | - If the version string is set to a special value then instead of using |
1156 | - the actual value the real version is obtained by querying versiontools. |
1157 | - |
1158 | - If versiontools package is not installed then the version is obtained |
1159 | - from the standard section of the ``PKG-INFO`` file. This file is |
1160 | - automatically created by any source distribution. This method is less |
1161 | - useful as it cannot take advantage of version control information that |
1162 | - is automatically loaded by versiontools. It has the advantage of not |
1163 | - requiring versiontools installation and that it does not depend on |
1164 | - ``setup_requires`` feature of ``setuptools``. |
1165 | - """ |
1166 | - if (self.name is not None and self.version is not None |
1167 | - and self.version.startswith(":versiontools:")): |
1168 | - return (self.__get_live_version() or self.__get_frozen_version() |
1169 | - or self.__fail_to_get_any_version()) |
1170 | - else: |
1171 | - return self.__base.get_version(self) |
1172 | - |
1173 | - def __get_live_version(self): |
1174 | - """ |
1175 | - Get a live version string using versiontools |
1176 | - """ |
1177 | - try: |
1178 | - import versiontools |
1179 | - except ImportError: |
1180 | - return None |
1181 | - else: |
1182 | - return str(versiontools.Version.from_expression(self.name)) |
1183 | - |
1184 | - def __get_frozen_version(self): |
1185 | - """ |
1186 | - Get a fixed version string using an existing PKG-INFO file |
1187 | - """ |
1188 | - try: |
1189 | - return self.__base("PKG-INFO").version |
1190 | - except IOError: |
1191 | - return None |
1192 | - |
1193 | - def __fail_to_get_any_version(self): |
1194 | - """ |
1195 | - Raise an informative exception |
1196 | - """ |
1197 | - raise SystemExit( |
1198 | -"""This package requires versiontools for development or testing. |
1199 | - |
1200 | -See http://versiontools.readthedocs.org/ for more information about |
1201 | -what versiontools is and why it is useful. |
1202 | - |
1203 | -To install versiontools now please run: |
1204 | - $ pip install versiontools |
1205 | - |
1206 | -Note: versiontools works best when you have additional modules for |
1207 | -integrating with your preferred version control system. Refer to |
1208 | -the documentation for a full list of required modules.""") |
1209 | - |
1210 | - |
1211 | -# If DistributionMetadata is not a subclass of |
1212 | -# VersiontoolsEnhancedDistributionMetadata then monkey patch it. This should |
1213 | -# prevent a (odd) case of multiple imports of this module. |
1214 | -if not issubclass( |
1215 | - distutils.dist.DistributionMetadata, |
1216 | - VersiontoolsEnchancedDistributionMetadata): |
1217 | - distutils.dist.DistributionMetadata = VersiontoolsEnchancedDistributionMetadata |