Merge pull request #354 from mrorii/master

Detect Cython-generated C/C++ files
This commit is contained in:
Ted Nyman
2013-02-25 17:11:17 -08:00
4 changed files with 20361 additions and 1 deletions

View File

@@ -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

File diff suppressed because it is too large Load Diff

15669
samples/C/sgd_fast.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -190,6 +190,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