June 12, 2010
iPad:SphinxでePub本を作ってみる

virtualenv作成

hdknr@deblen:~/.ve$ mkvirtualenv sp
New python executable in sp/bin/python
Installing setuptools…………done.

pipとかインストール

(sp)hdknr@deblen:~/.ve/sp$ easy_install pip
Searching 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=sphinx
Obtaining 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 html
sphinx-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 epub
sphinx-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 »

February 11, 2010
virtualenv : Djangoでwebsite というモジュール名がバッティングする


(djtweet)hdknr@deblen:~/.ve/djtweet/src$ tree -d .
.
|— djcube
|   |— djcube
|   |— djcube.egg-info
|   |— php
|   |   `— promocode
|   |— sample
|   `— website
|       |— apache
|       |   `— cache
|       |       `— MySQL_python-1.2.3c1-py2.5-linux-i686.egg-tmp
|       `— promocode
|— djtweet
|   `— website
|       |— atompub
|       |— diary
|       `— tweets
|           |— fixtures
|           |— sql
|           |— temp
|           `— xslt
|— enablr
|   |— enablr
|   `— enablr.egg-info
`— mysite 24 directories

の環境で、djtweetを実行すると、 (djtweet)hdknr@deblen:~/.ve/djtweet/src/djtweet/website$ python manage.py shell
Python 2.5.2 (r252:60911, Jan  4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
(InteractiveConsole)
»> from website.settings import *
»> DATABASE_NAME
‘djcube’

となって、別の環境が読み込まれてしまう。

これは、djcubeもdjtweetもsetup.py でvirtualenvにインストールしているので、 »> import sys
»> for x in [ x  for x in  sys.path if x.startswith(‘/home’)]:
…   print x

/home/hdknr/.ve/djtweet/src/djtweet/website
/home/hdknr/.ve/djtweet/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg
/home/hdknr/.ve/djtweet/lib/python2.5/site-packages/pip-0.6.3-py2.5.egg
/home/hdknr/.ve/djtweet/lib/python2.5/site-packages/MySQL_python-1.2.3c1-py2.5-linux-i686.egg
/home/hdknr/.ve/djtweet/src/enablr
/home/hdknr/.ve/djtweet/src/djcube
/home/hdknr/.ve/djtweet/lib/python2.5
/home/hdknr/.ve/djtweet/lib/python2.5/plat-linux2
/home/hdknr/.ve/djtweet/lib/python2.5/lib-tk
/home/hdknr/.ve/djtweet/lib/python2.5/lib-dynload
/home/hdknr/.ve/djtweet/lib/python2.5/site-packages

となって別のアプリケーションも環境に含まれてしまっているから。
なので、djcube/website ではなくて、djcube/website/app とかにして1つディレクトリかました方がいいな。

Posted via email from 原宿工業大学 | Comment »

February 9, 2010
Enablr : Bitbucket でのプロジェクトを初期化する

SubversionとGit/Githubも可能ですが、まだ完璧にテストしていません。

virtualenvを作る

hdknr@deblen:~$ mkvirtualenv twitq
New python executable in twitq/bin/python
Installing setuptools………………….done.

pipを入れる

(twitq)hdknr@deblen:~$ easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Best match: pip 0.6.3
Downloading http://pypi.python.org/packages/source/p/pip/pip-0.6.3.tar.gz#md5=0602fa9179cfaa98e41565d4a581d98c
Processing pip-0.6.3.tar.gz
Running pip-0.6.3/setup.py -q bdist_egg —dist-dir /tmp/easy_install-cY8Ghr/pip-0.6.3/egg-dist-tmp-AtENEu
warning: no previously-included files matching ‘*.txt’ found under directory ‘docs/_build’
no previously-included directories found matching ‘docs/_build/_sources’
warning: no files found matching ‘*’ under directory ‘scripts/completion’
zip_safe flag not set; analyzing archive contents…
pip.runner: module references __file__
pip.basecommand: module references __file__
pip.venv: module references __file__
pip.vcs.__init__: module references __file__
Adding pip 0.6.3 to easy-install.pth file
Installing pip script to /home/hdknr/.ve/twitq/bin Installed /home/hdknr/.ve/twitq/lib/python2.5/site-packages/pip-0.6.3-py2.5.egg
Processing dependencies for pip
Finished processing dependencies for pip

MySQLdbを入れておく

(twitq)hdknr@deblen:~$ easy_install mysql-python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3c1
Downloading http://pypi.python.org/packages/2.5/M/MySQL-python/MySQL_python-1.2.3c1-py2.5-linux-i686.egg#md5=1efcbed6f1f29acd50993f54109938d3
Processing MySQL_python-1.2.3c1-py2.5-linux-i686.egg
Moving MySQL_python-1.2.3c1-py2.5-linux-i686.egg to /home/hdknr/.ve/twitq/lib/python2.5/site-packages
Adding MySQL-python 1.2.3c1 to easy-install.pth file Installed /home/hdknr/.ve/twitq/lib/python2.5/site-packages/MySQL_python-1.2.3c1-py2.5-linux-i686.egg
Processing dependencies for mysql-python
Finished processing dependencies for mysql-python

(twitq)hdknr@deblen:~$ 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 ./.ve/twitq/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/twitq/bin
Successfully installed yolk

yolkも入れておく

(twitq)hdknr@deblen:~$ 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 ./.ve/twitq/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/twitq/bin
Successfully installed yolk

Djangoも入れておく

(twitq)hdknr@deblen:~$ pip install django
Downloading/unpacking django
  Downloading Django-1.1.1.tar.gz (5.6Mb): 5.6Mb downloaded
  Running setup.py egg_info for package django
Installing collected packages: django
  Running setup.py install for django
    changing mode of build/scripts-2.5/django-admin.py from 644 to 755
    changing mode of /home/hdknr/.ve/twitq/bin/django-admin.py to 755
Successfully installed django

Enablrを入れる

(twitq)hdknr@deblen:~$ pip install -e hg+ssh://hg@bitbucket.org/hdknr/enablr#egg=enablr
Obtaining enablr from hg+ssh://hg@bitbucket.org/hdknr/enablr#egg=enablr
  Cloning hg ssh://hg@bitbucket.org/hdknr/enablr to ./.ve/twitq/src/enablr
  Running setup.py egg_info for package enablr
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
Downloading/unpacking pit (from enablr)
  Downloading pit-0.2.tar.gz
  Running setup.py egg_info for package pit
Downloading/unpacking pyYAML (from pit->enablr)
  Downloading PyYAML-3.09.tar.gz (238Kb): 238Kb downloaded
  Running setup.py egg_info for package pyYAML
Installing collected packages: enablr, pit, pyYAML
  Running setup.py develop for enablr
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
    Creating /home/hdknr/.ve/twitq/lib/python2.5/site-packages/enablr.egg-link (link to .)
    Adding enablr 0.0.1 to easy-install.pth file

       Installed /home/hdknr/.ve/twitq/src/enablr
  Running setup.py install for pit
  Running setup.py install for pyYAML
    checking if libyaml is compilable
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c build/temp.linux-i686-2.5/check_libyaml.c -o build/temp.linux-i686-2.5/check_libyaml.o
    checking if libyaml is linkable
    gcc -pthread build/temp.linux-i686-2.5/check_libyaml.o -lyaml -o build/temp.linux-i686-2.5/check_libyaml
    building ‘_yaml’ extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c ext/_yaml.c -o build/temp.linux-i686-2.5/ext/_yaml.o
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_get_version_string’:
    ext/_yaml.c:1072: warning: assignment discards qualifiers from pointer target type
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_7CParser___init__’:
    ext/_yaml.c:1830: warning: passing argument 2 of ‘yaml_parser_set_input’ from incompatible pointer type
    ext/_yaml.c:2040: warning: pointer targets in passing argument 2 of ‘yaml_parser_set_input_string’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__token_to_object’:
    ext/_yaml.c:3465: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:3465: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:3478: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:3478: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4045: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4045: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4099: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4099: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4153: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4153: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4166: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4166: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4253: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__event_to_object’:
    ext/_yaml.c:5716: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5716: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:5729: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5729: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:5899: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5899: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:5974: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5974: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6011: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6011: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6027: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6343: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6343: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6380: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6380: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6576: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6576: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6613: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6613: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_node’:
    ext/_yaml.c:7934: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:7934: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8152: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8152: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8181: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8181: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8210: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8210: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_scalar_node’:
    ext/_yaml.c:8727: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8894: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8894: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_sequence_node’:
    ext/_yaml.c:9341: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:9341: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_mapping_node’:
    ext/_yaml.c:9882: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:9882: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_8CEmitter___init__’:
    ext/_yaml.c:10912: warning: passing argument 2 of ‘yaml_emitter_set_output’ from incompatible pointer type
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_8CEmitter__object_to_event’:
    ext/_yaml.c:12070: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c:12182: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c:12458: warning: pointer targets in passing argument 2 of ‘yaml_alias_event_initialize’ differ in signedness
    ext/_yaml.c:13112: warning: pointer targets in passing argument 2 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:13112: warning: pointer targets in passing argument 3 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:13112: warning: pointer targets in passing argument 4 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:13490: warning: pointer targets in passing argument 2 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:13490: warning: pointer targets in passing argument 3 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:13868: warning: pointer targets in passing argument 2 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    ext/_yaml.c:13868: warning: pointer targets in passing argument 3 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_8CEmitter_serialize’:
    ext/_yaml.c:15146: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c:15258: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_8CEmitter__serialize_node’:
    ext/_yaml.c:15955: warning: pointer targets in passing argument 2 of ‘yaml_alias_event_initialize’ differ in signedness
    ext/_yaml.c:16629: warning: pointer targets in passing argument 2 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:16629: warning: pointer targets in passing argument 3 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:16629: warning: pointer targets in passing argument 4 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:16932: warning: pointer targets in passing argument 2 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:16932: warning: pointer targets in passing argument 3 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:17348: warning: pointer targets in passing argument 2 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    ext/_yaml.c:17348: warning: pointer targets in passing argument 3 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.5/ext/_yaml.o -lyaml -o build/lib.linux-i686-2.5/_yaml.so
Successfully installed enablr pit pyYAML

Pitでレポジトリ(Bitbucket)のアカウントを作成する。

(twitq)hdknr@deblen:~$ echo $EDITOR
vim

(twitq)hdknr@deblen:~$ python -c “from pit import Pit ; Pit.set(‘bitbucket’);” email: *******@hdknr.compassword: ***********
push: hg clone %(url)s
repository: hg
url: ssh://hg@bitbucket.org/%(username)s/%(package)s/
username: hdknr

Bitbucketにプロジェクトをつくる

作ったプロジェクトを”Enablr”する

(twitq)hdknr@deblen:~/.ve/twitq/src$ python -c “import enablr;enablr.enable(‘bitbucket’,’twiq’);”
checkouting … ssh://hg@bitbucket.org/hdknr/twiq/ to /home/hdknr/.ve/twitq/src/twiq
hg clone ssh://hg@bitbucket.org/hdknr/twiq/
destination directory: twiq
no changes found
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

hg -R /home/hdknr/.ve/twitq/src/twiq add /home/hdknr/.ve/twitq/src/twiq/*
adding twiq/twiq/__init__.py
hg -R /home/hdknr/.ve/twitq/src/twiq add /home/hdknr/.ve/twitq/src/twiq/.svnignore hg -R /home/hdknr/.ve/twitq/src/twiq add /home/hdknr/.ve/twitq/src/twiq/.hgignore

hg -R /home/hdknr/.ve/twitq/src/twiq commit -u hdknr -m “initialized” hg -R /home/hdknr/.ve/twitq/src/twiq push
pushing to ssh://hg@bitbucket.org/hdknr/twiq/
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 7 changes to 7 files
remote: bb/acl: hdknr is allowed. accepted payload.
remote: quota: 8.3 MB in use, 150.0 MB available (5.55% used)
pip install -e hg+ssh://hg@bitbucket.org/hdknr/twiq/#egg=twiq
Obtaining twiq from hg+ssh://hg@bitbucket.org/hdknr/twiq/#egg=twiq
  Updating ./twiq clone
  Running setup.py egg_info for package twiq
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
Installing collected packages: twiq
  Running setup.py develop for twiq
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
    Creating /home/hdknr/.ve/twitq/lib/python2.5/site-packages/twiq.egg-link (link to .)
    Adding twiq 0.0.1 to easy-install.pth file

       Installed /home/hdknr/.ve/twitq/src/twiq
Successfully installed twiq

Bitbucketのソースを確認


ディレクトリツリーはこんな感じ

(twitq)hdknr@deblen:~/.ve/twitq/src$ tree 
.
|-- enablr
|   |-- LICENSE
|   |-- MANIFEST.in
|   |-- README.rst
|   |-- enablr
|   |   |-- __init__.py
|   |   `-- __init__.pyc
|   |-- enablr.egg-info
|   |   |-- PKG-INFO
|   |   |-- SOURCES.txt
|   |   |-- dependency_links.txt
|   |   |-- not-zip-safe
|   |   |-- requires.txt
|   |   `-- top_level.txt
|   `-- setup.py
`-- twiq
    |-- LICENSE
    |-- MANIFEST.in
    |-- README.rst
    |-- setup.py
    |-- twiq
    |   `-- __init__.py
    `-- twiq.egg-info
        |-- PKG-INFO
        |-- SOURCES.txt
        |-- dependency_links.txt
        |-- not-zip-safe
        `-- top_level.txt
 6 directories, 22 files
そうすると、同じvirtualenvで別プロジェクトから今作ったtwiqをimport できて、かつtwiqも同時進行で開発できる。

Posted via email from 原宿工業大学 | Comment »

January 19, 2010
virtualenv:pip: OSError: [Errno 18] Invalid cross-device link

(test)www-data@aws:~/.ve/test$ pip install yolk —upgrade
Downloading/unpacking yolk
  Downloading yolk-0.4.1.tar.gz (80Kb): 80Kb downloaded
  Running setup.py egg_info for package yolk
Downloading/unpacking setuptools (from yolk)
  Downloading setuptools-0.6c11.tar.gz (256Kb): 256Kb downloaded
  Running setup.py egg_info for package setuptools
Installing collected packages: setuptools, yolk
  Found existing installation: setuptools 0.6c11
    Uninstalling setuptools:
rename(/home/www/.ve/test/bin/easy_install,/tmp/pip-fOtt6J-uninstall/bin/easy_install)
Exception:
Traceback (most recent call last):
  File “/home/www/.ve/test/lib/python2.5/site-packages/pip-0.6.1-py2.5.egg/pip.py”, line 482, in main
    self.run(options, args)
  File “/home/www/.ve/test/lib/python2.5/site-packages/pip-0.6.1-py2.5.egg/pip.py”, line 677, in run
    requirement_set.install(install_options)
  File “/home/www/.ve/test/lib/python2.5/site-packages/pip-0.6.1-py2.5.egg/pip.py”, line 2745, in install
    requirement.uninstall(auto_confirm=True)
  File “/home/www/.ve/test/lib/python2.5/site-packages/pip-0.6.1-py2.5.egg/pip.py”, line 2066, in uninstall
    paths_to_remove.remove(auto_confirm)
  File “/home/www/.ve/test/lib/python2.5/site-packages/pip-0.6.1-py2.5.egg/pip.py”, line 4718, in remove
    os.renames(full_path, new_path)
  File “/home/www/.ve/test/lib/python2.5/os.py”, line 214, in renames
    rename(old, new)
OSError: [Errno 18] Invalid cross-device link Storing complete log in ./pip-log.txt

TMPDIRの問題らしい (test)www-data@aws:~/.ve/test$ TMPDIR=/home/www/.ve/test/temp  pip install yolk —upgrade
Downloading/unpacking yolk
  Running setup.py egg_info for package yolk
Downloading/unpacking setuptools (from yolk)
  Running setup.py egg_info for package setuptools
Installing collected packages: setuptools, yolk
  Found existing installation: setuptools 0.6c11
    Uninstalling setuptools:
rename(/home/www/.ve/test/bin/easy_install,/home/www/.ve/test/temp/pip-FuVZHy-uninstall/bin/easy_install)
rename(/home/www/.ve/test/bin/easy_install-2.5,/home/www/.ve/test/temp/pip-FuVZHy-uninstall/bin/easy_install-2.5)
rename(/home/www/.ve/test/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg,/home/www/.ve/test/temp/pip-FuVZHy-uninstall/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg)
      Successfully uninstalled setuptools
  Running setup.py install for setuptools
    Installing easy_install script to /home/www/.ve/test/bin
    Installing easy_install-2.5 script to /home/www/.ve/test/bin
  Found existing installation: yolk 0.4.1
    Uninstalling yolk:
rename(/home/www/.ve/test/bin/yolk,/home/www/.ve/test/temp/pip-AcFZQr-uninstall/bin/yolk)
rename(/home/www/.ve/test/lib/python2.5/site-packages/yolk,/home/www/.ve/test/temp/pip-AcFZQr-uninstall/lib/python2.5/site-packages/yolk)
rename(/home/www/.ve/test/lib/python2.5/site-packages/yolk-0.4.1-py2.5.egg-info,/home/www/.ve/test/temp/pip-AcFZQr-uninstall/lib/python2.5/site-packages/yolk-0.4.1-py2.5.egg-info)
      Successfully uninstalled yolk
  Running setup.py install for yolk
    Installing yolk script to /home/www/.ve/test/bin
Successfully installed setuptools yolk

Posted via email from hdknr’s posterous | Comment »

January 9, 2010
Django, mod_python and virtualenv

To use virtualenv with mod_python create file myvirtualdjango.py in your virtualenv bin directory (change the path to reflect your setup):

#myvirtualdjango.py    activate_this = '/home/django/progopedia.ru/ve/bin/activate_this.py'  execfile(activate_this, dict(__file__=activate_this))    from django.core.handlers.modpython import handler  

Posted via web from hdknr’s posterous | Comment »

December 19, 2009
pit: /usr/bin/python -c なので、virtualenvにインストールできない

(accounts)hdknr@deblen:~/.ve/accounts$  pip install -e hg+ssh://hg@bitbucket.org/hdknr/enablr/#egg=enablr
Obtaining enablr from hg+ssh://hg@bitbucket.org/hdknr/enablr/#egg=enablr
  Cloning hg ssh://hg@bitbucket.org/hdknr/enablr/ to ./src/enablr
  Running setup.py egg_info for package enablr
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
Downloading/unpacking pit (from enablr)
  Running setup.py egg_info for package pit
Downloading/unpacking pyYAML (from pit->enablr)
  Running setup.py egg_info for package pyYAML
Installing collected packages: enablr, pit, pyYAML
  Running setup.py install for pit
    error: /usr/lib/python2.5/site-packages/pit.py: Permission denied
    Complete output from command /usr/bin/python -c “import setuptools; __file__=’/home/hdknr/.ve/accounts/build/pit/setup.py’; execfile(‘/home/hdknr/.ve/accounts/build/pit/setup.py’)” install —single-version-externally-managed —record /tmp/pip-wOQErk-record/install-record.txt —install-headers /home/hdknr/.ve/accounts/lib/include:
    running install running build

running build_py running install_lib

copying build/lib/pit.py -> /usr/lib/python2.5/site-packages error: /usr/lib/python2.5/site-packages/pit.py: Permission denied

————————————————————
Command /usr/bin/python -c “import setuptools; __file__=’/home/hdknr/.ve/accounts/build/pit/setup.py’; execfile(‘/home/hdknr/.ve/accounts/build/pit/setup.py’)” install —single-version-externally-managed —record /tmp/pip-wOQErk-record/install-record.txt —install-headers /home/hdknr/.ve/accounts/lib/include failed with error code 1
Storing complete log in ./pip-log.txt

Posted via email from hdknr’s posterous | Comment »

December 14, 2009
Enablr: virtualenvのプロジェクト初期化を作ってみる(1)

http://bitbucket.org/hdknr/enablr/ をCreate New (zn)hdknr@deblen:~/.ve/zn/src$ hg clone ssh://hg@bitbucket.org/hdknr/enablr/destination directory: enablr
no changes found
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

(zn)hdknr@deblen:~/.ve/zn/src/enablr$ curl http://code.hdknr.com/virtualenv/scaffold/.template/LICENSE.mit > LICENSE
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1065  100  1065    0     0   5522      0 —:—:— —:—:— —:—:—     0 (zn)hdknr@deblen:~/.ve/zn/src/enablr$ vi LICENSE

適当に編集。 (zn)hdknr@deblen:~/.ve/zn/src/enablr$ vi README.rst

適当に編集。
(zn)hdknr@deblen:~/.ve/zn/src/enablr$ curl http://code.hdknr.com/virtualenv/scaffold/MANIFEST.in > MANIFEST.in  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    66    0    66    0     0    355      0 —:—:— —:—:— —:—:—     0

(zn)hdknr@deblen:~/.ve/zn/src/enablr$ curl http://code.hdknr.com/virtualenv/scaffold/setup.py > setup.py  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   381  100   381    0     0   2115      0 —:—:— —:—:— —:—:—     0 (zn)hdknr@deblen:~/.ve/zn/src/enablr$ vi setup.py
適当に編集。

(zn)hdknr@deblen:~/.ve/zn/src/enablr$ svn export http://code.hdknr.com/virtualenv/scaffold/hoge enablr
A    enablr
A    enablr/views.py
A    enablr/__init__.py
リビジョン 440 をエクスポートしました。 (zn)hdknr@deblen:~/.ve/zn/src/enablr$ rm enablr/views.py

(zn)hdknr@deblen:~/.ve/zn/src/enablr$ cp ../flickrapi/.hgignore  .

(zn)hdknr@deblen:~/.ve/zn/src/enablr$ hg add *
adding enablr/__init__.py (zn)hdknr@deblen:~/.ve/zn/src/enablr$ hg add .hgignore
(zn)hdknr@deblen:~/.ve/zn/src/enablr$ hg status
A .hgignore
A LICENSE
A MANIFEST.in
A README.rst
A enablr/__init__.py
A setup.py

(zn)hdknr@deblen:~/.ve/zn/src/enablr$ hg commit -u hdknr -m “initial files”
(zn)hdknr@deblen:~/.ve/zn/src/enablr$ hg push
pushing to ssh://hg@bitbucket.org/hdknr/enablr/
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 6 changes to 6 files
remote: bb/acl: hdknr is allowed. accepted payload.
remote: quota: 8.3 MB in use, 150.0 MB available (5.51% used)

とりあえずこれで開発してみる。

Posted via email from hdknr’s posterous | Comment »