|
1 | 1 | #!/usr/bin/env python |
2 | 2 | # -*- 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 |
4 | 6 |
|
5 | 7 | import os |
| 8 | +import subprocess |
6 | 9 | import sys |
7 | 10 | from os.path import abspath |
8 | 11 | from os.path import dirname |
9 | 12 | from os.path import exists |
10 | 13 | from os.path import join |
11 | 14 |
|
| 15 | +import jinja2 |
| 16 | + |
12 | 17 | if __name__ == "__main__": |
13 | 18 | base_path = dirname(dirname(abspath(__file__))) |
14 | 19 | print("Project path: {0}".format(base_path)) |
|
18 | 23 | else: |
19 | 24 | bin_path = join(env_path, "bin") |
20 | 25 | if not exists(env_path): |
21 | | - import subprocess |
22 | | - |
23 | 26 | print("Making bootstrap env in: {0} ...".format(env_path)) |
24 | 27 | try: |
25 | 28 | subprocess.check_call(["virtualenv", env_path]) |
|
32 | 35 | print("Re-executing with: {0}".format(python_executable)) |
33 | 36 | os.execv(python_executable, [python_executable, __file__]) |
34 | 37 |
|
35 | | - import jinja2 |
36 | | - |
37 | | - import subprocess |
38 | | - |
39 | 38 | jinja = jinja2.Environment( |
40 | 39 | loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")), |
41 | 40 | trim_blocks=True, |
|
48 | 47 | # WARNING: 'tox' must be installed globally or in the project's virtualenv |
49 | 48 | for line in subprocess.check_output(['tox', '--listenvs'], universal_newlines=True).splitlines() |
50 | 49 | ] |
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']] |
52 | 52 |
|
53 | 53 | template_vars = {'tox_environments': tox_environments} |
54 | 54 | 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)] |
56 | 58 |
|
57 | 59 | for name in os.listdir(join("ci", "templates")): |
58 | 60 | with open(join(base_path, name), "w") as fh: |
|
0 commit comments