1
1
#
2
2
# Copyright (c) 2017, Enthought, Inc.
3
- # Copyright (c) 2019, John Wiggins
3
+ # Copyright (c) 2019-2021 John Wiggins
4
4
# All rights reserved.
5
5
#
6
6
# This software is provided without warranty under the terms of the BSD
17
17
18
18
import click
19
19
20
- dependencies = {
20
+ DEPENDENCIES = {
21
21
'cython' ,
22
22
'numpy' ,
23
23
}
24
+ CONFIG_FILE = os .path .abspath (
25
+ os .path .join (os .path .dirname (__file__ ), '.edm.yaml' )
26
+ )
24
27
25
28
26
29
@click .group ()
@@ -35,11 +38,11 @@ def install(runtime, environment):
35
38
""" Install project and dependencies into a clean EDM environment.
36
39
"""
37
40
parameters = get_parameters (runtime , environment )
38
- parameters ['packages' ] = ' ' .join (dependencies )
41
+ parameters ['packages' ] = ' ' .join (DEPENDENCIES )
39
42
# edm commands to setup the development environment
40
43
commands = [
41
- "edm environments create {environment} --force --version={runtime}" ,
42
- "edm install -y -e {environment} {packages}" ,
44
+ "{ edm} environments create {environment} --force --version={runtime}" ,
45
+ "{ edm} install -y -e {environment} {packages}" ,
43
46
"edm run -e {environment} -- pip install cmake" ,
44
47
"edm run -e {environment} -- pip install -e ." ,
45
48
]
@@ -88,15 +91,19 @@ def cleanup(runtime, environment):
88
91
89
92
def get_parameters (runtime , environment ):
90
93
""" Set up parameters dictionary for format() substitution """
91
- parameters = {'runtime' : runtime , 'environment' : environment }
94
+ parameters = {
95
+ 'runtime' : runtime ,
96
+ 'environment' : environment ,
97
+ 'edm' : 'edm --config {}' .format (CONFIG_FILE ),
98
+ }
92
99
if environment is None :
93
100
parameters ['environment' ] = 'blend2d-{runtime}' .format (** parameters )
94
101
return parameters
95
102
96
103
97
104
def execute (commands , parameters ):
98
105
for command in commands :
99
- print "[EXECUTING]" , command .format (** parameters )
106
+ click . echo ( "[EXECUTING]" + command .format (** parameters ) )
100
107
try :
101
108
subprocess .check_call (command .format (** parameters ).split ())
102
109
except subprocess .CalledProcessError :
0 commit comments