issue 632, make_min_web2py on windws, thanks mweissen
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 1.99.4 (2012-01-24 08:31:01) stable
|
Version 1.99.4 (2012-01-24 08:32:11) stable
|
||||||
|
|||||||
@@ -41,39 +41,48 @@ gluon/contrib/pysimplesoap/
|
|||||||
import sys, os, shutil, glob
|
import sys, os, shutil, glob
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
global REQUIRED, IGNORED
|
||||||
|
|
||||||
if len(sys.argv)<2:
|
if len(sys.argv)<2:
|
||||||
print USAGE
|
print USAGE
|
||||||
|
|
||||||
# make target folder
|
# make target folder
|
||||||
target = sys.argv[1]
|
target = sys.argv[1]
|
||||||
os.mkdir(target)
|
os.mkdir(target)
|
||||||
|
|
||||||
|
# change to os specificsep
|
||||||
|
REQUIRED = REQUIRED.replace('/',os.sep)
|
||||||
|
IGNORED = IGNORED.replace('/',os.sep)
|
||||||
|
|
||||||
|
|
||||||
# make a list of all files to include
|
# make a list of all files to include
|
||||||
files = [x.strip() for x in REQUIRED.split('\n') \
|
files = [x.strip() for x in REQUIRED.split('\n') \
|
||||||
if x and not x[0]=='#']
|
if x and not x[0]=='#']
|
||||||
ignore = [x.strip() for x in IGNORED.split('\n') \
|
ignore = [x.strip() for x in IGNORED.split('\n') \
|
||||||
if x and not x[0]=='#']
|
if x and not x[0]=='#']
|
||||||
|
|
||||||
def accept(filename):
|
def accept(filename):
|
||||||
for p in ignore:
|
for p in ignore:
|
||||||
if filename.startswith(p):
|
if filename.startswith(p):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
pattern = 'gluon/*.py'
|
pattern = os.path.join('gluon','*.py')
|
||||||
while True:
|
while True:
|
||||||
newfiles = [x for x in glob.glob(pattern) if accept(x)]
|
newfiles = [x for x in glob.glob(pattern) if accept(x)]
|
||||||
if not newfiles: break
|
if not newfiles: break
|
||||||
files += newfiles
|
files += newfiles
|
||||||
pattern = pattern[:-3]+'/*.py'
|
pattern = os.path.join(pattern[:-3],'*.py')
|
||||||
# copy all files, make missing folder, build default.py
|
# copy all files, make missing folder, build default.py
|
||||||
files.sort()
|
files.sort()
|
||||||
|
defaultpy = os.path.join('applications','welcome','controllers','default.py')
|
||||||
for f in files:
|
for f in files:
|
||||||
dirs = f.split(os.path.sep)
|
dirs = f.split(os.path.sep)
|
||||||
for i in range(1,len(dirs)):
|
for i in range(1,len(dirs)):
|
||||||
try: os.mkdir(target+'/'+os.path.join(*dirs[:i]))
|
try: os.mkdir(target+os.sep+os.path.join(*dirs[:i]))
|
||||||
except OSError: pass
|
except OSError: pass
|
||||||
if f=='applications/welcome/controllers/default.py':
|
if f==defaultpy:
|
||||||
open(target+'/'+f,'w').write('def index(): return "hello"\n')
|
open(os.path.join(target,f),'w').write('def index(): return "hello"\n')
|
||||||
else:
|
else:
|
||||||
shutil.copyfile(f,target+'/'+f)
|
shutil.copyfile(f,os.path.join(target,f))
|
||||||
|
|
||||||
if __name__=='__main__': main()
|
if __name__=='__main__': main()
|
||||||
|
|||||||
Reference in New Issue
Block a user