mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Detect cython-generated files
This commit is contained in:
		| @@ -56,7 +56,8 @@ module Linguist | ||||
|         compiled_coffeescript? || | ||||
|         xcode_project_file? || | ||||
|         generated_net_docfile? || | ||||
|         generated_parser? | ||||
|         generated_parser? || | ||||
|         compiled_cython_file? | ||||
|     end | ||||
|  | ||||
|     # Internal: Is the blob an XCode project file? | ||||
| @@ -158,5 +159,17 @@ module Linguist | ||||
|  | ||||
|       false | ||||
|     end | ||||
|  | ||||
|     # Internal: Is this a compiled C/C++ file from Cython? | ||||
|     # | ||||
|     # Cython-compiled C/C++ files typically contain: | ||||
|     #     /* Generated by Cython x.x.x on ... */ | ||||
|     # on the first line. | ||||
|     # | ||||
|     # Return true or false | ||||
|     def compiled_cython_file? | ||||
|       return false unless ['.c', '.cpp'].include? extname | ||||
|       return lines[0].include?("Generated by Cython") | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
							
								
								
									
										4674
									
								
								samples/C++/wrapper_inner.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4674
									
								
								samples/C++/wrapper_inner.cpp
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										15669
									
								
								samples/C/sgd_fast.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15669
									
								
								samples/C/sgd_fast.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -181,6 +181,10 @@ class TestBlob < Test::Unit::TestCase | ||||
|  | ||||
|     assert blob("JavaScript/intro.js").generated? | ||||
|     assert blob("JavaScript/classes.js").generated? | ||||
|  | ||||
|     # Cython-generated C/C++ | ||||
|     assert blob("C/sgd_fast.c").generated? | ||||
|     assert blob("C++/wrapper_inner.cpp").generated? | ||||
|   end | ||||
|  | ||||
|   def test_vendored | ||||
|   | ||||
		Reference in New Issue
	
	Block a user