[Python-checkins] r45696 - in sandbox/branches/setuptools-0.6/setuptools: command/bdist_egg.py command/easy_install.py dist.py

phillip.eby python-checkins at python.org
Mon Apr 24 22:53:00 CEST 2006


Author: phillip.eby
Date: Mon Apr 24 22:52:59 2006
New Revision: 45696

Modified:
   sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py
   sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py
   sandbox/branches/setuptools-0.6/setuptools/dist.py
Log:
Backport 'module' fixes to 0.6


Modified: sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/bdist_egg.py	Mon Apr 24 22:52:59 2006
@@ -12,6 +12,13 @@
 from types import CodeType
 from setuptools.extension import Library
 
+def strip_module(filename):
+    if '.' in filename:
+        filename = os.path.splitext(filename)[0]
+    if filename.endswith('module'):
+        filename = filename[:-6]
+    return filename
+
 def write_stub(resource, pyfile):
     f = open(pyfile,'w')
     f.write('\n'.join([
@@ -32,13 +39,6 @@
 
 
 
-
-
-
-
-
-
-
 class bdist_egg(Command):
 
     description = "create an \"egg\" distribution"
@@ -179,7 +179,7 @@
         to_compile = []
         for (p,ext_name) in enumerate(ext_outputs):
             filename,ext = os.path.splitext(ext_name)
-            pyfile = os.path.join(self.bdist_dir, filename + '.py')
+            pyfile = os.path.join(self.bdist_dir, strip_module(filename)+'.py')
             self.stubs.append(pyfile)
             log.info("creating stub loader for %s" % ext_name)
             if not self.dry_run:

Modified: sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/command/easy_install.py	Mon Apr 24 22:52:59 2006
@@ -745,7 +745,6 @@
         to_compile = []
         native_libs = []
         top_level = {}
-
         def process(src,dst):
             for old,new in prefixes:
                 if src.startswith(old):
@@ -754,6 +753,7 @@
                     dst = os.path.join(egg_tmp, *parts)
                     dl = dst.lower()
                     if dl.endswith('.pyd') or dl.endswith('.dll'):
+                        parts[-1] = bdist_egg.strip_module(parts[-1])
                         top_level[os.path.splitext(parts[0])[0]] = 1
                         native_libs.append(src)
                     elif dl.endswith('.py') and old!='SCRIPTS/':
@@ -770,11 +770,11 @@
         for res in native_libs:
             if res.lower().endswith('.pyd'):    # create stubs for .pyd's
                 parts = res.split('/')
-                resource, parts[-1] = parts[-1], parts[-1][:-1]
+                resource = parts[-1]
+                parts[-1] = bdist_egg.strip_module(parts[-1])+'.py'
                 pyfile = os.path.join(egg_tmp, *parts)
                 to_compile.append(pyfile); stubs.append(pyfile)
                 bdist_egg.write_stub(resource, pyfile)
-
         self.byte_compile(to_compile)   # compile .py's
         bdist_egg.write_safety_flag(os.path.join(egg_tmp,'EGG-INFO'),
             bdist_egg.analyze_egg(egg_tmp, stubs))  # write zip-safety flag

Modified: sandbox/branches/setuptools-0.6/setuptools/dist.py
==============================================================================
--- sandbox/branches/setuptools-0.6/setuptools/dist.py	(original)
+++ sandbox/branches/setuptools-0.6/setuptools/dist.py	Mon Apr 24 22:52:59 2006
@@ -624,10 +624,12 @@
 
         for ext in self.ext_modules or ():
             if isinstance(ext,tuple):
-                name,buildinfo = ext
-                yield name
+                name, buildinfo = ext
             else:
-                yield ext.name
+                name = ext.name
+            if name.endswith('module'):
+                name = name[:-6]
+            yield name
 
 # Install it throughout the distutils
 for module in distutils.dist, distutils.core, distutils.cmd:
@@ -652,8 +654,6 @@
 
 
 
-
-
 class Feature:
     """A subset of the distribution that can be excluded if unneeded/wanted
 


More information about the Python-checkins mailing list