A Crux port (and patch) for Charm

For about six months now I’ve been using Charm almost exclusively to write and maintain this blog, and most of that time in Crux. I never put together a proper Crux port for it, though. Part of the reason was that version 1.9.1 required a quick patching to work properly with WordPress; I generally just hand-edited it and installed it manually.

But I might as well dive in and do it correctly. So here is a patch for Charm that basically mimics the suggestions made by reacocard almost seven months ago, about shifting the modules slightly to avoid the errors that appear when using this with WordPress.com.

--- ljcharm.py	2009-01-12 06:21:15.000000000 +0900
+++ ljcharm.py.edit	2009-08-14 20:38:48.000000000 +0900
@@ -41,13 +41,12 @@
 import md5
 import urllib
 import calendar
-
+import httplib
+import base64
+import datetime
+import sha
 try:
     import feedparser
-    import httplib
-    import base64
-    import datetime
-    import sha
     atom_ok = 1
 except:
     atom_ok = 0

I don’t patch things very often, so if I’m doing it wrong, please don’t laugh. Points on protocol or suggestions on how to do things properly are, of course, welcomed. I usually save that as charm-1.9.1.ljcharm.py.diff, not having any more experience than to follow some random naming conventions I found somewhere on ibiblio.org. After that I just plop it in /usr/ports/local/charm/.

And here’s the Crux port, in case you are among the minority who use it, and among the even slimmer minority who want to install Charm. :mrgreen:

# Description:	Charm is a full-featured, cross-platfom blogging client for LiveJournal, Atom (Movable Type, Blogger), and MetaWeb (WordPress).
# URL:		http://ljcharm.sourceforge.net/
# Maintainer:	K.Mandla, k dot mandla at gmail dot com
# Depends on:	python

name=charm
version=1.9.1
release=1
source=(http://downloads.sourceforge.net/project/ljcharm/$name/$name-$version/$name-$version.tar.gz
	http://omploader.org/vMjVrMQ/charm-1.9.1.ljcharm.py.diff)

build() {
	cd $name-$version
	patch ljcharm.py < ../charm-1.9.1.ljcharm.py.diff
	python setup.py install --home=$PKG/usr

}

Ordinarily I would just swipe the corresponding PKGBUILD for Charm out of AUR and use Colin Zheng‘s converter to make a Pkgfile, but this time I had the patch to contend with anyway. So this is original work, in a strange sense. 😉

P.S.: I submitted the patch, but it’s a little embarrassing. 😐

3 thoughts on “A Crux port (and patch) for Charm

  1. hardikmehta

    Some how, charm doesn’t work for me. I get following error about not being able to encode a character ‘u\xa0’

    I don’t find anything on internet about the error.

    Enter entry number: 4

    Selected. Retrieving…
    Traceback (most recent call last):
    File “/usr/bin/charm”, line 14, in
    ljcharm.main()
    File “/usr/share/charm/ljcharm.py”, line 6221, in main
    jobj.do_metaweb(opts, resumeold, xpostfile, template, quick_opt)
    File “/usr/share/charm/ljcharm.py”, line 5783, in do_metaweb
    self.main_blog(opts, resumeold, xpostfile, template, quick_opt)
    File “/usr/share/charm/ljcharm.py”, line 5531, in main_blog
    self.blog_menu()
    File “/usr/share/charm/ljcharm.py”, line 5484, in blog_menu
    repeat_ok = self.Blogger.blog_pick_edit_menu()
    File “/usr/share/charm/ljcharm.py”, line 5769, in metaweb_pick_edit_menu
    return self.metaweb_get_post(server, entry[“postid”])Enter entry number: 4

    Selected. Retrieving…
    Traceback (most recent call last):
    File “/usr/bin/charm”, line 14, in
    ljcharm.main()
    File “/usr/share/charm/ljcharm.py”, line 6221, in main
    jobj.do_metaweb(opts, resumeold, xpostfile, template, quick_opt)
    File “/usr/share/charm/ljcharm.py”, line 5783, in do_metaweb
    self.main_blog(opts, resumeold, xpostfile, template, quick_opt)
    File “/usr/share/charm/ljcharm.py”, line 5531, in main_blog
    self.blog_menu()
    File “/usr/share/charm/ljcharm.py”, line 5484, in blog_menu
    repeat_ok = self.Blogger.blog_pick_edit_menu()
    File “/usr/share/charm/ljcharm.py”, line 5769, in metaweb_pick_edit_menu
    return self.metaweb_get_post(server, entry[“postid”])
    File “/usr/share/charm/ljcharm.py”, line 5579, in metaweb_get_post
    return self.blog_get_entry(text, ttup)
    File “/usr/share/charm/ljcharm.py”, line 5330, in blog_get_entry
    f.write(text)
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 955: ordinal not in range(128)
    File “/usr/share/charm/ljcharm.py”, line 5579, in metaweb_get_post
    return self.blog_get_entry(text, ttup)
    File “/usr/share/charm/ljcharm.py”, line 5330, in blog_get_entry
    f.write(text)
    UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 955: ordinal not in range(128)

    Reply
  2. K.Mandla Post author

    Hmm, I haven’t seen that error before. You’ll probably have to check the Charm bug tracker, if you haven’t already. 😐

    Reply
  3. Pingback: A Crux port for tty-clock « Motho ke motho ka botho

Leave a reply to hardikmehta Cancel reply