Merge pull request #7141 from iMichka/regex

rewrite_python_shebang: make version part optional
This commit is contained in:
Michka Popoff 2020-03-10 22:29:54 +01:00 committed by GitHub
commit 30c4383e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ module Language
end
def self.rewrite_python_shebang(python_path)
regex = %r{^#! ?/usr/bin/(env )?python([23](\.\d{1,2})?)$}
regex = %r{^#! ?/usr/bin/(env )?python([23](\.\d{1,2})?)?$}
maximum_regex_length = 28 # the length of "#! /usr/bin/env pythonx.yyy$"
Pathname(".").find do |f|
next unless f.file?