*/}}

GenerateAppimage.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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-x-executable
  9. version: v0.3a
  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 default_pallettes.udf ../OurPaintApp/OurPaint")
  57. os.system("cp COPYING ../OurPaintApp/OurPaint")
  58. os.system("cp COPYING_CC_BY_NC ../OurPaintApp/OurPaint")
  59. os.system("cp %s/.local/share/fonts/lagui/*.* ../OurPaintApp/OurPaint/fonts"%os.path.expanduser("~"))
  60. additional=""
  61. # bundle everything?
  62. #result = subprocess.check_output("ldd build/OurPaint", shell=True).decode("utf-8")
  63. #for ma in re.finditer(r".*\=\>\s(\S+)",result):
  64. # additional=additional+" - "+ma.group(1)+"\n"
  65. template=template.replace("---libs---",additional)
  66. additional="""
  67. - libfreetype6
  68. - liblcms2-2
  69. - libpng16-16
  70. - libglew2.1
  71. - libxi6
  72. - libxfixes3
  73. - libxcursor1
  74. - libxrandr2
  75. """
  76. template=template.replace("---includes---",additional)
  77. f=open("../OurPaintApp/AppImageBuilder.yml","w")
  78. f.write(template)
  79. f.close()
  80. f=open("../OurPaintApp/run.sh","w")
  81. f.write(script)
  82. f.close()
  83. #os.system("cd ../OurPaintApp/ && sh run.sh")
  84. #os.system("")