-
Notifications
You must be signed in to change notification settings - Fork 7
/
installer.py
43 lines (35 loc) · 1002 Bytes
/
installer.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
# -*- coding: utf-8 -*-
#-------------------------------------------------
#-- plugin loader
#--
#-- microelly 2015
#--
#-- GNU Lesser General Public License (LGPL)
#-------------------------------------------------
# first install
source='https://github.com/microelly2/freecad-pluginloader/archive/master.zip'
import os, tempfile
d=tempfile.mktemp()
os.makedirs(d)
fn = tempfile.mktemp(dir=d)
zipfilename=fn+'.zip'
storedir=fn
import os, urllib, shutil,zipfile
def st1():
tg=urllib.urlretrieve(source,zipfilename)
fh = open(zipfilename, 'rb')
zfile = zipfile.ZipFile(fh)
zfile.extractall(storedir)
path0=storedir+'/freecad-pluginloader-master/'
for path, dirs, files in os.walk(path0):
rp= path.replace(path0,'')
directory=FreeCAD.ConfigGet('UserAppData')+'/Mod/plugins/' + rp
print directory
if not os.path.exists(directory):
os.makedirs(directory)
print files
for f in files:
shutil.move(path + "/"+ f, directory+'/' + f)
print zipfilename
print storedir
st1()