You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					29 lines
				
				756 B
			
		
		
			
		
	
	
					29 lines
				
				756 B
			| 
								 
											6 years ago
										 
									 | 
							
								#!/usr/bin/env python
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import subprocess
							 | 
						||
| 
								 | 
							
								import sys
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								checked_ext = ["h", "c", "py", "pyx", "cpp", "hpp", "md", "mk"]
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if __name__ == "__main__":
							 | 
						||
| 
								 | 
							
								  with open("list.txt", 'r') as handle:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    suffix_cmd = " "
							 | 
						||
| 
								 | 
							
								    for i in checked_ext:
							 | 
						||
| 
								 | 
							
								      suffix_cmd +=  "--include \*." + i + " "
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    found_bad_language = False
							 | 
						||
| 
								 | 
							
								    for line in handle:
							 | 
						||
| 
								 | 
							
								      line = line.rstrip('\n').rstrip(" ")
							 | 
						||
| 
								 | 
							
								      try:
							 | 
						||
| 
								 | 
							
								        cmd = "cd ../../; grep -R -i -w " + suffix_cmd + " '" + line + "'"
							 | 
						||
| 
								 | 
							
								        res = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
							 | 
						||
| 
								 | 
							
								        print res
							 | 
						||
| 
								 | 
							
								        found_bad_language = True
							 | 
						||
| 
								 | 
							
								      except subprocess.CalledProcessError as e:
							 | 
						||
| 
								 | 
							
								        pass
							 | 
						||
| 
								 | 
							
								  if found_bad_language:
							 | 
						||
| 
								 | 
							
								    sys.exit("Failed: found bad language")
							 | 
						||
| 
								 | 
							
								  else:
							 | 
						||
| 
								 | 
							
								    print "Success"
							 |