Python 2.6 をインストールすると Mercurial で警告が出るのを回避する
Python2.6 をインストールすると、Mercurial で警告が出るようになった。
$ hg push /usr/local/lib/python2.6/site-packages/mercurial/sshrepo.py:64: DeprecationWarning: os.popen3 is deprecated. Use the subprocess module. self.pipeo, self.pipei, self.pipee = os.popen3(cmd, 'b')
Mercurial のリポジトリを見ると、2008-10-21 現在では特に対策がなされてはいない。
ぐぐってみると、Django で同じ問題が発生していて、こんなパッチが作られていた。
これにならって、/usr/local/lib/python2.6/site-packages/mercurial/sshrepo.py に以下を追加してみた。
## suppress warnings ('DeprecationWarning: os.popen3 is deprecated. Use the subprocess module.') import warnings warnings.filterwarnings('ignore', category=DeprecationWarning, message=r'os\.popen3') ##
これで警告が出なくなった。
もう一つ、 DeprecationWarning: the sha module is deprecated; use the hashlib module instead というエラーも出るようになった。
$ hg clone http://.... /usr/local/lib/python2.6/site-packages/mercurial/demandimport.py:46: DeprecationWarning: the sha module is deprecated; use the hashlib module instead mod = _origimport(head, globals, locals)
さきほどと同じように、 /usr/local/lib/python2.6/site-packages/mercurial/demandimport.py に以下を追加することで、警告は出なくなる。
## suppress warnings ('DeprecationWarning: the sha module is deprecated; use the hashlib module instead') import warnings warnings.filterwarnings('ignore', category=DeprecationWarning, message=r'the sha module') ##
ただし、これらの対策が正しいかどうかは保証しない。試してみるなら各自の責任でどうぞ。