Skip to content

Commit

Permalink
revisit ci/bootstrap.py
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Mar 8, 2019
1 parent 912c27d commit 1b67d1b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ci/bootstrap.py
@@ -1,14 +1,19 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

import os
import subprocess
import sys
from os.path import abspath
from os.path import dirname
from os.path import exists
from os.path import join

import jinja2

if __name__ == "__main__":
base_path = dirname(dirname(abspath(__file__)))
print("Project path: {0}".format(base_path))
Expand All @@ -18,8 +23,6 @@
else:
bin_path = join(env_path, "bin")
if not exists(env_path):
import subprocess

print("Making bootstrap env in: {0} ...".format(env_path))
try:
subprocess.check_call(["virtualenv", env_path])
Expand All @@ -32,10 +35,6 @@
print("Re-executing with: {0}".format(python_executable))
os.execv(python_executable, [python_executable, __file__])

import jinja2

import subprocess

jinja = jinja2.Environment(
loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")),
trim_blocks=True,
Expand All @@ -48,11 +47,14 @@
# WARNING: 'tox' must be installed globally or in the project's virtualenv
for line in subprocess.check_output(['tox', '--listenvs'], universal_newlines=True).splitlines()
]
tox_environments = [line for line in tox_environments if line not in ['clean', 'report', 'docs', 'check']]
tox_environments = [line for line in tox_environments
if line not in ['clean', 'report', 'docs', 'check']]

template_vars = {'tox_environments': tox_environments}
for py_ver in '27 34 35 py'.split():
template_vars['py%s_environments' % py_ver] = [x for x in tox_environments if x.startswith('py' + py_ver)]
template_vars['py%s_environments' % py_ver] = [
x for x in tox_environments
if x.startswith('py' + py_ver)]

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

0 comments on commit 1b67d1b

Please sign in to comment.