forked from open-geocomputing/OpenEarthEngineLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenearteOpenEEL.py
38 lines (30 loc) · 1.26 KB
/
genearteOpenEEL.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
import json
import os
from datetime import datetime
repo=os.environ['GEE_REPO_ADDRESS'];
def generateDictionary(requirePath,path,dirList):
val={};
for toExplore in dirList:
if(toExplore[0]=='_'):
continue;
if(os.path.isdir(os.path.join(path, toExplore))):
val[toExplore]=generateDictionary(requirePath+toExplore+'/',path+'/'+toExplore,os.listdir(path+'/'+toExplore));
else:
val[toExplore]='require(\''+requirePath+toExplore+'\')';
return val;
val=generateDictionary(repo+':/','.',
[ name for name in os.listdir('.') if os.path.isdir(os.path.join('.', name)) and name[0]!='.' ]+['internal']);
libString='var libs='+json.dumps(val).replace('"','')+\
'\n\n//generated automatically the '+str(datetime.utcnow())+\
'UTC \n\n'+'exports=libs.internal.setupLibrary(libs);';
text_file = open("loadAll", "w")
text_file.write(libString)
text_file.close()
val=generateDictionary('./','.',
[ name for name in os.listdir('.') if os.path.isdir(os.path.join('.', name)) and name[0]!='.' ]+['internal']);
libString='var libs='+json.dumps(val).replace('"','')+\
'\n\n//generated automatically the '+str(datetime.utcnow())+\
'UTC \n\n'+'exports.all=libs.internal.setupLibrary(libs);';
text_file = open("loadAll4py", "w")
text_file.write(libString)
text_file.close()