Skip to content

Commit 1b67d1b

Browse files
committed
revisit ci/bootstrap.py
1 parent 912c27d commit 1b67d1b

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

ci/bootstrap.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
from __future__ import absolute_import, print_function, unicode_literals
3+
from __future__ import absolute_import
4+
from __future__ import print_function
5+
from __future__ import unicode_literals
46

57
import os
8+
import subprocess
69
import sys
710
from os.path import abspath
811
from os.path import dirname
912
from os.path import exists
1013
from os.path import join
1114

15+
import jinja2
16+
1217
if __name__ == "__main__":
1318
base_path = dirname(dirname(abspath(__file__)))
1419
print("Project path: {0}".format(base_path))
@@ -18,8 +23,6 @@
1823
else:
1924
bin_path = join(env_path, "bin")
2025
if not exists(env_path):
21-
import subprocess
22-
2326
print("Making bootstrap env in: {0} ...".format(env_path))
2427
try:
2528
subprocess.check_call(["virtualenv", env_path])
@@ -32,10 +35,6 @@
3235
print("Re-executing with: {0}".format(python_executable))
3336
os.execv(python_executable, [python_executable, __file__])
3437

35-
import jinja2
36-
37-
import subprocess
38-
3938
jinja = jinja2.Environment(
4039
loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")),
4140
trim_blocks=True,
@@ -48,11 +47,14 @@
4847
# WARNING: 'tox' must be installed globally or in the project's virtualenv
4948
for line in subprocess.check_output(['tox', '--listenvs'], universal_newlines=True).splitlines()
5049
]
51-
tox_environments = [line for line in tox_environments if line not in ['clean', 'report', 'docs', 'check']]
50+
tox_environments = [line for line in tox_environments
51+
if line not in ['clean', 'report', 'docs', 'check']]
5252

5353
template_vars = {'tox_environments': tox_environments}
5454
for py_ver in '27 34 35 py'.split():
55-
template_vars['py%s_environments' % py_ver] = [x for x in tox_environments if x.startswith('py' + py_ver)]
55+
template_vars['py%s_environments' % py_ver] = [
56+
x for x in tox_environments
57+
if x.startswith('py' + py_ver)]
5658

5759
for name in os.listdir(join("ci", "templates")):
5860
with open(join(base_path, name), "w") as fh:

0 commit comments

Comments
 (0)