-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetenv.py
78 lines (55 loc) · 1.21 KB
/
setenv.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
'''
script to get environments variables
from: meta.yaml
takes setup_info variable if it exists.
Need a tidyer version at some point
but the nice thing is that it pronts expoirt env commands
eg
package:
name: uclgeog
version: 1.0.11
source:
git_rev: 1.0.0
git_url: https://github.com/UCL-EO/uclgeog
build:
noarch: python
number: 0
script: python -m pip install --no-deps --ignore-installed .
requirements:
build:
- python>=3.7
- setuptools
run:
- python
test:
imports:
- uclgeog
about:
home: https://github.com/UCL-EO/uclgeog
'''
import yaml
import json
import os
try:
if 'setup_info' not in locals():
setup_info = {
'readme' : 'This is autogenerated by setup.py: do not edit this file directly',
'url' : 'https://github.com/profLewis/uclgeog',
'version' : '1.0.11',
'meta' : 'meta.yaml',
'name' : 'uclgeog'
}
except:
# setup_info exists
setup_info = {}
try:
with open(setup_info['meta'],'r') as f:
info = yaml.safe_load(f);
except:
info = {}
# update setup_info with info
setup_info.update(info)
for i in setup_info.keys():
n_i = setup_info[i];
if ( i is not "readme"):
print(f'export {i}={n_i}');