author Mantaroh Yoshinaga <>
Fri, 13 Oct 2017 09:46:39 +0900
changeset 385979 0466471b9f67aa6a60bf3fb98515532e8a53095d
parent 370639 f91d86bb4b2adad09711ce55c82c8d695b8e6ed7
child 392065 dd760c2491227a402bccad9c6e25b3313ae52df5
permissions -rwxr-xr-x
Bug 1185236 - Shorten print job name when GTK version is older than 3.18.2. r=karlt Since GTK 3.18.2, GTK allows setting job name with more than 255 bytes. As result, CUPS received the IPP error. (RFC 2911, Section 4.3.1) This patch will shorten print job name, if runtime GTK version is older than 3.18.2. MozReview-Commit-ID: EfB87Bvo6hX

#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

import os
import subprocess
import sys
from distutils.spawn import find_executable

here = os.path.dirname(os.path.realpath(__file__))
topsrcdir = os.path.join(here, os.pardir, os.pardir)

def run_mozlint(hooktype, args):
    # --quiet prevents warnings on eslint, it will be ignored by other linters
    python = find_executable('python2.7') or find_executable('python')
    cmd = [python, os.path.join(topsrcdir, 'mach'), 'lint', '--quiet']

    if 'commit' in hooktype:
        # don't prevent commits, just display the lint results + ['--workdir=staged'])
        return False
    elif 'push' in hooktype:
        return + ['--outgoing'] + args)

    print("warning: '{}' is not a valid mozlint hooktype".format(hooktype))
    return False

def hg(ui, repo, **kwargs):
    hooktype = kwargs['hooktype']
    return run_mozlint(hooktype, kwargs.get('pats', []))

def git(args=sys.argv[1:]):
    hooktype = os.path.basename(__file__)
    return run_mozlint(hooktype, args[:1])

if __name__ == '__main__':