[Python-checkins] r53791 - in sandbox/branches/setuptools-0.6: setuptools.txt setuptools/command/develop.py

phillip.eby python-checkins at python.org
Thu Feb 15 20:22:20 CET 2007


Author: phillip.eby
Date: Thu Feb 15 20:22:19 2007
New Revision: 53791

Modified:
   sandbox/branches/setuptools-0.6/setuptools.txt
   sandbox/branches/setuptools-0.6/setuptools/command/develop.py
Log:
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)


Modified: sandbox/branches/setuptools-0.6/setuptools.txt
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools.txt	(original)
+++ sandbox/branches/setuptools-0.6/setuptools.txt	Thu Feb 15 20:22:19 2007
@@ -1910,6 +1910,15 @@
     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 @@
 ----------------------------
 
 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

Modified: sandbox/branches/setuptools-0.6/setuptools/command/develop.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/develop.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/develop.py	Thu Feb 15 20:22:19 2007
@@ -12,6 +12,7 @@
 
     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 @@
 
     def initialize_options(self):
         self.uninstall = None
+        self.egg_path = None
         easy_install.initialize_options(self)
 
 
@@ -37,8 +39,6 @@
 
 
 
-
-
     def finalize_options(self):
         ei = self.get_finalized_command("egg_info")
         if ei.broken_egg_info:
@@ -50,14 +50,36 @@
         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 @@
             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 @@
             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
@@ -121,3 +146,19 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


More information about the Python-checkins mailing list