virtualenv作成
hdknr@deblen:~/.ve$ mkvirtualenv spNew python executable in sp/bin/python
Installing setuptools…………done.
pipとかインストール
(sp)hdknr@deblen:~/.ve/sp$ easy_install pipSearching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Best match: pip 0.7.2
Downloading http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz#md5=cfe73090aaa0d3b0c104179a627859d1
Processing pip-0.7.2.tar.gz
Running pip-0.7.2/setup.py -q bdist_egg —dist-dir /tmp/easy_install-rlmKR9/pip-0.7.2/egg-dist-tmp-qd6t9t
warning: no files found matching ‘*.html’ under directory ‘docs’
warning: no previously-included files matching ‘*.txt’ found under directory ‘docs/_build’
no previously-included directories found matching ‘docs/_build/_sources’
Adding pip 0.7.2 to easy-install.pth file
Installing pip script to /home/hdknr/.ve/sp/bin Installed /home/hdknr/.ve/sp/lib/python2.5/site-packages/pip-0.7.2-py2.5.egg
Processing dependencies for pip
Finished processing dependencies for pip
(sp)hdknr@deblen:~/.ve/sp$ pip install yolk
Downloading/unpacking yolk
Downloading yolk-0.4.1.tar.gz (80Kb): 80Kb downloaded
Running setup.py egg_info for package yolk
Requirement already satisfied (use —upgrade to upgrade): setuptools in ./lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg (from yolk)
Installing collected packages: yolk
Running setup.py install for yolk
Installing yolk script to /home/hdknr/.ve/sp/bin
Successfully installed yolk
Cleaning up…
(sp)hdknr@deblen:~/.ve/sp$ pip install jinja2
Downloading/unpacking jinja2
Downloading Jinja2-2.5.tar.gz (690Kb): 690Kb downloaded
Running setup.py egg_info for package jinja2
warning: no previously-included files matching ‘*’ found under directory ‘docs/_build/doctrees’
warning: no previously-included files matching ‘*.pyc’ found under directory ‘jinja2’
warning: no previously-included files matching ‘*.pyc’ found under directory ‘docs’
warning: no previously-included files matching ‘*.pyo’ found under directory ‘jinja2’
warning: no previously-included files matching ‘*.pyo’ found under directory ‘docs’
Installing collected packages: jinja2
Running setup.py install for jinja2
warning: no previously-included files matching ‘*’ found under directory ‘docs/_build/doctrees’
warning: no previously-included files matching ‘*.pyc’ found under directory ‘jinja2’
warning: no previously-included files matching ‘*.pyc’ found under directory ‘docs’
warning: no previously-included files matching ‘*.pyo’ found under directory ‘jinja2’
warning: no previously-included files matching ‘*.pyo’ found under directory ‘docs’
Successfully installed jinja2
Cleaning up…
sphinx 1.0 をbitubucketからインストール
(sp)hdknr@deblen:~/.ve/sp$ pip install -e hg+http://bitbucket.org/birkenfeld/sphinx#egg=sphinxObtaining sphinx from hg+http://bitbucket.org/birkenfeld/sphinx#egg=sphinx
Cloning hg http://bitbucket.org/birkenfeld/sphinx to ./src/sphinx
Running setup.py egg_info for package sphinx
no previously-included directories found matching ‘doc/_build’
Requirement already satisfied (use —upgrade to upgrade): Pygments>=0.8 in /var/lib/python-support/python2.5 (from sphinx)
Requirement already satisfied (use —upgrade to upgrade): Jinja2>=2.2 in ./lib/python2.5/site-packages (from sphinx)
Requirement already satisfied (use —upgrade to upgrade): docutils>=0.5 in /usr/lib/python2.5/site-packages (from sphinx)
Installing collected packages: sphinx
Running setup.py develop for sphinx
no previously-included directories found matching ‘doc/_build’
Creating /home/hdknr/.ve/sp/lib/python2.5/site-packages/Sphinx.egg-link (link to .)
Adding Sphinx 1.0b2-04464ddd8808dev-20100612 to easy-install.pth file
Installing sphinx-build script to /home/hdknr/.ve/sp/bin
Installing sphinx-quickstart script to /home/hdknr/.ve/sp/bin
Installing sphinx-autogen script to /home/hdknr/.ve/sp/bin Installed /home/hdknr/.ve/sp/src/sphinx
Successfully installed sphinx
Cleaning up…
ディレクトリ掘って、プロジェクト作成
(sp)hdknr@deblen:~/.ve/sp$ mkdir docs(sp)hdknr@deblen:~/.ve/sp/docs$ mkdir nora
(sp)hdknr@deblen:~/.ve/sp/docs$ cd nora/
(sp)hdknr@deblen:~/.ve/sp/docs/nora$ which sphinx-quickstart
/home/hdknr/.ve/sp/bin/sphinx-quickstart (sp)hdknr@deblen:~/.ve/sp/docs/nora$ sphinx-quickstart
Welcome to the Sphinx 1.0b2+/04464ddd8808 quickstart utility. Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets). Enter the root path for documentation.
> Root path for the documentation [.]: You have two options for placing the build directory for Sphinx output.
Either, you use a directory “_build” within the root path, or you separate
“source” and “build” directories within the root path.
> Separate source and build directories (y/N) [n]: y Inside the root directory, two more directories will be created; “_templates”
for custom HTML templates and “_static” for custom stylesheets and other static
files. You can enter another prefix (such as “.”) to replace the underscore.
> Name prefix for templates and static dir [_]: The project name will occur in several places in the built documentation.
> Project name: Nora Hideki
> Author name(s): hdknr.com Sphinx has the notion of a “version” and a “release” for the
software. Each version can have multiple releases. For example, for
Python the version is something like 2.5 or 3.0, while the release is
something like 2.5.1 or 3.0a1. If you don’t need this dual structure,
just set both to the same value.
> Project version: 1
> Project release [1]: The file name suffix for source files. Commonly, this is either “.txt”
or “.rst”. Only files with this suffix are considered documents.
> Source file suffix [.rst]: One document is special in that it is considered the top node of the
“contents tree”, that is, it is the root of the hierarchical structure
of the documents. Normally, this is “index”, but if your “index”
document is a custom template, you can also set this to another filename.
> Name of your master document (without suffix) [index]: Sphinx can also add configuration for epub output:
> Do you want to use the epub builder (y/N) [n]: y Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/N) [n]: y
> doctest: automatically test code snippets in doctest blocks (y/N) [n]: y
> intersphinx: link between Sphinx documentation of different projects (y/N) [n]: y
> todo: write “todo” entries that can be shown or hidden on build (y/N) [n]: y
> coverage: checks for documentation coverage (y/N) [n]: y
> pngmath: include math, rendered as PNG images (y/N) [n]: y
> jsmath: include math, rendered in the browser by JSMath (y/N) [n]:
> ifconfig: conditional inclusion of content based on config values (y/N) [n]: y
> viewcode: include links to the source code of documented Python objects (y/N) [n]: y A Makefile and a Windows command file can be generated for you so that you
only have to run e.g. `make html’ instead of invoking sphinx-build
directly.
> Create Makefile? (Y/n) [y]: y
> Create Windows command file? (Y/n) [y]: y Finished: An initial directory structure has been created. You should now populate your master file ./source/index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
make builder
where “builder” is one of the supported builders, e.g. html, latex or linkcheck.
ePub用の設定変更
(sp)hdknr@deblen:~/.ve/sp/docs/nora$ vi source/conf.py(sp)hdknr@deblen:~/.ve/sp/docs/nora$ grep “^epub” source/conf.py
epub_title = u’Nora Hideki’
epub_author = u’hdknr.com’
epub_publisher = u’hdknr.com’
epub_copyright = u’2010, hdknr.com’
epub_basefile = u’nora_hideki’
epub_scheme = ‘URL’
epub_identifier = ‘http://hdknr.com’
epub_tocdepth = 3
トップページを変更して、ページ追加
(sp)hdknr@deblen:~/.ve/sp/docs/nora$ vi source/index.rst .. toctree:::maxdepth: 2 tweets20100610
tweets20100611
(sp)hdknr@deblen:~/.ve/sp/docs/nora$ curl http://twitter.hdknr.com/djtweet/diary/hdknr/hatena/20100610/html/ | sed -e ‘s/<[^>]*>//g’ > source/tweets20100610.rst
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 22717 100 22717 0 0 18713 0 0:00:01 0:00:01 —:—:— 29413
(sp)hdknr@deblen:~/.ve/sp/docs/nora$ curl http://twitter.hdknr.com/djtweet/diary/hdknr/hatena/20100611/html/ | sed -e ‘s/<[^>]*>//g’ > source/tweets20100611.rst
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 20017 0 20017 0 0 15488 0 —:—:— 0:00:01 —:—:— 26316 rst整形してみれるようにする。
HTMLで確認
(sp)hdknr@deblen:~/.ve/sp/docs/nora$ make htmlsphinx-build -b html -d build/doctrees source build/html
Making output directory…
Running Sphinx v1.0b2+/04464ddd8808
loading pickled environment… not yet created
loading intersphinx inventory from http://docs.python.org/objects.inv…
building [html]: targets for 3 source files that are out of date
updating environment: 3 added, 0 changed, 0 removed
reading sources… [100%] tweets20100611
looking for now-outdated files… none found
pickling environment… done
checking consistency… done
preparing documents… done
writing output… [100%] tweets20100611
writing additional files… (0 module code pages) genindex search
copying static files… done
dumping search index… done
dumping object inventory… done
build succeeded. Build finished. The HTML pages are in build/html.
ePub作成
(sp)hdknr@deblen:~/.ve/sp/docs/nora$ make epubsphinx-build -b epub -d build/doctrees source build/epub
Making output directory…
Running Sphinx v1.0b2+/04464ddd8808
loading pickled environment… done
building [epub]: targets for 3 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files… none found
preparing documents… done
writing output… [100%] tweets20100611
writing additional files… (0 module code pages) genindex search
copying static files… done
writing mimetype file…
writing META-INF/container.xml file…
writing content.opf file…
WARNING: unknown mimetype for _static/jquery.js, ignoring
WARNING: unknown mimetype for _static/underscore.js, ignoring
WARNING: unknown mimetype for _static/doctools.js, ignoring
WARNING: unknown mimetype for _static/searchtools.js, ignoring
writing toc.ncx file…
writing NoraHideki.epub file…
build succeeded, 4 warnings. Build finished. The epub file is in build/epub.
要は、make html の分も作ってくれるようです。
iTunesで登録
同期
追加されている
目次
本文読むなど
Posted via email from 原宿工業大学 | Comment »



