Commit 7a27a6f7 authored by PJ Eby's avatar PJ Eby

Added ``--egg-path`` option to ``develop`` command, allowing you to force

``.egg-link`` files to use relative paths (allowing them to be shared across
platforms on a networked drive). (backport from trunk)

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4053791
parent a494dd32
......@@ -1910,6 +1910,15 @@ over the installation options for dependencies.
a requirement can be met using a distribution that is already available in
a directory on ``sys.path``, it will not be copied to the staging area.
``--egg-path=DIR``
Force the generated ``.egg-link`` file to use a specified relative path
to the source directory. This can be useful in circumstances where your
installation directory is being shared by code running under multiple
platforms (e.g. Mac and Windows) which have different absolute locations
for the code under development, but the same *relative* locations with
respect to the installation directory. If you use this option when
installing, you must supply the same relative path when uninstalling.
In addition to the above options, the ``develop`` command also accepts all of
the same options accepted by ``easy_install``. If you've configured any
``easy_install`` settings in your ``setup.cfg`` (or other distutils config
......@@ -2601,6 +2610,10 @@ Release Notes/Change History
----------------------------
0.6c6
* Added ``--egg-path`` option to ``develop`` command, allowing you to force
``.egg-link`` files to use relative paths (allowing them to be shared across
platforms on a networked drive).
* Fix not building binary RPMs correctly.
* Fix "eggsecutables" (such as setuptools' own egg) only being runnable with
......
......@@ -12,6 +12,7 @@ class develop(easy_install):
user_options = easy_install.user_options + [
("uninstall", "u", "Uninstall this source package"),
("egg-path=", None, "Set the path to be used in the .egg-link file"),
]
boolean_options = easy_install.boolean_options + ['uninstall']
......@@ -28,6 +29,7 @@ class develop(easy_install):
def initialize_options(self):
self.uninstall = None
self.egg_path = None
easy_install.initialize_options(self)
......@@ -37,8 +39,6 @@ class develop(easy_install):
def finalize_options(self):
ei = self.get_finalized_command("egg_info")
if ei.broken_egg_info:
......@@ -50,14 +50,36 @@ class develop(easy_install):
easy_install.finalize_options(self)
self.egg_link = os.path.join(self.install_dir, ei.egg_name+'.egg-link')
self.egg_base = ei.egg_base
self.egg_path = os.path.abspath(ei.egg_base)
if self.egg_path is None:
self.egg_path = os.path.abspath(ei.egg_base)
target = normalize_path(self.egg_base)
if normalize_path(os.path.join(self.install_dir, self.egg_path)) != target:
raise DistutilsOptionError(
"--egg-path must be a relative path from the install"
" directory to "+target
)
# Make a distribution for the package's source
self.dist = Distribution(
normalize_path(self.egg_path),
PathMetadata(self.egg_path, os.path.abspath(ei.egg_info)),
target,
PathMetadata(target, os.path.abspath(ei.egg_info)),
project_name = ei.egg_name
)
def install_for_development(self):
# Ensure metadata is up-to-date
self.run_command('egg_info')
......@@ -75,11 +97,11 @@ class develop(easy_install):
f = open(self.egg_link,"w")
f.write(self.egg_path)
f.close()
# postprocess the installed distro, fixing up .pth, installing scripts,
# and handling requirements
self.process_distribution(None, self.dist, not self.no_deps)
def uninstall_link(self):
if os.path.exists(self.egg_link):
log.info("Removing %s (link to %s)", self.egg_link, self.egg_base)
......@@ -96,6 +118,9 @@ class develop(easy_install):
log.warn("Note: you must uninstall or replace scripts manually!")
def install_egg_scripts(self, dist):
if dist is not self.dist:
# Installing a dependency, so fall back to normal behavior
......@@ -118,6 +143,22 @@ class develop(easy_install):
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment