python: November 2007 Archives
呵呵,easy-install自己的安装还是很简单的
wget http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py
完事了。自己下包,自己安装。 :)
昨天为xbaydns写一个操作系统适配的代码,通常我们都是通过os来识别操作系统,可是os里的返回值可怜到让我不忍心去看。当我准备入手写uname -a的正则表达式时,发现了platform。把代码留下:
import platform
system, _, release, version, machine, processor = platform.uname()
system, release, version = platform.system_alias(system, release,version)
if (system == 'Darwin' and release == '9.1.0'):
#操作系统为Mac OSX 10.5
chroot_path = "/"
namedconf = "/etc"
elif (system == "FreeBSD" and release[:3] == "7.0"):
#操作系统为FreeBSD 7.0
chroot_path = "/var/named"
namedconf = "/etc/namedb"
