summaryrefslogtreecommitdiff
path: root/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs')
-rw-r--r--setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/__init__.py8
-rw-r--r--setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/_version.py16
-rw-r--r--setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/setuptools_darcs.py79
3 files changed, 103 insertions, 0 deletions
diff --git a/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/__init__.py b/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/__init__.py
new file mode 100644
index 0000000..03549d3
--- /dev/null
+++ b/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/__init__.py
@@ -0,0 +1,8 @@
+__version__ = "unknown"
+try:
+ from _version import __version__
+except ImportError:
+ # We're running in a tree that hasn't run darcsver from the pyutil library,
+ # and didn't come with a _version.py, so we don't know what our version
+ # is. This should not happen very often.
+ pass
diff --git a/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/_version.py b/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/_version.py
new file mode 100644
index 0000000..a3a73be
--- /dev/null
+++ b/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/_version.py
@@ -0,0 +1,16 @@
+
+# This is the version of this tree, as created by setup.py darcsver from the Darcs patch
+# information: the main version number is taken from the most recent release
+# tag. If some patches have been added since the last release, this will have a
+# -NN "build number" suffix, or else a -rNN "revision number" suffix. Please see
+# pyutil.version_class for a description of what the different fields mean.
+
+verstr = "1.2.11"
+try:
+ from pyutil.version_class import Version as pyutil_Version
+ __version__ = pyutil_Version(verstr)
+except (ImportError, ValueError):
+ # Maybe there is no pyutil installed, or this may be an older version of
+ # pyutil.version_class which does not support SVN-alike revision numbers.
+ from distutils.version import LooseVersion as distutils_Version
+ __version__ = distutils_Version(verstr)
diff --git a/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/setuptools_darcs.py b/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/setuptools_darcs.py
new file mode 100644
index 0000000..30a36ce
--- /dev/null
+++ b/setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/setuptools_darcs.py
@@ -0,0 +1,79 @@
+import os, re
+
+from subprocess import Popen, PIPE
+
+THISDIR_RE=re.compile("What's new in \"(.*)\"")
+
+def exec_darcs(darcscmd):
+ cmd = ['darcs'] + darcscmd
+ try:
+ p = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
+ except EnvironmentError:
+ cmd = ['realdarcs.exe'] + darcscmd
+ p = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
+
+ output = p.communicate()[0]
+ return (p.returncode, output)
+
+def run_darcs_query_manifest():
+ return exec_darcs(['query', 'manifest'])
+
+def run_darcs_whatsnew_dot():
+ return exec_darcs(['whatsnew', '.'])
+
+def find_files_for_darcs(dirname):
+ try:
+ unused, whatsnewoutput = run_darcs_whatsnew_dot()
+ queryretcode, queryoutput = run_darcs_query_manifest()
+ except EnvironmentError:
+ if not os.path.exists('PKG-INFO'):
+ from distutils import log
+ log.warn("Unable to execute darcs -- if you are building a package with 'setup.py sdist', 'setup.py bdist_egg', or other package-building commands, then the resulting package might be missing some files. If you are not building a package then you can ignore this warning.")
+ # Oh well -- just return None.
+ return
+
+ if queryretcode != 0:
+ if not os.path.exists('PKG-INFO'):
+ from distutils import log
+ log.warn("Failure to get the list of managed files from darcs -- if you are building a package with 'setup.py sdist', 'setup.py bdist_egg', or other package-building commands, then the resulting package might be missing some files. If you are not building a package then you can ignore this warning.")
+ # Oh well -- just return None.
+ return
+
+ # We got output.
+ mo = THISDIR_RE.search(whatsnewoutput)
+ if mo:
+ curdirname = mo.group(1)
+ while curdirname.endswith('/'):
+ curdirname = curdirname[:-1]
+ curdirname += "/"
+ else:
+ curdirname = ""
+
+ # Prepend this directory.
+ rel_to_repo_dirname = curdirname + dirname
+
+ # Normalize rel_to_repo_dirname from local form to the form that setuptools uses to the form that "darcs query manifest" outputs (unix form).
+ rel_to_repo_dirname = rel_to_repo_dirname.replace('\\', '/')
+ while rel_to_repo_dirname.endswith('/'):
+ rel_to_repo_dirname = rel_to_repo_dirname[:-1]
+
+ # Append a '/' to make sure we don't match "foobar" when rel_to_repo_dirname is "foo".
+ if rel_to_repo_dirname:
+ rel_to_repo_dirname += '/'
+
+ warn = True
+ for fn in queryoutput.split('\n'):
+ if fn == ".":
+ continue
+ if fn.startswith('./'):
+ fn = fn[2:]
+ if fn.startswith(rel_to_repo_dirname):
+ fn = fn[len(rel_to_repo_dirname):]
+ warn = False
+ # We need to replace "/" by "\\" because setuptools can't includes web/*.xhtml files on Windows, due of path separator
+ # This correct ticket #1033
+ yield fn.replace('/', os.sep)
+
+ if warn and not os.path.exists('PKG-INFO'):
+ from distutils import log
+ log.warn("Didn't find any files in directory \"%s\" (full path: \"%s\") that were managed by darcs revision control -- if you are building a package with 'setup.py sdist', 'setup.py bdist_egg', or other package-building commands, then the resulting package might be missing some files. If you are not building a package then you can ignore this warning." % (dirname, os.path.abspath(rel_to_repo_dirname),))