aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsetuptools/command/easy_install.py2
-rwxr-xr-xsetuptools/command/sdist.py82
-rw-r--r--setuptools/dist.py4
3 files changed, 85 insertions, 3 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 62b5cd70..9d61bb29 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -354,7 +354,7 @@ class easy_install(Command):
"#!%(executable)s%(options)s\n"
"# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r\n"
"import pkg_resources\n"
- "pkg_resources.run_main(%(spec)r, %(script_name)r)\n"
+ "pkg_resources.run_script(%(spec)r, %(script_name)r)\n"
) % locals()
if not self.dry_run:
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
new file mode 100755
index 00000000..b39df36f
--- /dev/null
+++ b/setuptools/command/sdist.py
@@ -0,0 +1,82 @@
+from distutils.command.sdist import sdist as _sdist
+from distutils.util import convert_path
+import os,re
+
+entities = [
+ ("&lt;","<"), ("&gt;", ">"), ("&quot;", '"'), ("&apos;", "'"),
+ ("&amp;", "&")
+]
+def unescape(data):
+ for old,new in entities:
+ data = data.replace(old,new)
+ return data
+
+patterns = [
+ (convert_path('CVS/Entries'), re.compile(r"^\w?/([^/]+)/", re.M), None),
+ (convert_path('.svn/entries'), re.compile(r'name="([^"]+)"'), unescape),
+]
+
+def joinpath(prefix,suffix):
+ if not prefix:
+ return suffix
+ return os.path.join(prefix,suffix)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+def walk_revctrl(dirname='', memo=None):
+ """Find all files under revision control"""
+ if memo is None:
+ memo = {}
+ if dirname in memo:
+ # Don't rescan a scanned directory
+ return
+ for path, pattern, postproc in patterns:
+ path = joinpath(dirname,path)
+ if os.path.isfile(path):
+ f = open(path,'rU')
+ data = f.read()
+ f.close()
+ for match in pattern.finditer(data):
+ path = match.group(1)
+ if postproc:
+ path = postproc(path)
+ path = joinpath(dirname,path)
+ if os.path.isfile(path):
+ yield path
+ elif os.path.isdir(path):
+ for item in walk_revctrl(path, memo):
+ yield item
+
+class sdist(_sdist):
+ """Smart sdist that finds anything supported by revision control"""
+ def finalize_options(self):
+ _sdist.finalize_options(self)
+ if not os.path.isfile(self.template):
+ self.force_manifest = 1 # always regen if no template
+
+ def add_defaults(self):
+ _sdist.add_defaults(self)
+ self.filelist.extend(walk_revctrl())
+
+
+
+
+
+
+
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 590ea165..fc0f3eba 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -5,6 +5,7 @@ from distutils.core import Extension
from setuptools.depends import Require
from setuptools.command.build_ext import build_ext
from setuptools.command.install import install
+from setuptools.command.sdist import sdist
from setuptools.command.install_lib import install_lib
from distutils.errors import DistutilsOptionError, DistutilsPlatformError
from distutils.errors import DistutilsSetupError
@@ -79,7 +80,6 @@ class Distribution(_Distribution):
distribution for the included and excluded features.
"""
-
def __init__ (self, attrs=None):
have_package_data = hasattr(self, "package_data")
if not have_package_data:
@@ -98,7 +98,7 @@ class Distribution(_Distribution):
self.cmdclass.setdefault('build_ext',build_ext)
self.cmdclass.setdefault('install',install)
self.cmdclass.setdefault('install_lib',install_lib)
-
+ self.cmdclass.setdefault('sdist',sdist)