*/}}

GenerateAppimage.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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: latest
  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. """
  60. template=template.replace("---includes---",additional)
  61. f=open("../OurPaintApp/AppImageBuilder.yml","w")
  62. f.write(template)
  63. f.close()
  64. f=open("../OurPaintApp/run.sh","w")
  65. f.write(script)
  66. f.close()
  67. #os.system("cd ../OurPaintApp/ && sh run.sh")
  68. #os.system("")