[Python-modules-commits] [fakesleep] 01/03: New upstream version 16.10.1

Free Ekanayaka freee at moszumanska.debian.org
Mon Oct 31 12:02:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

freee pushed a commit to branch patch-queue/master
in repository fakesleep.

commit b4f878523a8242d2dc4f44a09ab5128eb0f64ba3
Author: Free Ekanayaka <freee at debian.org>
Date:   Mon Oct 31 09:30:16 2016 +0000

    New upstream version 16.10.1
---
 .coveragerc                                   |  10 +
 LICENSE                                       |  74 +++
 MANIFEST.in                                   |  15 +
 NEWS.rst                                      |  51 ++
 PKG-INFO                                      |  73 +++
 README.rst                                    |  54 ++
 setup.cfg                                     |   8 +
 setup.py                                      |  48 ++
 src/incremental.egg-info/PKG-INFO             |  73 +++
 src/incremental.egg-info/SOURCES.txt          |  22 +
 src/incremental.egg-info/dependency_links.txt |   1 +
 src/incremental.egg-info/entry_points.txt     |   4 +
 src/incremental.egg-info/not-zip-safe         |   1 +
 src/incremental.egg-info/requires.txt         |   4 +
 src/incremental.egg-info/top_level.txt        |   1 +
 src/incremental/__init__.py                   | 550 ++++++++++++++++++++
 src/incremental/_version.py                   |  11 +
 src/incremental/tests/__init__.py             |   0
 src/incremental/tests/test_update.py          | 715 ++++++++++++++++++++++++++
 src/incremental/tests/test_version.py         | 615 ++++++++++++++++++++++
 src/incremental/update.py                     | 209 ++++++++
 towncrier.ini                                 |   4 +
 tox.ini                                       |  33 ++
 23 files changed, 2576 insertions(+)

diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..996d619
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,10 @@
+[run]
+source =
+       incremental
+branch = True
+
+[paths]
+source =
+   src/
+   .tox/*/lib/python*/site-packages/
+   .tox/pypy*/site-packages/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..bc9d47f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,74 @@
+Incremental
+-----------
+
+This project includes code from the Twisted Project, which is licensed as below.
+
+Copyright (c) 2001-2015
+Allen Short
+Amber Hawkie Brown
+Andrew Bennetts
+Andy Gayton
+Antoine Pitrou
+Apple Computer, Inc.
+Ashwini Oruganti
+Benjamin Bruheim
+Bob Ippolito
+Canonical Limited
+Christopher Armstrong
+David Reid
+Divmod Inc.
+Donovan Preston
+Eric Mangold
+Eyal Lotem
+Google Inc.
+Hybrid Logic Ltd.
+Hynek Schlawack
+Itamar Turner-Trauring
+James Knight
+Jason A. Mobarak
+Jean-Paul Calderone
+Jessica McKellar
+Jonathan D. Simms
+Jonathan Jacobs
+Jonathan Lange
+Julian Berman
+Jürgen Hermann
+Kevin Horn
+Kevin Turner
+Laurens Van Houtven
+Mary Gardiner
+Massachusetts Institute of Technology
+Matthew Lefkowitz
+Moshe Zadka
+Paul Swartz
+Pavel Pergamenshchik
+Rackspace, US Inc.
+Ralph Meijer
+Richard Wall
+Sean Riley
+Software Freedom Conservancy
+Tavendo GmbH
+Thijs Triemstra
+Thomas Herve
+Timothy Allen
+Tom Prince
+Travis B. Hartwell
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..e29af2d
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,15 @@
+include .coveragerc
+include LICENSE
+include NEWS.rst
+include towncrier.ini
+include tox.ini
+
+recursive-include src/incremental *.py
+
+prune .travis
+prune tests
+
+exclude examplesetup.py
+prune src/exampleproj
+
+prune src/incremental/newsfragments
diff --git a/NEWS.rst b/NEWS.rst
new file mode 100644
index 0000000..5968808
--- /dev/null
+++ b/NEWS.rst
@@ -0,0 +1,51 @@
+Incremental 16.10.1 (2016-10-20)
+================================
+
+Bugfixes
+--------
+
+- Comparisons of Versions now compare the lowercased forms of both
+  version packages, rather than being case sensitive. (#23)
+
+
+Incremental 16.10.0 (2016-10-10)
+================================
+
+Bugfixes
+--------
+
+- incremental.update now adds a docstring to the autogenerated file.
+  (#18)
+
+Misc
+----
+
+- #20
+
+
+Incremental 16.9.1 (2016-09-21)
+===============================
+
+Bugfixes
+--------
+
+- python -m incremental.update <package> --dev now starts a dev-less
+  package at 0, not 1. (#15)
+
+
+Incremental 16.9.0 (2016-09-18)
+===============================
+
+Features
+--------
+
+- Incremental now uses 'rcX' instead of 'pre' for prereleases/release
+  candidates, to match PEP440. (#4)
+- If you reference "<yourproject> NEXT" and use `python -m
+  incremental.update`, it will automatically be updated to the next
+  release version number. (#7)
+
+Misc
+----
+
+- #1, #10
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..a6ad25b
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,73 @@
+Metadata-Version: 1.1
+Name: incremental
+Version: 16.10.1
+Summary: UNKNOWN
+Home-page: https://github.com/hawkowl/incremental
+Author: Amber Brown
+Author-email: hawkowl at twistedmatrix.com
+License: MIT
+Description: Incremental
+        ===========
+        
+        |travis|
+        |pypi|
+        |coverage|
+        
+        Incremental is a small library that versions your Python projects.
+        
+        API documentation can be found `here <https://hawkowl.github.io/incremental/docs/>`_.
+        
+        
+        Quick Start
+        -----------
+        
+        Add this to your ``setup.py``\ 's ``setup()`` call:
+        
+        .. code::
+        
+           setup(
+               use_incremental=True,
+               setup_requires=['incremental'],
+               install_requires=['incremental'], # along with any other install dependencies
+               ...
+           }
+        
+        
+        Then in your project add a ``_version.py`` that contains:
+        
+        .. code::
+        
+           from incremental import Version
+        
+           __version__ = Version("widgetbox", 1, 2, 3)
+           __all__ = ["__version__"]
+        
+        
+        Then, so users of your project can find your version, in your project's ``__init__.py`` add:
+        
+        .. code::
+        
+           from ._version import __version__
+        
+        
+        Subsequent installations of your project will use incremental for versioning.
+        
+        .. |coverage| image:: https://codecov.io/github/hawkowl/incremental/coverage.svg?branch=master
+        .. _coverage: https://codecov.io/github/hawkowl/incremental
+        
+        .. |travis| image:: https://travis-ci.org/hawkowl/incremental.svg?branch=master
+        .. _travis: http://travis-ci.org/hawkowl/incremental
+        
+        .. |pypi| image:: http://img.shields.io/pypi/v/incremental.svg
+        .. _pypi: https://pypi.python.org/pypi/incremental
+        
+Platform: UNKNOWN
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..38ee993
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,54 @@
+Incremental
+===========
+
+|travis|
+|pypi|
+|coverage|
+
+Incremental is a small library that versions your Python projects.
+
+API documentation can be found `here <https://hawkowl.github.io/incremental/docs/>`_.
+
+
+Quick Start
+-----------
+
+Add this to your ``setup.py``\ 's ``setup()`` call:
+
+.. code::
+
+   setup(
+       use_incremental=True,
+       setup_requires=['incremental'],
+       install_requires=['incremental'], # along with any other install dependencies
+       ...
+   }
+
+
+Then in your project add a ``_version.py`` that contains:
+
+.. code::
+
+   from incremental import Version
+
+   __version__ = Version("widgetbox", 1, 2, 3)
+   __all__ = ["__version__"]
+
+
+Then, so users of your project can find your version, in your project's ``__init__.py`` add:
+
+.. code::
+
+   from ._version import __version__
+
+
+Subsequent installations of your project will use incremental for versioning.
+
+.. |coverage| image:: https://codecov.io/github/hawkowl/incremental/coverage.svg?branch=master
+.. _coverage: https://codecov.io/github/hawkowl/incremental
+
+.. |travis| image:: https://travis-ci.org/hawkowl/incremental.svg?branch=master
+.. _travis: http://travis-ci.org/hawkowl/incremental
+
+.. |pypi| image:: http://img.shields.io/pypi/v/incremental.svg
+.. _pypi: https://pypi.python.org/pypi/incremental
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..6c71b61
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,8 @@
+[wheel]
+universal = 1
+
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..d1d9e04
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+from __future__ import absolute_import, division, print_function
+
+import os, sys
+
+from setuptools import setup, find_packages
+
+base_dir = os.path.dirname(__file__)
+src_dir = os.path.join(base_dir, "src")
+
+# We need to import outselves
+sys.path.insert(0, src_dir)
+
+import incremental
+
+setup(
+    name='incremental',
+    version=incremental.__version__.base(),
+    maintainer='Amber Brown',
+    maintainer_email='hawkowl at twistedmatrix.com',
+    url="https://github.com/hawkowl/incremental",
+    classifiers = [
+        "Intended Audience :: Developers",
+        "License :: OSI Approved :: MIT License",
+        "Programming Language :: Python :: 2",
+        "Programming Language :: Python :: 2.6",
+        "Programming Language :: Python :: 2.7",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.3",
+        "Programming Language :: Python :: 3.4",
+        "Programming Language :: Python :: 3.5",
+    ],
+    packages=find_packages("src", exclude=("exampleproj",)),
+    package_dir={"": "src"},
+    extras_require={
+        "scripts": [
+            "click>=6.0", "twisted>=16.4.0"
+        ]
+    },
+    license="MIT",
+    zip_safe=False,
+    long_description=open('README.rst').read(),
+    entry_points="""
+    [distutils.setup_keywords]
+    use_incremental = incremental:_get_version
+    """,
+)
diff --git a/src/incremental.egg-info/PKG-INFO b/src/incremental.egg-info/PKG-INFO
new file mode 100644
index 0000000..a6ad25b
--- /dev/null
+++ b/src/incremental.egg-info/PKG-INFO
@@ -0,0 +1,73 @@
+Metadata-Version: 1.1
+Name: incremental
+Version: 16.10.1
+Summary: UNKNOWN
+Home-page: https://github.com/hawkowl/incremental
+Author: Amber Brown
+Author-email: hawkowl at twistedmatrix.com
+License: MIT
+Description: Incremental
+        ===========
+        
+        |travis|
+        |pypi|
+        |coverage|
+        
+        Incremental is a small library that versions your Python projects.
+        
+        API documentation can be found `here <https://hawkowl.github.io/incremental/docs/>`_.
+        
+        
+        Quick Start
+        -----------
+        
+        Add this to your ``setup.py``\ 's ``setup()`` call:
+        
+        .. code::
+        
+           setup(
+               use_incremental=True,
+               setup_requires=['incremental'],
+               install_requires=['incremental'], # along with any other install dependencies
+               ...
+           }
+        
+        
+        Then in your project add a ``_version.py`` that contains:
+        
+        .. code::
+        
+           from incremental import Version
+        
+           __version__ = Version("widgetbox", 1, 2, 3)
+           __all__ = ["__version__"]
+        
+        
+        Then, so users of your project can find your version, in your project's ``__init__.py`` add:
+        
+        .. code::
+        
+           from ._version import __version__
+        
+        
+        Subsequent installations of your project will use incremental for versioning.
+        
+        .. |coverage| image:: https://codecov.io/github/hawkowl/incremental/coverage.svg?branch=master
+        .. _coverage: https://codecov.io/github/hawkowl/incremental
+        
+        .. |travis| image:: https://travis-ci.org/hawkowl/incremental.svg?branch=master
+        .. _travis: http://travis-ci.org/hawkowl/incremental
+        
+        .. |pypi| image:: http://img.shields.io/pypi/v/incremental.svg
+        .. _pypi: https://pypi.python.org/pypi/incremental
+        
+Platform: UNKNOWN
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
diff --git a/src/incremental.egg-info/SOURCES.txt b/src/incremental.egg-info/SOURCES.txt
new file mode 100644
index 0000000..44917fb
--- /dev/null
+++ b/src/incremental.egg-info/SOURCES.txt
@@ -0,0 +1,22 @@
+.coveragerc
+LICENSE
+MANIFEST.in
+NEWS.rst
+README.rst
+setup.cfg
+setup.py
+towncrier.ini
+tox.ini
+src/incremental/__init__.py
+src/incremental/_version.py
+src/incremental/update.py
+src/incremental.egg-info/PKG-INFO
+src/incremental.egg-info/SOURCES.txt
+src/incremental.egg-info/dependency_links.txt
+src/incremental.egg-info/entry_points.txt
+src/incremental.egg-info/not-zip-safe
+src/incremental.egg-info/requires.txt
+src/incremental.egg-info/top_level.txt
+src/incremental/tests/__init__.py
+src/incremental/tests/test_update.py
+src/incremental/tests/test_version.py
\ No newline at end of file
diff --git a/src/incremental.egg-info/dependency_links.txt b/src/incremental.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/incremental.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/src/incremental.egg-info/entry_points.txt b/src/incremental.egg-info/entry_points.txt
new file mode 100644
index 0000000..e6da5d0
--- /dev/null
+++ b/src/incremental.egg-info/entry_points.txt
@@ -0,0 +1,4 @@
+
+    [distutils.setup_keywords]
+    use_incremental = incremental:_get_version
+    
\ No newline at end of file
diff --git a/src/incremental.egg-info/not-zip-safe b/src/incremental.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/incremental.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/src/incremental.egg-info/requires.txt b/src/incremental.egg-info/requires.txt
new file mode 100644
index 0000000..c246192
--- /dev/null
+++ b/src/incremental.egg-info/requires.txt
@@ -0,0 +1,4 @@
+
+[scripts]
+click>=6.0
+twisted>=16.4.0
diff --git a/src/incremental.egg-info/top_level.txt b/src/incremental.egg-info/top_level.txt
new file mode 100644
index 0000000..cb40239
--- /dev/null
+++ b/src/incremental.egg-info/top_level.txt
@@ -0,0 +1 @@
+incremental
diff --git a/src/incremental/__init__.py b/src/incremental/__init__.py
new file mode 100644
index 0000000..88bf0d8
--- /dev/null
+++ b/src/incremental/__init__.py
@@ -0,0 +1,550 @@
+# Copyright (c) Twisted Matrix Laboratories.
+# See LICENSE for details.
+
+"""
+Versions for Python packages.
+
+See L{Version}.
+"""
+
+from __future__ import division, absolute_import
+
+import os
+import sys
+import warnings
+
+#
+# Compat functions
+#
+
+if sys.version_info < (3, 0):
+    _PY3 = False
+else:
+    _PY3 = True
+    unicode = str
+
+
+def _nativeString(s):
+    """
+    Convert C{bytes} or C{unicode} to the native C{str} type, using ASCII
+    encoding if conversion is necessary.
+
+    @raise UnicodeError: The input string is not ASCII encodable/decodable.
+    @raise TypeError: The input is neither C{bytes} nor C{unicode}.
+    """
+    if not isinstance(s, (bytes, unicode)):
+        raise TypeError("%r is neither bytes nor unicode" % s)
+    if _PY3:
+        if isinstance(s, bytes):
+            return s.decode("ascii")
+        else:
+            # Ensure we're limited to ASCII subset:
+            s.encode("ascii")
+    else:
+        if isinstance(s, unicode):
+            return s.encode("ascii")
+        else:
+            # Ensure we're limited to ASCII subset:
+            s.decode("ascii")
+    return s
+
+
+try:
+    _cmp = cmp
+except NameError:
+    def _cmp(a, b):
+        """
+        Compare two objects.
+
+        Returns a negative number if C{a < b}, zero if they are equal, and a
+        positive number if C{a > b}.
+        """
+        if a < b:
+            return -1
+        elif a == b:
+            return 0
+        else:
+            return 1
+
+
+def _comparable(klass):
+    """
+    Class decorator that ensures support for the special C{__cmp__} method.
+
+    On Python 2 this does nothing.
+
+    On Python 3, C{__eq__}, C{__lt__}, etc. methods are added to the class,
+    relying on C{__cmp__} to implement their comparisons.
+    """
+    # On Python 2, __cmp__ will just work, so no need to add extra methods:
+    if not _PY3:
+        return klass
+
+    def __eq__(self, other):
+        c = self.__cmp__(other)
+        if c is NotImplemented:
+            return c
+        return c == 0
+
+    def __ne__(self, other):
+        c = self.__cmp__(other)
+        if c is NotImplemented:
+            return c
+        return c != 0
+
+    def __lt__(self, other):
+        c = self.__cmp__(other)
+        if c is NotImplemented:
+            return c
+        return c < 0
+
+    def __le__(self, other):
+        c = self.__cmp__(other)
+        if c is NotImplemented:
+            return c
+        return c <= 0
+
+    def __gt__(self, other):
+        c = self.__cmp__(other)
+        if c is NotImplemented:
+            return c
+        return c > 0
+
+    def __ge__(self, other):
+        c = self.__cmp__(other)
+        if c is NotImplemented:
+            return c
+        return c >= 0
+
+    klass.__lt__ = __lt__
+    klass.__gt__ = __gt__
+    klass.__le__ = __le__
+    klass.__ge__ = __ge__
+    klass.__eq__ = __eq__
+    klass.__ne__ = __ne__
+    return klass
+
+#
+# Versioning
+#
+
+
+ at _comparable
+class _inf(object):
+    """
+    An object that is bigger than all other objects.
+    """
+    def __cmp__(self, other):
+        """
+        @param other: Another object.
+        @type other: any
+
+        @return: 0 if other is inf, 1 otherwise.
+        @rtype: C{int}
+        """
+        if other is _inf:
+            return 0
+        return 1
+
+_inf = _inf()
+
+
+class IncomparableVersions(TypeError):
+    """
+    Two versions could not be compared.
+    """
+
+
+ at _comparable
+class Version(object):
+    """
+    An encapsulation of a version for a project, with support for outputting
+    PEP-440 compatible version strings.
+
+    This class supports the standard major.minor.micro[rcN] scheme of
+    versioning, with support for "local versions" which may include a SVN
+    revision or Git SHA1 hash.
+    """
+    def __init__(self, package, major, minor, micro, release_candidate=None,
+                 prerelease=None, dev=None):
+        """
+        @param package: Name of the package that this is a version of.
+        @type package: C{str}
+        @param major: The major version number.
+        @type major: C{int} or C{str} (for the "NEXT" symbol)
+        @param minor: The minor version number.
+        @type minor: C{int}
+        @param micro: The micro version number.
+        @type micro: C{int}
+        @param release_candidate: The release candidate number.
+        @type release_candidate: C{int}
+        @param prerelease: The prerelease number. (Deprecated)
+        @type prerelease: C{int}
+        @param dev: The development release number.
+        @type dev: C{int}
+        """
+        if release_candidate and prerelease:
+            raise ValueError("Please only return one of these.")
+        elif prerelease and not release_candidate:
+            release_candidate = prerelease
+            warnings.warn(("Passing prerelease to incremental.Version was "
+                           "deprecated in Incremental 16.9.0. Please pass "
+                           "release_candidate instead."),
+                          DeprecationWarning, stacklevel=2)
+
+        if major == "NEXT":
+            if minor or micro or release_candidate or dev:
+                raise ValueError(("When using NEXT, all other values except "
+                                  "Package must be 0."))
+
+        self.package = package
+        self.major = major
+        self.minor = minor
+        self.micro = micro
+        self.release_candidate = release_candidate
+        self.dev = dev
+
+    @property
+    def prerelease(self):
+        warnings.warn(("Accessing incremental.Version.prerelease was "
+                       "deprecated in Incremental 16.9.0. Use "
+                       "Version.release_candidate instead."),
+                      DeprecationWarning, stacklevel=2),
+        return self.release_candidate
+
+    def short(self):
+        """
+        Return a string in canonical short version format,
+        <major>.<minor>.<micro>[+rSVNVer/+gitsha1].
+        """
+        s = self.base()
+        gitver = self._getGitVersion()
+
+        if not gitver:
+            svnver = self._getSVNVersion()
+            if svnver:
+                s += '+r' + _nativeString(svnver)
+        else:
+            s += '+' + gitver
+        return s
+
+    def local(self):
+        """
+        Return a PEP440-compatible "local" representation of this L{Version}.
+
+        This includes a SVN revision or Git commit SHA1 hash, if available.
+
+        Examples:
+
+          - 14.4.0+r1223
+          - 1.2.3rc1+rb2e812003b5d5fcf08efd1dffed6afa98d44ac8c
+          - 12.10.1
+          - 3.4.8rc2
+          - 11.93.0rc1dev3
+        """
+        return self.short()
+
+    def public(self):
+        """
+        Return a PEP440-compatible "public" representation of this L{Version}.
+
+        Examples:
+
+          - 14.4.0
+          - 1.2.3rc1
+          - 14.2.1rc1dev9
+          - 16.04.0dev0
+        """
+        return self.base()
+
+    def base(self):
+        """
+        Like L{short}, but without the +rSVNVer or @gitsha1.
+        """
+        if self.major == "NEXT":
+            return self.major
+
+        if self.release_candidate is None:
+            rc = ""
+        else:
+            rc = "rc%s" % (self.release_candidate,)
+
+        if self.dev is None:
+            dev = ""
+        else:
+            dev = "dev%s" % (self.dev,)
+
+        return '%r.%d.%d%s%s' % (self.major,
+                                 self.minor,
+                                 self.micro,
+                                 rc, dev)
+
+    def __repr__(self):
+        # Git repr
+        gitver = self._formatGitVersion()
+        if gitver:
+            gitver = '  #' + gitver
+
+        # SVN repr
+        svnver = self._formatSVNVersion()
+        if svnver:
+            svnver = '  #' + svnver
+
+        if self.release_candidate is None:
+            release_candidate = ""
+        else:
+            release_candidate = ", release_candidate=%r" % (
+                self.release_candidate,)
+
+        if self.dev is None:
+            dev = ""
+        else:
+            dev = ", dev=%r" % (self.dev,)
+
+        return '%s(%r, %r, %d, %d%s%s)%s' % (
+            self.__class__.__name__,
+            self.package,
+            self.major,
+            self.minor,
+            self.micro,
+            release_candidate,
+            dev,
+            gitver or svnver)
+
+    def __str__(self):
+        return '[%s, version %s]' % (
+            self.package,
+            self.short())
+
+    def __cmp__(self, other):
+        """
+        Compare two versions, considering major versions, minor versions, micro
+        versions, then release candidates. Package names are case insensitive.
+
+        A version with a release candidate is always less than a version
+        without a release candidate. If both versions have release candidates,
+        they will be included in the comparison.
+
+        @param other: Another version.
+        @type other: L{Version}
+
+        @return: NotImplemented when the other object is not a Version, or one
+            of -1, 0, or 1.
+
+        @raise IncomparableVersions: when the package names of the versions
+            differ.
+        """
+        if not isinstance(other, self.__class__):
+            return NotImplemented
+        if self.package.lower() != other.package.lower():
+            raise IncomparableVersions("%r != %r"
+                                       % (self.package, other.package))
+
+        if self.major == "NEXT":
+            major = _inf
+        else:
+            major = self.major
+
+        if self.release_candidate is None:
+            release_candidate = _inf
+        else:
+            release_candidate = self.release_candidate
+
+        if self.dev is None:
+            dev = _inf
+        else:
+            dev = self.dev
+
+        if other.major == "NEXT":
+            othermajor = _inf
+        else:
+            othermajor = other.major
+
+        if other.release_candidate is None:
+            otherrc = _inf
+        else:
+            otherrc = other.release_candidate
+
+        if other.dev is None:
+            otherdev = _inf
+        else:
+            otherdev = other.dev
+
+        x = _cmp((major,
+                  self.minor,
+                  self.micro,
+                  release_candidate,
+                  dev),
+                 (othermajor,
+                  other.minor,
+                  other.micro,
+                  otherrc,
+                  otherdev))
+        return x
+
+    def _parseGitDir(self, directory):
+
+        headFile = os.path.abspath(os.path.join(directory, 'HEAD'))
+
+        with open(headFile, "r") as f:
+            headContent = f.read().strip()
+
+        if headContent.startswith("ref: "):
+            with open(os.path.abspath(
+                    os.path.join(directory,
+                                 headContent.split(" ")[1]))) as f:
+                commit = f.read()
+                return commit.strip()
+
+        return headContent
+
+    def _getGitVersion(self):
+        """
+        Given a package directory, walk up and find the git commit sha.
+        """
+        mod = sys.modules.get(self.package)
+        if mod:
+            basepath = os.path.dirname(mod.__file__)
+
+            upOne = os.path.abspath(os.path.join(basepath, '..'))
+
+            if ".git" in os.listdir(upOne):
+                return self._parseGitDir(os.path.join(upOne, '.git'))
+
+            while True:
+
+                upOneMore = os.path.abspath(os.path.join(upOne, '..'))
+
+                if upOneMore == upOne:
+                    return None
+
+                if ".git" in os.listdir(upOneMore):
+                    return self._parseGitDir(os.path.join(upOneMore, '.git'))
+
+                upOne = upOneMore
+
+    def _parseSVNEntries_4(self, entriesFile):
+        """
+        Given a readable file object which represents a .svn/entries file in
+        format version 4, return the revision as a string.  We do this by
+        reading first XML element in the document that has a 'revision'
+        attribute.
+        """
... 1744 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/fakesleep.git



More information about the Python-modules-commits mailing list