diff options
author | PJ Eby <distutils-sig@python.org> | 2005-12-14 17:37:30 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-12-14 17:37:30 +0000 |
commit | c7eeb6273fd7593d7bccfbe41f44b5aa2ab17c1d (patch) | |
tree | 28394eca5cf8e0f5745ea2fd4eacdfe00743a906 | |
parent | bd28408ff49d304ae822acf9f46f0b65bb138c04 (diff) | |
download | external_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
-rwxr-xr-x | setuptools.egg-info/entry_points.txt | 1 | ||||
-rwxr-xr-x | setuptools.txt | 15 | ||||
-rw-r--r-- | setuptools/command/__init__.py | 2 | ||||
-rw-r--r-- | setuptools/command/install.py | 6 | ||||
-rwxr-xr-x | setuptools/command/install_egg_info.py | 82 |
5 files changed, 101 insertions, 5 deletions
diff --git a/setuptools.egg-info/entry_points.txt b/setuptools.egg-info/entry_points.txt index 34796831..dfdc0289 100755 --- a/setuptools.egg-info/entry_points.txt +++ b/setuptools.egg-info/entry_points.txt @@ -30,6 +30,7 @@ build_py = setuptools.command.build_py:build_py saveopts = setuptools.command.saveopts:saveopts egg_info = setuptools.command.egg_info:egg_info upload = setuptools.command.upload:upload +install_egg_info = setuptools.command.install_egg_info:install_egg_info alias = setuptools.command.alias:alias easy_install = setuptools.command.easy_install:easy_install bdist_egg = setuptools.command.bdist_egg:bdist_egg diff --git a/setuptools.txt b/setuptools.txt index 65b36bc2..ddccf390 100755 --- a/setuptools.txt +++ b/setuptools.txt @@ -11,7 +11,7 @@ Packages built and distributed using ``setuptools`` look to the user like ordinary Python packages based on the ``distutils``. Your users don't need to install or even know about setuptools in order to use them, and you don't have to include the entire setuptools package in your distributions. By -including just a single `bootstrap module`_ (a 7K .py file), your package will +including just a single `bootstrap module`_ (an 8K .py file), your package will automatically download and install ``setuptools`` if the user is building your package from source and doesn't have a suitable version already installed. @@ -2181,6 +2181,10 @@ Release Notes/Change History that you can process a directory tree through a processing filter as if it were a zipfile or tarfile. + * 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. + 0.6a8 * Fixed some problems building extensions when Pyrex was installed, especially with Python 2.4 and/or packages using SWIG. @@ -2434,3 +2438,12 @@ Release Notes/Change History 0.3a1 * Initial release. + +Mailing list +============ + +Please use the `distutils-sig mailing list`_ for questions and discussion about +setuptools. + +.. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/ + 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) + + + + + + + + + + + + + + + + + + + + + + + + |