mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 11:49:12 +00:00 
			
		
		
		
	Branch merge
This commit is contained in:
		
						commit
						bcf99ac665
					
				
					 3 changed files with 38 additions and 7 deletions
				
			
		| 
						 | 
					@ -306,7 +306,10 @@ class sdist(Command):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    self.filelist.process_template_line(line)
 | 
					                    self.filelist.process_template_line(line)
 | 
				
			||||||
                except DistutilsTemplateError as msg:
 | 
					                # the call above can raise a DistutilsTemplateError for
 | 
				
			||||||
 | 
					                # malformed lines, or a ValueError from the lower-level
 | 
				
			||||||
 | 
					                # convert_path function
 | 
				
			||||||
 | 
					                except (DistutilsTemplateError, ValueError) as msg:
 | 
				
			||||||
                    self.warn("%s, line %d: %s" % (template.filename,
 | 
					                    self.warn("%s, line %d: %s" % (template.filename,
 | 
				
			||||||
                                                   template.current_line,
 | 
					                                                   template.current_line,
 | 
				
			||||||
                                                   msg))
 | 
					                                                   msg))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ from distutils.tests.test_config import PyPIRCCommandTestCase
 | 
				
			||||||
from distutils.errors import DistutilsOptionError
 | 
					from distutils.errors import DistutilsOptionError
 | 
				
			||||||
from distutils.spawn import find_executable
 | 
					from distutils.spawn import find_executable
 | 
				
			||||||
from distutils.log import WARN
 | 
					from distutils.log import WARN
 | 
				
			||||||
 | 
					from distutils.filelist import FileList
 | 
				
			||||||
from distutils.archive_util import ARCHIVE_FORMATS
 | 
					from distutils.archive_util import ARCHIVE_FORMATS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SETUP_PY = """
 | 
					SETUP_PY = """
 | 
				
			||||||
| 
						 | 
					@ -78,9 +79,6 @@ class SDistTestCase(PyPIRCCommandTestCase):
 | 
				
			||||||
        dist.include_package_data = True
 | 
					        dist.include_package_data = True
 | 
				
			||||||
        cmd = sdist(dist)
 | 
					        cmd = sdist(dist)
 | 
				
			||||||
        cmd.dist_dir = 'dist'
 | 
					        cmd.dist_dir = 'dist'
 | 
				
			||||||
        def _warn(*args):
 | 
					 | 
				
			||||||
            pass
 | 
					 | 
				
			||||||
        cmd.warn = _warn
 | 
					 | 
				
			||||||
        return dist, cmd
 | 
					        return dist, cmd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
 | 
					    @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
 | 
				
			||||||
| 
						 | 
					@ -235,7 +233,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
 | 
				
			||||||
        # with the `check` subcommand
 | 
					        # with the `check` subcommand
 | 
				
			||||||
        cmd.ensure_finalized()
 | 
					        cmd.ensure_finalized()
 | 
				
			||||||
        cmd.run()
 | 
					        cmd.run()
 | 
				
			||||||
        warnings = self.get_logs(WARN)
 | 
					        warnings = [msg for msg in self.get_logs(WARN) if
 | 
				
			||||||
 | 
					                    msg.startswith('warning: check:')]
 | 
				
			||||||
        self.assertEqual(len(warnings), 2)
 | 
					        self.assertEqual(len(warnings), 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # trying with a complete set of metadata
 | 
					        # trying with a complete set of metadata
 | 
				
			||||||
| 
						 | 
					@ -244,7 +243,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
 | 
				
			||||||
        cmd.ensure_finalized()
 | 
					        cmd.ensure_finalized()
 | 
				
			||||||
        cmd.metadata_check = 0
 | 
					        cmd.metadata_check = 0
 | 
				
			||||||
        cmd.run()
 | 
					        cmd.run()
 | 
				
			||||||
        warnings = self.get_logs(WARN)
 | 
					        warnings = [msg for msg in self.get_logs(WARN) if
 | 
				
			||||||
 | 
					                    msg.startswith('warning: check:')]
 | 
				
			||||||
        self.assertEqual(len(warnings), 0)
 | 
					        self.assertEqual(len(warnings), 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_check_metadata_deprecated(self):
 | 
					    def test_check_metadata_deprecated(self):
 | 
				
			||||||
| 
						 | 
					@ -266,7 +266,6 @@ class SDistTestCase(PyPIRCCommandTestCase):
 | 
				
			||||||
        self.assertEqual(len(output), num_formats)
 | 
					        self.assertEqual(len(output), num_formats)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_finalize_options(self):
 | 
					    def test_finalize_options(self):
 | 
				
			||||||
 | 
					 | 
				
			||||||
        dist, cmd = self.get_cmd()
 | 
					        dist, cmd = self.get_cmd()
 | 
				
			||||||
        cmd.finalize_options()
 | 
					        cmd.finalize_options()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -286,6 +285,32 @@ class SDistTestCase(PyPIRCCommandTestCase):
 | 
				
			||||||
        cmd.formats = 'supazipa'
 | 
					        cmd.formats = 'supazipa'
 | 
				
			||||||
        self.assertRaises(DistutilsOptionError, cmd.finalize_options)
 | 
					        self.assertRaises(DistutilsOptionError, cmd.finalize_options)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # the following tests make sure there is a nice error message instead
 | 
				
			||||||
 | 
					    # of a traceback when parsing an invalid manifest template
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def _test_template(self, content):
 | 
				
			||||||
 | 
					        dist, cmd = self.get_cmd()
 | 
				
			||||||
 | 
					        os.chdir(self.tmp_dir)
 | 
				
			||||||
 | 
					        self.write_file('MANIFEST.in', content)
 | 
				
			||||||
 | 
					        cmd.ensure_finalized()
 | 
				
			||||||
 | 
					        cmd.filelist = FileList()
 | 
				
			||||||
 | 
					        cmd.read_template()
 | 
				
			||||||
 | 
					        warnings = self.get_logs(WARN)
 | 
				
			||||||
 | 
					        self.assertEqual(len(warnings), 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_invalid_template_unknown_command(self):
 | 
				
			||||||
 | 
					        self._test_template('taunt knights *')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_invalid_template_wrong_arguments(self):
 | 
				
			||||||
 | 
					        # this manifest command takes one argument
 | 
				
			||||||
 | 
					        self._test_template('prune')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @unittest.skipIf(os.name != 'nt', 'test relevant for Windows only')
 | 
				
			||||||
 | 
					    def test_invalid_template_wrong_path(self):
 | 
				
			||||||
 | 
					        # on Windows, trailing slashes are not allowed
 | 
				
			||||||
 | 
					        # this used to crash instead of raising a warning: #8286
 | 
				
			||||||
 | 
					        self._test_template('include examples/')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
 | 
					    @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
 | 
				
			||||||
    def test_get_file_list(self):
 | 
					    def test_get_file_list(self):
 | 
				
			||||||
        # make sure MANIFEST is recalculated
 | 
					        # make sure MANIFEST is recalculated
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,6 +73,9 @@ Core and Builtins
 | 
				
			||||||
Library
 | 
					Library
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
 | 
					- Issue #8286: The distutils command sdist will print a warning message instead
 | 
				
			||||||
 | 
					  of crashing when an invalid path is given in the manifest template.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #12841: tarfile unnecessarily checked the existence of numerical user
 | 
					- Issue #12841: tarfile unnecessarily checked the existence of numerical user
 | 
				
			||||||
  and group ids on extraction. If one of them did not exist the respective id
 | 
					  and group ids on extraction. If one of them did not exist the respective id
 | 
				
			||||||
  of the current user (i.e. root) was used for the file and ownership
 | 
					  of the current user (i.e. root) was used for the file and ownership
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue