Merge "dib-lint: python3 compatibility fixes"

This commit is contained in:
Jenkins 2017-01-16 19:36:32 +00:00 committed by Gerrit Code Review
commit 084937617f
2 changed files with 11 additions and 7 deletions

View File

@ -34,11 +34,15 @@ parse_exclusions() {
# ignore = sete setu
section="dib-lint"
option="ignore"
global_exclusions=$(python -c \
"import ConfigParser; \
conf=ConfigParser.ConfigParser(); \
conf.read('tox.ini'); \
print conf.get('$section', '$option') if conf.has_option('$section', '$option') else ''"
global_exclusions=$(python - <<EOF
try:
import configparser
except ImportError:
import ConfigParser as configparser
conf=configparser.ConfigParser()
conf.read('tox.ini')
print(conf.get('$section', '$option')) if conf.has_option('$section', '$option') else ''
EOF
)
echo $exclusions $global_exclusions
}

View File

@ -45,7 +45,7 @@ def main():
if use_pypi_python_org:
indices.append('https://pypi.python.org/simple')
retries = os.environ.get('DIB_PIP_RETRIES')
with file(home + '/.pip/pip.conf', 'wt') as output:
with open(home + '/.pip/pip.conf', 'wt') as output:
output.write('[global]\n')
output.write('log = %s/pip.log\n' % (home,))
output.write('index-url = %s\n' % (indices[0],))
@ -53,7 +53,7 @@ def main():
output.write('retries = %s\n' % retries)
for index in indices[1:]:
output.write('extra-index-url = %s\n' % (index,))
with file(home + '/.pydistutils.cfg', 'wt') as output:
with open(home + '/.pydistutils.cfg', 'wt') as output:
output.write('[easy_install]\n')
output.write('index_url = %s\n' % (easy_index,))