[Python-checkins] python/nondist/sandbox/setuptools/setuptools/command bdist_egg.py, 1.29, 1.30 easy_install.py, 1.23, 1.24

pje@users.sourceforge.net pje at users.sourceforge.net
Tue Aug 23 15:24:52 CEST 2005


Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28556/setuptools/command

Modified Files:
	bdist_egg.py easy_install.py 
Log Message:
Simplify non-root install process and improve Mac OS docs for it.  Support
.pth files and legacy packages possibly being symlinks, and ensure that
overwrites don't follow the symlink.


Index: bdist_egg.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/bdist_egg.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- bdist_egg.py	22 Aug 2005 13:40:10 -0000	1.29
+++ bdist_egg.py	23 Aug 2005 13:24:42 -0000	1.30
@@ -168,14 +168,11 @@
 
         # We run install_lib before install_data, because some data hacks
         # pull their data path from the install_lib command.
-        
         log.info("installing library code to %s" % self.bdist_dir)
         instcmd = self.get_finalized_command('install')
-        old_root = instcmd.root
-        instcmd.root = None
+        old_root = instcmd.root; instcmd.root = None
         cmd = self.call_command('install_lib', warn_dir=0)
         instcmd.root = old_root
-
         ext_outputs = cmd._mutate_outputs(
             self.distribution.has_ext_modules(), 'build_ext', 'build_lib', ''
         )
@@ -201,7 +198,6 @@
         archive_root = self.bdist_dir
         egg_info = os.path.join(archive_root,'EGG-INFO')
         self.mkpath(egg_info)
-
         if self.distribution.scripts:
             script_dir = os.path.join(egg_info, 'scripts')
             log.info("installing scripts to %s" % script_dir)

Index: easy_install.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- easy_install.py	22 Aug 2005 13:40:10 -0000	1.23
+++ easy_install.py	23 Aug 2005 13:24:42 -0000	1.24
@@ -104,8 +104,10 @@
         for filename in blockers:
             log.info("Deleting %s", filename)
             if not self.dry_run:
-                if os.path.isdir(filename):
-                    shutil.rmtree(filename)
+                if hasattr(os.path,'islink') and os.path.islink(filename):
+                    os.unlink(filename)
+                elif os.path.isdir(filename):
+                    shutil.rmtree(filename)                
                 else:
                     os.unlink(filename)
 
@@ -119,8 +121,6 @@
 
 
 
-
-
     def finalize_options(self):
         # If a non-default installation directory was specified, default the
         # script directory to match it.
@@ -846,7 +846,9 @@
         if dist.key=='setuptools':
             # Ensure that setuptools itself never becomes unavailable!
             # XXX should this check for latest version?
-            f = open(os.path.join(self.install_dir,'setuptools.pth'), 'wt')
+            filename = os.path.join(self.install_dir,'setuptools.pth')
+            unlink_if_symlink(filename)
+            f = open(filename, 'wt')
             f.write(dist.location+'\n')
             f.close()
 
@@ -857,8 +859,6 @@
         return dst     # only unpack-and-compile skips files for dry run
 
 
-
-
     def unpack_and_compile(self, egg_path, destination):
         to_compile = []
 
@@ -1017,9 +1017,9 @@
         f.close()
 
 
-
-
-
+def unlink_if_symlink(filename):
+    if hasattr(os.path,'islink') and os.path.islink(filename):
+        os.unlink(filename)
 
 
 
@@ -1100,11 +1100,11 @@
         if self.dirty:
             log.debug("Saving %s", self.filename)
             data = '\n'.join(self.paths+[''])
+            unlink_if_symlink(self.filename)
             f = open(self.filename,'wt'); f.write(data); f.close()
             self.dirty = False
 
 
-
     def add(self,dist):
         """Add `dist` to the distribution map"""
         if dist.location not in self.paths:



More information about the Python-checkins mailing list