aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-12-14 17:37:30 +0000
committerPJ Eby <distutils-sig@python.org>2005-12-14 17:37:30 +0000
commitc7eeb6273fd7593d7bccfbe41f44b5aa2ab17c1d (patch)
tree28394eca5cf8e0f5745ea2fd4eacdfe00743a906 /setuptools/command
parentbd28408ff49d304ae822acf9f46f0b65bb138c04 (diff)
downloadexternal_python_setuptools-c7eeb6273fd7593d7bccfbe41f44b5aa2ab17c1d.tar.gz
external_python_setuptools-c7eeb6273fd7593d7bccfbe41f44b5aa2ab17c1d.tar.bz2
external_python_setuptools-c7eeb6273fd7593d7bccfbe41f44b5aa2ab17c1d.zip
Added an internal ``install_egg_info`` command to use as part of old-style
``install`` operations, that installs an ``.egg-info`` directory with the package. This is a preliminary step to implementing "install --single-version-externally-managed" for use with bdist_* commands and Debian. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041670
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/__init__.py2
-rw-r--r--setuptools/command/install.py6
-rwxr-xr-xsetuptools/command/install_egg_info.py82
3 files changed, 86 insertions, 4 deletions
diff --git a/setuptools/command/__init__.py b/setuptools/command/__init__.py
index 7294d55c..3b4024b8 100644
--- a/setuptools/command/__init__.py
+++ b/setuptools/command/__init__.py
@@ -1,7 +1,7 @@
__all__ = [
'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop',
'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts',
- 'sdist', 'setopt', 'test', 'upload',
+ 'sdist', 'setopt', 'test', 'upload', 'install_egg_info',
]
diff --git a/setuptools/command/install.py b/setuptools/command/install.py
index 6a34ab54..51d4ffe0 100644
--- a/setuptools/command/install.py
+++ b/setuptools/command/install.py
@@ -50,9 +50,9 @@ class install(_install):
cmd.run()
setuptools.bootstrap_install_from = None
-
-
-
+ sub_commands = _install.sub_commands + [
+ ('install_egg_info', lambda self: True),
+ ]
diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py
new file mode 100755
index 00000000..14f9755f
--- /dev/null
+++ b/setuptools/command/install_egg_info.py
@@ -0,0 +1,82 @@
+from setuptools import Command
+from setuptools.archive_util import unpack_archive
+from distutils import log, dir_util
+import os, shutil, pkg_resources
+
+class install_egg_info(Command):
+ """Install an .egg-info directory for the package"""
+
+ description = "Install an .egg-info directory for the package"
+
+ user_options = [
+ ('install-dir=', 'd', "directory to install to"),
+ ]
+
+ def initialize_options(self):
+ self.install_dir = None
+
+ def finalize_options(self):
+ self.set_undefined_options('install_lib',('install_dir','install_dir'))
+ ei_cmd = self.get_finalized_command("egg_info")
+ basename = pkg_resources.Distribution(
+ None, None, ei_cmd.egg_name, ei_cmd.egg_version
+ ).egg_name()+'.egg-info'
+ self.source = ei_cmd.egg_info
+ self.target = os.path.join(self.install_dir, basename)
+
+ def run(self):
+ self.run_command('egg_info')
+ target = self.target
+ if os.path.isdir(self.target) and not os.path.islink(self.target):
+ dir_util.remove_tree(self.target, dry_run=self.dry_run)
+ elif os.path.exists(self.target):
+ self.execute(os.unlink,(self.target,),"Removing "+self.target)
+ if not self.dry_run:
+ pkg_resources.ensure_directory(self.target)
+ self.execute(self.copytree, (),
+ "Copying %s to %s" % (self.source, self.target)
+ )
+
+
+
+ def get_outputs(self):
+ return [self.target] # XXX list all files, not just dir?
+
+ def copytree(self):
+ # Copy the .egg-info tree to site-packages
+
+ def skimmer(src,dst):
+ # filter out source-control directories; note that 'src' is always
+ # a '/'-separated path, regardless of platform. 'dst' is a
+ # platform-specific path.
+ for skip in '.svn/','CVS/':
+ if src.startswith(skip) or '/'+skip in src:
+ return None
+ log.debug("Copying %s to %s", src, dst)
+ return dst
+
+ unpack_archive(self.source, self.target, skimmer)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+