components/python/setuptools/patches/01-64-bit.patch
changeset 7375 b55580983599
equal deleted inserted replaced
7374:dbcebcd93e38 7375:b55580983599
       
     1 Needed as a counterpart to Python's 64-bit patch.  Will not be submitted
       
     2 upstream.
       
     3 
       
     4 --- setuptools-19.2/setuptools/command/bdist_egg.py.~1~	2015-12-11 08:17:56.000000000 +0000
       
     5 +++ setuptools-19.2/setuptools/command/bdist_egg.py	2016-11-16 11:46:37.034754212 +0000
       
     6 @@ -167,11 +167,24 @@
       
     7              filename, ext = os.path.splitext(ext_name)
       
     8              pyfile = os.path.join(self.bdist_dir, strip_module(filename) +
       
     9                                    '.py')
       
    10 -            self.stubs.append(pyfile)
       
    11 +            dirname, basename = os.path.split(pyfile)
       
    12 +            dirnamehead, dirnametail = os.path.split(dirname)
       
    13 +            # Strip any trailing '64' dirs in the .py file path.
       
    14 +            if dirnametail == '64':
       
    15 +                tweakedpyfile = os.path.join(dirnamehead, basename)
       
    16 +            else:
       
    17 +                tweakedpyfile = pyfile
       
    18 +            self.stubs.append(tweakedpyfile)
       
    19              log.info("creating stub loader for %s" % ext_name)
       
    20              if not self.dry_run:
       
    21 -                write_stub(os.path.basename(ext_name), pyfile)
       
    22 -            to_compile.append(pyfile)
       
    23 +                # If pyfile is unchanged, then the .so should be in the same
       
    24 +                # directory, but if we tweaked it, then we need to add back
       
    25 +                # the '64' that we had stripped.
       
    26 +                resource = os.path.basename(ext_name)
       
    27 +                if pyfile != tweakedpyfile:
       
    28 +                    resource = os.path.join('64', resource)
       
    29 +                write_stub(resource, tweakedpyfile)
       
    30 +            to_compile.append(tweakedpyfile)
       
    31              ext_outputs[p] = ext_name.replace(os.sep, '/')
       
    32  
       
    33          if to_compile: