mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Merged revisions 73689 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
  r73689 | tarek.ziade | 2009-06-29 18:19:22 +0200 (Mon, 29 Jun 2009) | 9 lines
  Merged revisions 73688 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk
  ........
    r73688 | tarek.ziade | 2009-06-29 18:13:39 +0200 (Mon, 29 Jun 2009) | 1 line
    Fixed 6365: wrong inplace location for build_ext if the extension had dots
  ........
................
			
			
This commit is contained in:
		
							parent
							
								
									4e82f2df3d
								
							
						
					
					
						commit
						2c3de40971
					
				
					 3 changed files with 22 additions and 7 deletions
				
			
		| 
						 | 
					@ -630,16 +630,16 @@ def get_ext_fullpath(self, ext_name):
 | 
				
			||||||
        (inplace option).
 | 
					        (inplace option).
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        fullname = self.get_ext_fullname(ext_name)
 | 
					        fullname = self.get_ext_fullname(ext_name)
 | 
				
			||||||
        filename = self.get_ext_filename(fullname)
 | 
					        modpath = fullname.split('.')
 | 
				
			||||||
 | 
					        package = '.'.join(modpath[0:-1])
 | 
				
			||||||
 | 
					        base = modpath[-1]
 | 
				
			||||||
 | 
					        filename = self.get_ext_filename(base)
 | 
				
			||||||
        if not self.inplace:
 | 
					        if not self.inplace:
 | 
				
			||||||
            # no further work needed
 | 
					            # no further work needed
 | 
				
			||||||
            return os.path.join(self.build_lib, filename)
 | 
					            return os.path.join(self.build_lib, filename)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # the inplace option requires to find the package directory
 | 
					        # the inplace option requires to find the package directory
 | 
				
			||||||
        # using the build_py command
 | 
					        # using the build_py command
 | 
				
			||||||
        modpath = fullname.split('.')
 | 
					 | 
				
			||||||
        package = '.'.join(modpath[0:-1])
 | 
					 | 
				
			||||||
        base = modpath[-1]
 | 
					 | 
				
			||||||
        build_py = self.get_finalized_command('build_py')
 | 
					        build_py = self.get_finalized_command('build_py')
 | 
				
			||||||
        package_dir = os.path.abspath(build_py.get_package_dir(package))
 | 
					        package_dir = os.path.abspath(build_py.get_package_dir(package))
 | 
				
			||||||
        return os.path.join(package_dir, filename)
 | 
					        return os.path.join(package_dir, filename)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -339,10 +339,9 @@ def test_get_outputs(self):
 | 
				
			||||||
        # inplace = 0, cmd.package = 'bar'
 | 
					        # inplace = 0, cmd.package = 'bar'
 | 
				
			||||||
        cmd.package = 'bar'
 | 
					        cmd.package = 'bar'
 | 
				
			||||||
        path = cmd.get_ext_fullpath('foo')
 | 
					        path = cmd.get_ext_fullpath('foo')
 | 
				
			||||||
        # checking that the last directory is bar
 | 
					        # checking that the last directory is the build_dir
 | 
				
			||||||
        path = os.path.split(path)[0]
 | 
					        path = os.path.split(path)[0]
 | 
				
			||||||
        lastdir = os.path.split(path)[-1]
 | 
					        self.assertEquals(path, cmd.build_lib)
 | 
				
			||||||
        self.assertEquals(lastdir, cmd.package)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # inplace = 1, cmd.package = 'bar'
 | 
					        # inplace = 1, cmd.package = 'bar'
 | 
				
			||||||
        cmd.inplace = 1
 | 
					        cmd.inplace = 1
 | 
				
			||||||
| 
						 | 
					@ -358,6 +357,19 @@ def test_get_outputs(self):
 | 
				
			||||||
        lastdir = os.path.split(path)[-1]
 | 
					        lastdir = os.path.split(path)[-1]
 | 
				
			||||||
        self.assertEquals(lastdir, cmd.package)
 | 
					        self.assertEquals(lastdir, cmd.package)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_build_ext_inplace(self):
 | 
				
			||||||
 | 
					        etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c')
 | 
				
			||||||
 | 
					        etree_ext = Extension('lxml.etree', [etree_c])
 | 
				
			||||||
 | 
					        dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]})
 | 
				
			||||||
 | 
					        cmd = build_ext(dist)
 | 
				
			||||||
 | 
					        cmd.inplace = 1
 | 
				
			||||||
 | 
					        cmd.distribution.package_dir = {'': 'src'}
 | 
				
			||||||
 | 
					        cmd.distribution.packages = ['lxml', 'lxml.html']
 | 
				
			||||||
 | 
					        curdir = os.getcwd()
 | 
				
			||||||
 | 
					        wanted = os.path.join(curdir, 'src', 'lxml', 'etree.so')
 | 
				
			||||||
 | 
					        path = cmd.get_ext_fullpath('lxml.etree')
 | 
				
			||||||
 | 
					        self.assertEquals(wanted, path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_suite():
 | 
					def test_suite():
 | 
				
			||||||
    src = _get_source_filename()
 | 
					    src = _get_source_filename()
 | 
				
			||||||
    if not os.path.exists(src):
 | 
					    if not os.path.exists(src):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -839,6 +839,9 @@ Core and Builtins
 | 
				
			||||||
Library
 | 
					Library
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Issue #6365: Distutils build_ext inplace mode was copying the compiled 
 | 
				
			||||||
 | 
					  extension in a subdirectory if the extension name had dots.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #6287: Added the license field in Distutils documentation.
 | 
					- Issue #6287: Added the license field in Distutils documentation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #6263: Fixed syntax error in distutils.cygwincompiler.
 | 
					- Issue #6263: Fixed syntax error in distutils.cygwincompiler.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue