2010年5月25日火曜日

Mac OS X & sphinxでPDF出力(準備編)

Mac OS X (snow leopard)でsphinxを使ってPDFを出力する下準備は、これだけ必要。

  • sphinxのインストール
  • Xcodeのインストール(makeコマンドを使えるようにするためだけ)
  • pTeXのインストール&PATHの設定
これだけ実行すると、PDFファイルが作成できる。
sphinxのインストールは、前の記事でかいたので割愛。

Xcodeのインストールは大量の帯域とディスク領域と、ほんの少しの割り切りが必要だ。Xcodeのページ(http://developer.apple.com/technologies/tools/xcode.html)を開いたら、左ペインのメニューの下段にある"Free Download"をクリックする。"Download Xcode"ページが開いたら、右ペインの"iPhone Dev Center"あるいは"Mac Dev Center"をクリックする。ログイン画面が開くのでログインする(ユーザー登録がまだの人は、いい機会なのでここで登録しておこう)。画面下の"Download"エリアにある"Xcode 3.2.2 and iPhone SDK 3.2(あるいはそれっぽいリンク)"をクリックしよう。これでようやくダウンロードが始まる。ダウンロードサイズは数百メガバイト、展開時には7ギガバイト近くかかるので帯域とディスク領域が必要。それでsphinxにとって何が必要かというとmakeコマンドのみという事実に対する割り切りが必要。

pTeXはここ(http://www2.kumagaku.ac.jp/teacher/herogw/)からダウンロードする。ダウンロードしたファイルを展開して、pTeXアプリケーション(黒い犬のアイコン)をアプリケーションフォルダにコピーしてダブルクリック。これで導入完了だ。

2010年5月15日土曜日

macでsphinxのインストール

mac os xでsphinxのインストールをしてみた。
僕がはまったのは次の二つ

"error: /usr/local/bin/sphinx-build: Permission denied"がでる
→sudoコマンドでeasy_installコマンドを実行する


"easy-install"といれてもコマンドがないと言われる
→ハイフンではなくてアンダースコア

上記を踏まえて、Let's try!


********-*****-no-macbook-pro:local *****$ sudo easy_install http://pypi.python.org/packages/2.6/S/Sphinx/Sphinx-0.6.5-py2.6.egg#md5=d1230f6d317a35770365f62225069259
Downloading http://pypi.python.org/packages/2.6/S/Sphinx/Sphinx-0.6.5-py2.6.egg#md5=d1230f6d317a35770365f62225069259
Processing Sphinx-0.6.5-py2.6.egg
removing '/Library/Python/2.6/site-packages/Sphinx-0.6.5-py2.6.egg' (and everything under it)
creating /Library/Python/2.6/site-packages/Sphinx-0.6.5-py2.6.egg
Extracting Sphinx-0.6.5-py2.6.egg to /Library/Python/2.6/site-packages
Sphinx 0.6.5 is already the active version in easy-install.pth
Installing sphinx-build script to /usr/local/bin
Installing sphinx-quickstart script to /usr/local/bin
Installing sphinx-autogen script to /usr/local/bin

Installed /Library/Python/2.6/site-packages/Sphinx-0.6.5-py2.6.egg
Processing dependencies for Sphinx==0.6.5
Searching for docutils>=0.4
Reading http://pypi.python.org/simple/docutils/
Reading http://docutils.sourceforge.net/
Best match: docutils 0.6
Downloading http://prdownloads.sourceforge.net/docutils/docutils-0.6.tar.gz?download
Processing docutils-0.6.tar.gz
Running docutils-0.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QL4h1w/docutils-0.6/egg-dist-tmp-AASUn6
zip_safe flag not set; analyzing archive contents...
docutils.parsers.rst.directives.misc: module references __file__
docutils.writers.html4css1.__init__: module references __file__
docutils.writers.latex2e.__init__: module references __file__
docutils.writers.newlatex2e.__init__: module references __file__
docutils.writers.odf_odt.__init__: module references __file__
docutils.writers.pep_html.__init__: module references __file__
docutils.writers.s5_html.__init__: module references __file__
Adding docutils 0.6 to easy-install.pth file
Installing rst2html.py script to /usr/local/bin
Installing rst2latex.py script to /usr/local/bin
Installing rst2man.py script to /usr/local/bin
Installing rst2newlatex.py script to /usr/local/bin
Installing rst2odt.py script to /usr/local/bin
Installing rst2odt_prepstyles.py script to /usr/local/bin
Installing rst2pseudoxml.py script to /usr/local/bin
Installing rst2s5.py script to /usr/local/bin
Installing rst2xml.py script to /usr/local/bin
Installing rstpep2html.py script to /usr/local/bin

Installed /Library/Python/2.6/site-packages/docutils-0.6-py2.6.egg
Searching for Jinja2>=2.1
Reading http://pypi.python.org/simple/Jinja2/
Reading http://jinja.pocoo.org/
Best match: Jinja2 2.4.1
Downloading http://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.4.1.tar.gz#md5=e0cf5af057fac63ac9689b86c8b31ce6
Processing Jinja2-2.4.1.tar.gz
Running Jinja2-2.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Itm1u1/Jinja2-2.4.1/egg-dist-tmp-b6WF5r
warning: no previously-included files matching '*' found under directory 'docs/_build/doctrees'
Adding Jinja2 2.4.1 to easy-install.pth file

Installed /Library/Python/2.6/site-packages/Jinja2-2.4.1-py2.6.egg
Searching for Pygments>=0.8
Reading http://pypi.python.org/simple/Pygments/
Reading http://pygments.org/
Reading http://pygments.pocoo.org/
Best match: Pygments 1.3.1
Downloading http://pypi.python.org/packages/2.6/P/Pygments/Pygments-1.3.1-py2.6.egg#md5=05270ee059c038407364b28993980960
Processing Pygments-1.3.1-py2.6.egg
creating /Library/Python/2.6/site-packages/Pygments-1.3.1-py2.6.egg
Extracting Pygments-1.3.1-py2.6.egg to /Library/Python/2.6/site-packages
Adding Pygments 1.3.1 to easy-install.pth file
Installing pygmentize script to /usr/local/bin

Installed /Library/Python/2.6/site-packages/Pygments-1.3.1-py2.6.egg
Finished processing dependencies for Sphinx==0.6.5
********-*****-no-macbook-pro:local *****$

上手くいったようだ。