Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import os
- import subprocess
- os.chdir("/var/lib/gtk-typeahead/")
- proc = subprocess.Popen("dpkg -s libgtk-3-0", stdout = subprocess.PIPE, shell=True)
- out = proc.communicate()[0].decode()
- gtk_ubuntu_version = out.split("\nVersion: ", 1)[1].split("\n")[0]
- gtk_real_version = gtk_ubuntu_version.split("ubuntu")[0].split("-")[0]
- major, minor, revision, rest = (gtk_real_version + ".").split(".", 4)
- int(major)
- int(minor)
- int(revision)
- print(f"wget https://download.gnome.org/sources/gtk+/{major}.{minor}/gtk%2B-{major}.{minor}.{revision}.tar.xz -O gtk.tar.xz")
- os.system(f"wget https://download.gnome.org/sources/gtk+/{major}.{minor}/gtk%2B-{major}.{minor}.{revision}.tar.xz -O gtk.tar.xz")
- for i in os.listdir("./"):
- if os.path.isdir(i):
- raise Exception(f"{i} is a directory, unable to continue")
- os.system("tar xf gtk.tar.xz")
- extract_path = None
- for i in os.listdir("./"):
- if os.path.isdir(i):
- extract_path = i
- break
- os.chdir(extract_path)
- os.system("patch gtk/gtkfilechooserwidget.c /var/lib/gtk-typeahead/file-chooser__typeahead.patch")
- os.system("./configure")
- os.system("make")
- os.system("make install")
- os.chdir("/var/lib/gtk-typeahead/")
- assert "/" not in extract_path
- assert ".." not in extract_path
- assert "$" not in extract_path
- os.system(f"rm -r {extract_path}")
- if os.path.exists("typeahead-patch.version"):
- os.remove("typeahead-patch.version")
- with open("typeahead-patch.version", "w") as fhandle:
- fhandle.write(gtk_ubuntu_version + "\n")
Advertisement
Add Comment
Please, Sign In to add comment