Advertisement
here2share

py2sis_by_redsymbzone

Jul 24th, 2017
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #by redsymbzone (please help: *** missing lite_fm module ***)
  2. from lite_fm import*
  3. import os,e32
  4. def copy(x,y):
  5.  e32.file_copy(x,y)
  6.  print "copy "+y+"\r\nin "+x+"\r\n"
  7.  e32.ao_yield()
  8. def create():
  9.  apps=manager("e:/system/apps","dir")
  10.  if apps==None:return "not select programs"
  11.  if len(os.path.split(apps)[1])>10:return "name programs is long"
  12.  apps+="\\"
  13.  if not os.path.exists(apps+"default.py"):return "default.py not exists"
  14.  os.makedirs(apps+"libs\\encodings")
  15.  for drive in ["c:\\system\\","e:\\system\\"]:
  16.   for dll in [("python222.dll","libs\\python222.dll"),("python_appui.dll","libs\\python_appui.dll"),("ui.rsc","data\\appuifwmodule.rsc")]:
  17.    if os.path.exists(drive+dll[1]):copy(apps+dll[0],drive+dll[1])
  18.   for path in ["libs\\","libs\\encodings\\"]:
  19.    try:sp=os.listdir(drive+path)
  20.    except:continue
  21.    for name in sp:
  22.     name=name.lower()
  23.     if os.path.splitext(name)[1] in [".py",".pyc",".pyd"]:copy(apps+path+name,drive+path+name)
  24.  f=open(apps+"python_appui.dll","r+")
  25.  txt=f.read()
  26.  i=txt.find("\x00".join(list("data\\appuifwmodule.rsc")))
  27.  f.seek(i)
  28.  nt="\x00".join(list("apps\\"+os.path.split(apps[:-1])[1]+"\\ui.rsc"))
  29.  nt+=((43-len(nt))/2)*"\x00\x20"
  30.  f.write(nt),f.close()
  31.  f=open(apps+"default.py","r+")
  32.  txt=f.read()
  33.  f.seek(0)
  34.  apps=apps[1:-1].replace("\\","\\\\")
  35.  f.write('import sys\r\nsys.path=["c'+apps+'","e'+apps+'","c'+apps+'\\\\libs","e'+apps+'\\\\libs"]\r\n'+txt)
  36.  f.close()
  37.  return "ok"
  38. print create()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement