*/}}

GenerateAppimage.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import os,subprocess,re
  2. template="""version: 1
  3. AppDir:
  4. path: /home/yiming/Documents/sync/Projects/2022/laprograms/app/AppDir
  5. app_info:
  6. id: chengdu.littlea.ourpaint
  7. name: OurPaint
  8. icon: application-vnd.appimage
  9. version: v0.1
  10. exec: OurPaint
  11. exec_args: $@
  12. apt:
  13. arch:
  14. - amd64
  15. allow_unauthenticated: true
  16. sources:
  17. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal main restricted
  18. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
  19. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal universe
  20. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe
  21. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal multiverse
  22. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse
  23. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  24. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted
  25. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal-security universe
  26. - sourceline: deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse
  27. include:
  28. - libc6:amd64
  29. - locales
  30. ---includes---
  31. files:
  32. include:
  33. - lib64/ld-linux-x86-64.so.2
  34. ---libs---
  35. exclude:
  36. - usr/share/man
  37. - usr/share/doc/*/README.*
  38. - usr/share/doc/*/changelog.*
  39. - usr/share/doc/*/NEWS.*
  40. - usr/share/doc/*/TODO.*
  41. AppImage:
  42. arch: x86_64
  43. update-information: guess
  44. """
  45. script="appimage-builder --recipe AppImageBuilder.yml"
  46. os.system("rm -rf ../OurPaintApp/AppDir")
  47. os.system("mkdir -p ../OurPaintApp/AppDir")
  48. os.system("cp build/OurPaint ../OurPaintApp/AppDir")
  49. additional=""
  50. # bundle everything?
  51. #result = subprocess.check_output("ldd build/OurPaint", shell=True).decode("utf-8")
  52. #for ma in re.finditer(r".*\=\>\s(\S+)",result):
  53. # additional=additional+" - "+ma.group(1)+"\n"
  54. template=template.replace("---libs---",additional)
  55. additional="""
  56. - libfreetype6
  57. - liblcms2-2
  58. - libpng16-16
  59. - libglew2.1
  60. """
  61. template=template.replace("---includes---",additional)
  62. f=open("../OurPaintApp/AppImageBuilder.yml","w")
  63. f.write(template)
  64. f.close()
  65. f=open("../OurPaintApp/run.sh","w")
  66. f.write(script)
  67. f.close()
  68. #os.system("cd ../OurPaintApp/ && sh run.sh")
  69. #os.system("")