sweeCrypt-GTK/generate-deb.py
2024-09-12 17:03:56 -07:00

14 lines
No EOL
719 B
Python

#!/usr/bin/python3
import os
print("Creating Debian package...")
if os.name != "posix":
print("WARNING: Machine is not running Linux (value of os.name is not \"posix\"), the script will not try to auto-build the .deb file. You might need to manually `chmod 1777` the binary.")
file = open("sweecrypt-gtk.py").read().split("\n")
open("dpkg/opt/sweecrypt-gtk.ui",'w').write(open("sweecrypt-gtk.ui").read())
file[3] = 'UI_FILE = "/opt/sweecrypt-gtk.ui"'
file.insert(0, "#!/usr/bin/env python3")
file = "\n".join(file)
open("dpkg/usr/bin/sweecrypt-gtk",'w').write(file)
os.system("chmod 1777 dpkg/usr/bin/sweecrypt-gtk")
if os.name == "posix":
os.system("dpkg-deb --root-owner-group --build dpkg sweecrypt-gtk.deb")