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. :|

About these ads

3 Responses to “A Crux port (and patch) for Charm”


  1. 1 hardikmehta 2009/08/15 at 5:12 AM

    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)

  2. 2 K.Mandla 2009/08/15 at 7:46 AM

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


  1. 1 A Crux port for tty-clock « Motho ke motho ka botho Trackback on 2009/08/15 at 10:45 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Welcome!



Visit the Wiki!

Some recent desktops


May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF
 


May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games


Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers

License

This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,962,787 hits

Archives


Follow

Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: