[Python-checkins] commit of r41857 - sandbox/trunk/setuptools/setuptools/command/develop.py sandbox/trunk/setuptools/setuptools/command/egg_info.py

phillip.eby python-checkins at python.org
Fri Dec 30 17:35:45 CET 2005


Author: phillip.eby
Date: Fri Dec 30 17:35:42 2005
New Revision: 41857
Modified:
 sandbox/trunk/setuptools/setuptools/command/develop.py
 sandbox/trunk/setuptools/setuptools/command/egg_info.py
Log:
Allow most commands to work with an existing .egg-info directory w/a '-' 
in it, but warn about it and refuse to run "develop" until the existing 
directory is renamed. This should allow older source distributions and 
checkouts to keep working with 0.6a9.
Modified: sandbox/trunk/setuptools/setuptools/command/develop.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/develop.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/develop.py	Fri Dec 30 17:35:42 2005
@@ -2,6 +2,7 @@
 from distutils.util import convert_path
 from pkg_resources import Distribution, PathMetadata, normalize_path
 from distutils import log
+from distutils.errors import *
 import sys, os
 
 class develop(easy_install):
@@ -38,11 +39,14 @@
 
 
 
-
 def finalize_options(self):
 ei = self.get_finalized_command("egg_info")
- self.args = [ei.egg_name]
- 
+ if ei.broken_egg_info:
+ raise DistutilsError(
+ "Please rename %r to %r before using 'develop'"
+ % (ei.egg_info, ei.broken_egg_info)
+ )
+ self.args = [ei.egg_name] 
 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
@@ -76,10 +80,6 @@
 
 
 
-
-
-
-
 def uninstall_link(self):
 if os.path.exists(self.egg_link):
 log.info("Removing %s (link to %s)", self.egg_link, self.egg_base)
Modified: sandbox/trunk/setuptools/setuptools/command/egg_info.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/egg_info.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/egg_info.py	Fri Dec 30 17:35:42 2005
@@ -37,7 +37,7 @@
 self.tag_build = None
 self.tag_svn_revision = 0
 self.tag_date = 0
-
+ self.broken_egg_info = False
 
 def finalize_options (self):
 self.egg_name = safe_name(self.distribution.get_name())
@@ -61,6 +61,7 @@
 self.egg_info = self.egg_name.replace('-','_')+'.egg-info'
 if self.egg_base != os.curdir:
 self.egg_info = os.path.join(self.egg_base, self.egg_info)
+ if '-' in self.egg_name: self.check_broken_egg_info()
 
 # Set package version for the benefit of dumber commands
 # (e.g. sdist, bdist_wininst, etc.)
@@ -79,7 +80,6 @@
 
 
 
-
 def write_or_delete_file(self, what, filename, data):
 """Write `data` to `filename` or delete if empty
 
@@ -170,6 +170,20 @@
 mm.run()
 self.filelist = mm.filelist
 
+ def check_broken_egg_info(self):
+ bei = self.egg_name+'.egg-info'
+ if self.egg_base != os.curdir:
+ bei = os.path.join(self.egg_base, bei)
+ if os.path.exists(bei):
+ log.warn(
+ "-"*78+'\n'
+ "Note: Your current .egg-info directory has a '-' in its name;"
+ '\nthis will not work correctly with "setup.py develop".\n\n'
+ 'Please rename %s to %s to correct this problem.\n'+'-'*78,
+ bei, self.egg_info
+ )
+ self.broken_egg_info = self.egg_info
+ self.egg_info = bei # make it work for now
 
 class FileList(FileList):
 """File list that accepts only existing, platform-independent paths"""
@@ -190,23 +204,10 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 class manifest_maker(sdist):
 
 template = "MANIFEST.in"
- 
+
 def initialize_options (self):
 self.use_defaults = 1
 self.prune = 1
@@ -300,7 +301,7 @@
 
 safe = getattr(cmd.distribution,'zip_safe',None)
 import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe)
- 
+
 def warn_depends_obsolete(cmd, basename, filename):
 if os.path.exists(filename):
 log.warn(


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /