*/}}

GenerateAppimage.py 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. mv OurPaint*.AppImage OurPaint/
  47. tar -cvzf OurPaint.tar.gz OurPaint/
  48. """
  49. os.system("rm -rf ../OurPaintApp/AppDir")
  50. os.system("rm -rf ../OurPaintApp/OurPaint")
  51. os.system("mkdir -p ../OurPaintApp/AppDir")
  52. os.system("mkdir -p ../OurPaintApp/OurPaint/fonts")
  53. os.system("cp build/OurPaint ../OurPaintApp/AppDir")
  54. os.system("cp README.md ../OurPaintApp/OurPaint")
  55. os.system("cp default_brushes.udf ../OurPaintApp/OurPaint")
  56. os.system("cp COPYING ../OurPaintApp/OurPaint")
  57. os.system("cp COPYING_CC_BY_NC ../OurPaintApp/OurPaint")
  58. os.system("cp %s/.local/share/fonts/lagui/*.* ../OurPaintApp/OurPaint/fonts"%os.path.expanduser("~"))
  59. additional=""
  60. # bundle everything?
  61. #result = subprocess.check_output("ldd build/OurPaint", shell=True).decode("utf-8")
  62. #for ma in re.finditer(r".*\=\>\s(\S+)",result):
  63. # additional=additional+" - "+ma.group(1)+"\n"
  64. template=template.replace("---libs---",additional)
  65. additional="""
  66. - libfreetype6
  67. - liblcms2-2
  68. - libpng16-16
  69. - libglew2.1
  70. - libxi6
  71. """
  72. template=template.replace("---includes---",additional)
  73. f=open("../OurPaintApp/AppImageBuilder.yml","w")
  74. f.write(template)
  75. f.close()
  76. f=open("../OurPaintApp/run.sh","w")
  77. f.write(script)
  78. f.close()
  79. #os.system("cd ../OurPaintApp/ && sh run.sh")
  80. #os.system("")