mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-11-04 07:54:03 +00:00 
			
		
		
		
	Replace simple Popen() calls with check_output()
This commit is contained in:
		
							parent
							
								
									2d3765522e
								
							
						
					
					
						commit
						23c7d67425
					
				@ -34,8 +34,8 @@ class Builder(object):
 | 
				
			|||||||
    def __init__(self, name):
 | 
					    def __init__(self, name):
 | 
				
			||||||
        self.name = name
 | 
					        self.name = name
 | 
				
			||||||
        cmd = ["dpkg-architecture", "-qDEB_BUILD_ARCH_CPU"]
 | 
					        cmd = ["dpkg-architecture", "-qDEB_BUILD_ARCH_CPU"]
 | 
				
			||||||
        process = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding='utf-8')
 | 
					        self.architecture = subprocess.check_output(
 | 
				
			||||||
        self.architecture = process.communicate()[0].strip()
 | 
					            cmd, encoding='utf-8').strip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _build_failure(self, returncode, dsc_file):
 | 
					    def _build_failure(self, returncode, dsc_file):
 | 
				
			||||||
        if returncode != 0:
 | 
					        if returncode != 0:
 | 
				
			||||||
 | 
				
			|||||||
@ -71,8 +71,7 @@ class Patch(object):
 | 
				
			|||||||
        patch_f.close()
 | 
					        patch_f.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cmd = ["diffstat", "-l", "-p0", self._full_path]
 | 
					        cmd = ["diffstat", "-l", "-p0", self._full_path]
 | 
				
			||||||
        process = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding='utf-8')
 | 
					        changed_files = subprocess.check_output(cmd, encoding='utf-8')
 | 
				
			||||||
        changed_files = process.communicate()[0]
 | 
					 | 
				
			||||||
        self._changed_files = [f for f in changed_files.split("\n") if f != ""]
 | 
					        self._changed_files = [f for f in changed_files.split("\n") if f != ""]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_strip_level(self):
 | 
					    def get_strip_level(self):
 | 
				
			||||||
 | 
				
			|||||||
@ -327,8 +327,7 @@ class SourcePackage(object):
 | 
				
			|||||||
        if not Logger.verbose:
 | 
					        if not Logger.verbose:
 | 
				
			||||||
            cmd.insert(1, "-q")
 | 
					            cmd.insert(1, "-q")
 | 
				
			||||||
        Logger.command(cmd + [">", self._debdiff_filename])
 | 
					        Logger.command(cmd + [">", self._debdiff_filename])
 | 
				
			||||||
        process = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding='utf-8')
 | 
					        debdiff = subprocess.check_output(cmd, encoding='utf-8')
 | 
				
			||||||
        debdiff = process.communicate()[0]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # write debdiff file
 | 
					        # write debdiff file
 | 
				
			||||||
        debdiff_file = open(self._debdiff_filename, "w")
 | 
					        debdiff_file = open(self._debdiff_filename, "w")
 | 
				
			||||||
@ -421,8 +420,7 @@ class SourcePackage(object):
 | 
				
			|||||||
                                        self._package + "_" +
 | 
					                                        self._package + "_" +
 | 
				
			||||||
                                        strip_epoch(self._version) + ".lintian")
 | 
					                                        strip_epoch(self._version) + ".lintian")
 | 
				
			||||||
        Logger.command(cmd + [">", lintian_filename])
 | 
					        Logger.command(cmd + [">", lintian_filename])
 | 
				
			||||||
        process = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding='utf-8')
 | 
					        report = subprocess.check_output(cmd, encoding='utf-8')
 | 
				
			||||||
        report = process.communicate()[0]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # write lintian report file
 | 
					        # write lintian report file
 | 
				
			||||||
        lintian_file = open(lintian_filename, "w")
 | 
					        lintian_file = open(lintian_filename, "w")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user