pash: store user in a variable; r=bkero
os.getenv('USER') was used multiple times in this file. The content of
the environment variable doesn't change during execution. So get the
value once and store it in a variable.
Also, os.environ is the preferred mechanism to access environment
variables from Python. os.getenv is a low-level API into the POSIX
function of the same name. The difference doesn't matter in this use
case, so use the method that is more accepted by the Python community.
#!/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 http://mozilla.org/MPL/2.0/.
import os
import sys
def main(args):
from mach.main import Mach
m = Mach(os.getcwd())
m.define_category('reviewboard', 'Review Board',
'Interface with Review Board', 50)
import vcttesting.reviewboard.mach_commands
return m.run(args)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))