Posts Tagged ‘python’

cvs status parser script

Sunday, January 31st, 2010

As other people already found out, the cvs status output sucks pretty much. I found some simple bash scripts to make them a little more useful, but then I quickly wrote a simple MIT-licensed python script that creates an output like modern scms do. It can be downloaded from my Fedorapeople space. Luckily Fedora will anyhow move to git, soon, so I won’t have to use CVS that much anymore then.

It will fail, if files are in a state unknown to the script, but it should cover the most common states (read: the states I found in my cvs checkout). Feel free to report any states that it should handle and I’ll update it.
Here is some example output (I defined an cvss alias for it):

$ cvss
? unknown
O common/Makefile.common
O devel/Makefile
? devel/xz-4.999.8beta
? devel/xz-4.999.8beta.tar.gz
M devel/xz.spec
O EL-5/Makefile

As you can see, it sorts the output and also handles subdirs

vnc viewer with unix domain socket support

Tuesday, December 9th, 2008

qemu has this nice feature to open a vnc server, that listens on a unix domain socket. I failed to find a vnc viewer to support connecting to this on Fedora, but the helpful people in #qemu on freenode pointed me gtk-vnc. It is only a library, but it comes with a python example client. It cannot yet open unix domain sockets, but gtk-vnc supports using a file descriptor, instead of connection to a host.. A simple change made it open a unix domain socket from a path, that is given as the first argument:


--- /usr/share/doc/gtk-vnc-python-0.3.7/gvncviewer.py 2008-09-05 14:32:15.000000000 +0200
+++ gvncviewer.py 2008-12-09 16:16:10.000000000 +0100
@@ -164,7 +190,13 @@
port = "5900"
print "Connecting to %s %s" % (host, port)

-vnc.open_host(host, port)
+import socket
+domain_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
+domain_sock.connect(sys.argv[1])
+
+
+# vnc.open_host(host, port)
+vnc.open_fd(domain_sock.fileno())
vnc.connect("vnc-pointer-grab", vnc_grab, window)
vnc.connect("vnc-pointer-ungrab", vnc_ungrab, window)