Description: Append setuptools_hg by python setup.py build
Origin: upstream
Last-Update: 2014-01-15
Index: django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/PKG-INFO
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/PKG-INFO	2014-01-15 06:45:12.246642151 +0900
@@ -0,0 +1,82 @@
+Metadata-Version: 1.1
+Name: setuptools-hg
+Version: 0.4
+Summary: Setuptools/distribute plugin for finding files under Mercurial version control.
+Home-page: http://bitbucket.org/jezdez/setuptools_hg/
+Author: Jannis Leidel
+Author-email: jannis@leidel.info
+License: GPL2
+Description: setuptools_hg
+        =============
+        
+        setuptools_hg is a plugin for setuptools/distribute to enable it to find
+        files under the Mercurial version control system.
+        
+        It uses the Mercurial Python library by default and falls back to use the
+        command line programm `hg(1)`_. That's especially useful inside virtualenvs
+        that don't have access to the system wide installed Mercurial lib (e.g. when
+        created with ``--no-site-packages``).
+        
+        .. note:: The setuptools feature
+        
+          You can read about the hooks used by setuptool_hg in the setuptools_ or
+          distribute_ documentation. It basically returns a list of files that are
+          under Mercurial version control when running the ``setup`` function, e.g. if
+          you create a source and binary distribution. It's a simple yet effective way
+          of not having to define package data (non-Python files) manually in MANIFEST
+          templates (``MANIFEST.in``).
+        
+        .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools#adding-support-for-other-revision-control-systems
+        .. _distribute: http://packages.python.org/distribute/setuptools.html#adding-support-for-other-revision-control-systems
+        .. _`hg(1)`: http://www.selenic.com/mercurial/hg.1.html
+        
+        Usage
+        *****
+        
+        Here's an example of a setup.py that uses setuptools_hg::
+        
+            from setuptools import setup, find_packages
+        
+            setup(
+                name="HelloWorld",
+                version="0.1",
+                packages=find_packages(),
+                setup_requires=["setuptools_hg"],
+            )
+        
+        If you run this setup.py setuptools will automatically download setuptools_hg
+        to the directory where the setup.py is located at (and won't install it
+        anywhere else) to get all package data files from the Mercurial repository.
+        
+        Options
+        *******
+        
+        Set the ``HG_SETUPTOOLS_FORCE_CMD`` environment variable before running
+        setup.py if you want to enforce the use of the hg command.
+        """
+        
+        CHANGES
+        *******
+        
+        0.4
+        ---
+        
+        - fix a bug if the current distribution is not versionned with mercurial. [kiorky]
+        - fix https://bitbucket.org/jezdez/setuptools_hg/issue/5/using-hg-command-line-with-py3-does-not [kiorky]
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.4
+Classifier: Programming Language :: Python :: 2.5
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.1
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Intended Audience :: Developers
+Classifier: Operating System :: OS Independent
+Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: Topic :: Software Development :: Version Control
+Classifier: Framework :: Setuptools Plugin
Index: django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/SOURCES.txt
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/SOURCES.txt	2014-01-15 06:45:12.246642151 +0900
@@ -0,0 +1,12 @@
+.hgignore
+.hgtags
+LICENSE
+README.rst
+setup.cfg
+setup.py
+setuptools_hg.py
+setuptools_hg.egg-info/PKG-INFO
+setuptools_hg.egg-info/SOURCES.txt
+setuptools_hg.egg-info/dependency_links.txt
+setuptools_hg.egg-info/entry_points.txt
+setuptools_hg.egg-info/top_level.txt
\ No newline at end of file
Index: django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/dependency_links.txt
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/dependency_links.txt	2014-01-15 06:45:12.246642151 +0900
@@ -0,0 +1 @@
+
Index: django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/entry_points.txt
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/entry_points.txt	2014-01-15 06:45:12.246642151 +0900
@@ -0,0 +1,3 @@
+[setuptools.file_finders]
+hg = setuptools_hg:hg_file_finder
+
Index: django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/top_level.txt
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/top_level.txt	2014-01-15 06:45:12.246642151 +0900
@@ -0,0 +1 @@
+setuptools_hg
Index: django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/zip-safe
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/EGG-INFO/zip-safe	2014-01-15 06:45:12.246642151 +0900
@@ -0,0 +1 @@
+
Index: django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/setuptools_hg.py
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ django-oauth-plus-2.2.3/setuptools_hg-0.4-py2.7.egg/setuptools_hg.py	2014-01-15 06:45:12.246642151 +0900
@@ -0,0 +1,134 @@
+"""
+A plugin for setuptools to find files under the Mercurial version control
+system which uses the Python library by default and falls back to use the
+command line programm hg(1).
+"""
+__version__ = '0.4'
+__author__ = 'Jannis Leidel'
+__all__ = ['hg_file_finder']
+
+import os
+import subprocess
+import sys
+
+try:
+    from mercurial.__version__ import version
+    from mercurial import hg, ui, cmdutil
+except:
+    hg = None
+
+try:
+    from mercurial.repo import RepoError
+except:
+    try:
+        from mercurial.error import RepoError
+    except:
+        pass
+
+try:
+    from distutils import log
+except ImportError:
+    log = None
+
+OLD_VERSIONS = ('1.0', '1.0.1', '1.0.2')
+
+PY3 = sys.version[0] == "3"
+
+if os.environ.get('HG_SETUPTOOLS_FORCE_CMD', False):
+    hg = None
+
+
+def find_files_with_cmd(dirname="."):
+    """
+    Use the hg command to recursively find versioned files in dirname.
+    """
+    try:
+        mydir = os.path.abspath(dirname)
+        if not os.path.exists(os.path.join(mydir, '.hg')):
+            raise Exception('not a mercurial repo')
+        proc = subprocess.Popen(['hg', 'locate', '-I', mydir],
+                                stdin=subprocess.PIPE,
+                                stderr=subprocess.PIPE,
+                                stdout=subprocess.PIPE,
+                                cwd=dirname)
+        stdout, stderr = proc.communicate()
+    except:
+        # Let's behave a bit nicer and return nothing if something fails.
+        return []
+    if not PY3:
+        output = stdout.splitlines()
+    else:
+        output = (x.decode('utf-8') for x in stdout.splitlines())
+    return output
+
+
+def find_files_with_lib(dirname):
+    """
+    Use the Mercurial library to recursively find versioned files in dirname.
+    """
+    try:
+        try:
+            repo = hg.repository(ui.ui(), path=dirname)
+        except RepoError:
+            return
+        # tuple of (modified, added, removed, deleted, unknown, ignored, clean)
+        modified, added, removed, deleted, unknown = repo.status()[:5]
+
+        # exclude all files that hg knows about, but haven't been added,
+        # or have been deleted, removed, or have an unknown status
+        excluded = removed + deleted + unknown
+
+        if version in OLD_VERSIONS:
+            from mercurial import util
+            node = None
+            for src, abs, rel, exact in cmdutil.walk(repo, [], {}, node=node,
+                                    badmatch=util.always, default='relglob'):
+                if src == 'b':
+                    continue
+                if not node and abs not in repo.dirstate:
+                    continue
+                if abs in excluded:
+                    continue
+                yield abs
+        else:
+            rev = None
+            try:
+                match = cmdutil.match(repo, [], {}, default='relglob')
+            except:
+                # Probably mercurial 1.8+
+                from mercurial import scmutil
+                match = scmutil.match(repo[None], [], {}, default='relglob')
+
+            match.bad = lambda x, y: False
+            for abs in repo[rev].walk(match):
+                if not rev and abs not in repo.dirstate:
+                    continue
+                if abs in excluded:
+                    continue
+                yield abs
+    except Exception:
+        if log:
+            log.warn("Error in setuptools_hg: %s" % sys.exc_info()[1])
+        # try calling hg command as a last resort
+        find_files_with_cmd(dirname)
+
+
+def hg_file_finder(dirname="."):
+    """
+    Find the files in ``dirname`` under Mercurial version control.
+    """
+    if not dirname:
+        dirname = "."
+    if hg is None:
+        return find_files_with_cmd(dirname)
+    return find_files_with_lib(dirname)
+
+
+if __name__ == "__main__":
+    from pprint import pprint
+
+    if len(sys.argv) != 2:
+        print("USAGE: %s DIRNAME" % sys.argv[0])
+        sys.exit(1)
+
+    pprint(hg_file_finder(sys.argv[1]))
