From 56bfde998b1f10895a31b9b3d5097ad7962fc47f Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 20 Nov 2014 12:28:30 -0500 Subject: [PATCH] Only strip minor version off of interpreters This used to turn `python2.4` into `python`, which causes trouble with `perl6`, which is a different language definition. --- lib/linguist/languages.yml | 1 + lib/linguist/samples.rb | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 307bd24d..7e8aecc6 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2013,6 +2013,7 @@ Python: - wscript interpreters: - python + - python2 Python traceback: type: data diff --git a/lib/linguist/samples.rb b/lib/linguist/samples.rb index ca91dc15..2d72296a 100644 --- a/lib/linguist/samples.rb +++ b/lib/linguist/samples.rb @@ -133,10 +133,8 @@ module Linguist script = script == 'env' ? tokens[1] : script - # "python2.6" -> "python" - if script =~ /((?:\d+\.?)+)/ - script.sub! $1, '' - end + # "python2.6" -> "python2" + script.sub! $1, '' if script =~ /(\.\d+)$/ # Check for multiline shebang hacks that call `exec` if script == 'sh' &&