/usr/bin/pep8_tap is in jenkins-debian-glue 0.16.0.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96  | #!/usr/bin/env ruby
# encoding: utf-8
# ruby1.8 doesn't provide Encoding, so make sure it's defined
if defined? Encoding
  output_encoding = Encoding.default_external
  Encoding.default_external = 'BINARY'
end
require 'yaml'
if ARGV[0].nil?
  $stderr.puts "Usage: #{File.basename $0} <file>"
  exit 1
end
if not system "which pep8 >/dev/null 2>&1"
  $stderr.puts "Error: program pep8 does not exist (install pep8 package)."
  exit 1
end
file = ARGV[0]
if not File.exists? file
  $stderr.puts "Error: file #{file} could not be read."
  exit 1
end
# Make sure we're looking at Python code.
mimetype = `file -b -i --keep-going #{file}`.gsub(/\n/,"")
if not /.*x-python/i.match(mimetype)
  $stderr.puts "File #{file} doesn't look like Python [#{mimetype}]. Ignoring."
  exit 0
end
ISSUE_PREFIX = 'ISSUE:'
output = %x{pep8 -r --show-source --format 'ISSUE:%(path)s:%(row)d:%(col)d: %(code)s %(text)s' #{file} 2>&1}
def is_issue_line(l)
  l.start_with?(ISSUE_PREFIX)
end
class Issue
  def initialize(firstline, file)
    @firstline = firstline.sub(ISSUE_PREFIX, '')
    @file = file
    @source = []
    @code = @firstline.split(': ', 3)[1]
    @severity = case @code[0]
      when 'E'
        'error'
      when 'W'
        'warning'
      end
  end
  def add_source(line)
    @source << line
  end
  def format(counter)
    body = YAML.dump({
      'message' => @firstline,
      'severity' => @severity,
      'code' => @code,
      'source' => @source.join("\n"),
      'file' => @file
    }) + '...'  # end of yaml
    return ("not ok #{counter} #{@firstline}\n  " + body.gsub("\n","\n  "))
  end
end
issues = []
output.each_line do |l|
  if defined? Encoding
    l = l.rstrip().encode(output_encoding, {:invalid => :replace, :undef => :replace})
  else
    l = l.rstrip()
  end
  if is_issue_line(l)
    issues << Issue.new(l, file)
  else
    issues.last.add_source(l) unless issues.last.nil?
  end
end
exit 0 if issues.length == 0
# output result in TAP format
puts "TAP version 13"
puts "1..#{issues.length}"
issues.each_index do |idx|
  puts issues[idx].format(idx+1)
end
 |