forked from web2py/web2py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpplugin.py
More file actions
32 lines (30 loc) · 855 Bytes
/
Copy pathcpplugin.py
File metadata and controls
32 lines (30 loc) · 855 Bytes
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
import sys
import glob
import os
import shutil
name = sys.argv[1]
app = sys.argv[2]
dest = sys.argv[3]
a = glob.glob(
'applications/%(app)s/*/plugin_%(name)s.*' % dict(app=app, name=name))
b = glob.glob(
'applications/%(app)s/*/plugin_%(name)s/*' % dict(app=app, name=name))
for f in a:
print 'cp %s ...' % f,
shutil.copyfile(f, os.path.join('applications', dest, *f.split('/')[2:]))
print 'done'
for f in b:
print 'cp %s ...' % f,
path = f.split('/')
for i in range(3, len(path)):
try:
os.mkdir(os.path.join('applications', dest, *path[2:i]))
except:
pass
path = os.path.join('applications', dest, *f.split('/')[2:])
if os.path.isdir(f):
if not os.path.exists(path):
shutil.copytree(f, path)
else:
shutil.copyfile(f, path)
print 'done'