diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-07-12 13:16:56 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-07-12 13:16:56 -0700 |
commit | f0b19822bace8a04fd2b5c2797ecfe387faf5ac7 (patch) | |
tree | f08b8531f633f66bc27b925899a130e6317b5551 | |
parent | 34b421c22cf2cc0a91bf9564e893ef0361ce5b5d (diff) | |
download | portage-f0b19822bace8a04fd2b5c2797ecfe387faf5ac7.tar.gz portage-f0b19822bace8a04fd2b5c2797ecfe387faf5ac7.tar.bz2 portage-f0b19822bace8a04fd2b5c2797ecfe387faf5ac7.zip |
filter-bash-environment.py: move imports to top
-rwxr-xr-x | bin/filter-bash-environment.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py index 5038c0789..b9aec96d0 100755 --- a/bin/filter-bash-environment.py +++ b/bin/filter-bash-environment.py @@ -1,9 +1,13 @@ #!/usr/bin/python -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import codecs -import os, re, sys +import io +import optparse +import os +import re +import sys here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$') func_start_re = re.compile(r'^[-\w]+\s*\(\)\s*$') @@ -122,8 +126,7 @@ if __name__ == "__main__": "intact. The PATTERN is a space separated list of variable names" + \ " and it supports python regular expression syntax." usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0]) - from optparse import OptionParser - parser = OptionParser(description=description, usage=usage) + parser = optparse.OptionParser(description=description, usage=usage) options, args = parser.parse_args(sys.argv[1:]) if len(args) != 1: parser.error("Missing required PATTERN argument.") @@ -132,7 +135,6 @@ if __name__ == "__main__": if sys.hexversion >= 0x3000000: file_in = codecs.iterdecode(sys.stdin.buffer.raw, 'utf_8', errors='replace') - import io file_out = io.TextIOWrapper(sys.stdout.buffer, 'utf_8', errors='backslashreplace') |