- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.py
More file actions
Latest commit
executable file
·59 lines (54 loc) · 2.25 KB
/
Copy pathbootstrap.py
File metadata and controls
executable file
·59 lines (54 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
if__name__=='__main__':
importos
importsys
ifnotos.path.exists('.tox/configure'):
importsubprocess
print("Bootstrapping ...")
subprocess.check_call(['python', '-mvirtualenv', '.tox/configure'])
print("Installing `jinja2` and `matrix` into bootstrap environment ...")
ifsys.platform=='win32':
subprocess.check_call([r'.tox\configure\Scripts\pip', 'install', 'jinja2', 'matrix'])
else:
subprocess.check_call(['.tox/configure/bin/pip', 'install', 'jinja2', 'matrix'])
ifsys.platform=='win32':
exec(compile(
open(r'.tox\configure\Scripts\activate_this.py').read(),
r'.tox\configure\Scripts\activate_this.py',
'exec'
), dict(__file__=r'.tox\configure\Scripts\activate_this.py'))
else:
exec(compile(
open('.tox/configure/bin/activate_this.py').read(),
'.tox/configure/bin/activate_this.py',
'exec'
), dict(__file__='.tox/configure/bin/activate_this.py'))
importjinja2
importmatrix
jinja=jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.join('ci', 'templates')),
trim_blocks=True,
lstrip_blocks=True,
keep_trailing_newline=True
)
tox_environments= {}
foralias, confinmatrix.from_file('setup.cfg').items():
python=conf['python_versions']
deps=conf['dependencies']
if'coverage_flags'inconf:
cover= {'false': False, 'true': True}[conf['coverage_flags'].lower()]
if'environment_variables'inconf:
env_vars=conf['environment_variables']
tox_environments[alias] = {
'python': 'python'+pythonif'py'notinpythonelsepython,
'deps': deps.split(),
}
if'coverage_flags'inconf:
tox_environments[alias].update(cover=cover)
if'environment_variables'inconf:
tox_environments[alias].update(env_vars=env_vars.split())
fornameinos.listdir(os.path.join('ci', 'templates')):
withopen(name, 'w') asfh:
fh.write(jinja.get_template(name).render(tox_environments=tox_environments))
print("Wrote %s"%name)
print("DONE.")