buildoutがちゃんと動かない。
Zopeの環境を作るのって伝統的な手法だとこういう感じ。
- プロダクトが必要とするpythonライブラリを前もってインストールする。
- プロダクトをダウンロード、展開してインスタンス以下のProductに展開するか、シンボリックリンクを張る。
- 依存しているプロダクトなんかがある場合は人間がちゃんと意識してインストールしてあげる。
こういった面倒な作業を自動的に実施してくれるのがbuildoutとかZopeSkelとか、pasterなんてツール(らしい)。なので早速試してみる。
ez_setup.pyをダウンロードしてくる。
ez_setup.pyってスクリプトを適当なサイトからダウンロードして実行します。
$ wget http://peak.telecommunity.com/dist/ez_setup.py (rootにsuする) # python ez_setup.py # python ez_setup.py Downloading http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c8-py2.4.egg Processing setuptools-0.6c8-py2.4.egg creating /usr/local/lib/python2.4/site-packages/setuptools-0.6c8-py2.4.egg Extracting setuptools-0.6c8-py2.4.egg to /usr/local/lib/python2.4/site-packages Adding setuptools 0.6c8 to easy-install.pth file Installing easy_install script to /usr/local/bin Installing easy_install-2.4 script to /usr/local/bin Installed /usr/local/lib/python2.4/site-packages/setuptools-0.6c8-py2.4.egg Processing dependencies for setuptools==0.6c8 Finished processing dependencies for setuptools==0.6c8 easy_install ZopeSkel Searching for ZopeSkel Reading http://pypi.python.org/simple/ZopeSkel/ Best match: ZopeSkel 1.8 Downloading http://pypi.python.org/packages/2.4/Z/ZopeSkel/ZopeSkel-1.8-py2.4.egg#md5=7bb4b1051e39dbda873d0e666884f463 Processing ZopeSkel-1.8-py2.4.egg creating /usr/local/lib/python2.4/site-packages/ZopeSkel-1.8-py2.4.egg Extracting ZopeSkel-1.8-py2.4.egg to /usr/local/lib/python2.4/site-packages Adding ZopeSkel 1.8 to easy-install.pth file Installed /usr/local/lib/python2.4/site-packages/ZopeSkel-1.8-py2.4.egg Processing dependencies for ZopeSkel Searching for Cheetah Reading http://pypi.python.org/simple/Cheetah/ Reading http://www.CheetahTemplate.org/ Reading http://sourceforge.net/project/showfiles.php?group_id=28961 Best match: Cheetah 2.0.1 Downloading http://downloads.sourceforge.net/cheetahtemplate/Cheetah-2.0.1.tar.gz?download Processing Cheetah-2.0.1.tar.gz Running Cheetah-2.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-KLoX2a/Cheetah-2.0.1/egg-dist-tmp-N8mGpG warning: no files found matching '*.cfg' warning: no files found matching 'examples' warning: no files found matching 'docs' warning: no files found matching 'bin' warning: no files found matching '*' under directory 'docs' warning: no files found matching '*' under directory 'examples' warning: no previously-included files matching '*.pyc' found under directory 'src' warning: no previously-included files matching '*~' found under directory 'src' warning: no previously-included files matching '*.aux' found under directory 'src' warning: no previously-included files matching '*~' found under directory 'docs' warning: no previously-included files matching '*.aux' found under directory 'docs' zip_safe flag not set; analyzing archive contents... Cheetah.Template: module references __file__ Cheetah.ImportHooks: module references __file__ Cheetah.NameMapper: module MAY be using inspect.stack Cheetah.ImportManager: module references __file__ Cheetah.ImportManager: module references __path__ Cheetah.Tests.Template: module references __file__ Adding Cheetah 2.0.1 to easy-install.pth file Installing cheetah-compile script to /usr/local/bin Installing cheetah script to /usr/local/bin Installed /usr/local/lib/python2.4/site-packages/Cheetah-2.0.1-py2.4-linux-i686.egg Searching for PasteScript Reading http://pypi.python.org/simple/PasteScript/ Reading http://pythonpaste.org/script/ Best match: PasteScript 1.6.2 Downloading http://pypi.python.org/packages/2.4/P/PasteScript/PasteScript-1.6.2-py2.4.egg#md5=e76cd16938c430083e6611c6eb208a9d Processing PasteScript-1.6.2-py2.4.egg creating /usr/local/lib/python2.4/site-packages/PasteScript-1.6.2-py2.4.egg Extracting PasteScript-1.6.2-py2.4.egg to /usr/local/lib/python2.4/site-packages Adding PasteScript 1.6.2 to easy-install.pth file Installing paster script to /usr/local/bin Installing paster script to /usr/local/bin Installed /usr/local/lib/python2.4/site-packages/PasteScript-1.6.2-py2.4.egg Searching for PasteDeploy Reading http://pypi.python.org/simple/PasteDeploy/ Reading http://pythonpaste.org/deploy/ Reading http://pythonpaste.org/deploy/paste-deploy.html Best match: PasteDeploy 1.3.1 Downloading http://pypi.python.org/packages/2.4/P/PasteDeploy/PasteDeploy-1.3.1-py2.4.egg#md5=399800658790f4df6fb35011804506d2 Processing PasteDeploy-1.3.1-py2.4.egg creating /usr/local/lib/python2.4/site-packages/PasteDeploy-1.3.1-py2.4.egg Extracting PasteDeploy-1.3.1-py2.4.egg to /usr/local/lib/python2.4/site-packages Adding PasteDeploy 1.3.1 to easy-install.pth file Installed /usr/local/lib/python2.4/site-packages/PasteDeploy-1.3.1-py2.4.egg Searching for Paste>=1.3 Reading http://pypi.python.org/simple/Paste/ Reading http://pythonpaste.org Best match: Paste 1.6 Downloading http://pypi.python.org/packages/2.4/P/Paste/Paste-1.6-py2.4.egg#md5=3b5ad840d8e0fe6fb4df5343bffe9132 Processing Paste-1.6-py2.4.egg creating /usr/local/lib/python2.4/site-packages/Paste-1.6-py2.4.egg Extracting Paste-1.6-py2.4.egg to /usr/local/lib/python2.4/site-packages Adding Paste 1.6 to easy-install.pth file Installed /usr/local/lib/python2.4/site-packages/Paste-1.6-py2.4.egg Finished processing dependencies for ZopeSkel
これでpasterとかZopeSkelなんかが依存しているプロダクトを含めてインストールされます。
pasterを使ってインスタンスを作成する
上記でインストールされたpasterっていうスクリプトを使ってインスタンスを作成します。pasterがどこにインストールされたかは、ez_setup.pyが吐き出したログをみるとわかります。パスが切れてないときは、ちゃんと設定してあげましょう。
pasterに-tオプションでテンプレートを指定します。plone3ベースのサイトを作りたいときはplone3_buildoutを指定*1。最後の引数(以下の例だとmyproject)はインスタンスディレクトリ。
途中でZopeのインストールディレクトリ、Ploneのインストールディレクトリ、adminのユーザ名、パスワードを聞かれます。adminのパスワード以外はデフォルトでOK。なければインタネットから勝手にダウンロードしてインストールしてくれます。
$ paster create -t plone3_buildout myproject Selected and implied templates: ZopeSkel#plone3_buildout A buildout for Plone 3 projects Variables: egg: myproject package: myproject project: myproject Enter zope2_install (Path to Zope 2 installation; leave blank to fetch one) ['']: Enter plone_products_install (Path to directory containing Plone products; leave blank to fetch one) ['']: Enter zope_user (Zope root admin user) ['admin']: Enter zope_password (Zope root admin password) ['']: password Enter http_port (HTTP port) [8080]: Enter debug_mode (Should debug mode be "on" or "off"?) ['off']: Enter verbose_security (Should verbose security be "on" or "off"?) ['off']: Creating template plone3_buildout Creating directory ./myproject Copying README.txt to ./myproject/README.txt Copying bootstrap.py to ./myproject/bootstrap.py Copying buildout.cfg_tmpl to ./myproject/buildout.cfg Recursing into products Creating ./myproject/products/ Copying README.txt to ./myproject/products/README.txt Recursing into src Creating ./myproject/src/ Copying README.txt to ./myproject/src/README.txt Recursing into var Creating ./myproject/var/ Copying README.txt to ./myproject/var/README.txt ----------------------------------------------------------- Generation finished You probably want to run python bootstrap.py and then edit buildout.cfg before running bin/buildout -v See README.txt for details -----------------------------------------------------------
これでインスタンスはできあがり。
プロダクトなどインストール
上記で作成したインスタンスにはまだ必要なプロダクトなど一切はいっていません。bootstrap.pyを実行したのち、buildoutを実行してプロダクトをインストールします。
$ cd myproject $ python bootstrap.py Creating directory '/home/zope/myproject/bin'. Creating directory '/home/zope/myproject/parts'. Creating directory '/home/zope/myproject/eggs'. Creating directory '/home/zope/myproject/develop-eggs'. Generated script '/home/zope/myproject/bin/buildout'. $ bin/buildout Getting distribution for 'plone.recipe.plone>=3.0,<3.1dev'. Got plone.recipe.plone 3.0.6. Getting distribution for 'plone.recipe.distros'. Got plone.recipe.distros 1.3. Getting distribution for 'zc.recipe.egg'. Got zc.recipe.egg 1.0.0. Getting distribution for 'plone.recipe.zope2install'. Got plone.recipe.zope2install 1.2. Getting distribution for 'plone.recipe.zope2instance'. Got plone.recipe.zope2instance 1.5. Installing plone. Getting distribution for 'archetypes.kss==1.2.6'. Got archetypes.kss 1.2.6. Getting distribution for 'kss.core==1.2.4'. Got kss.core 1.2.4. Getting distribution for 'plone.app.content==1.0.1'. Got plone.app.content 1.0.1. Getting distribution for 'plone.app.contentmenu==1.0.6'. Got plone.app.contentmenu 1.0.6. Getting distribution for 'plone.app.contentrules==1.0.5'. Got plone.app.contentrules 1.0.5. Getting distribution for 'plone.app.controlpanel==1.0.4'. Got plone.app.controlpanel 1.0.4. Getting distribution for 'plone.app.customerize==1.0.1'. Got plone.app.customerize 1.0.1. Getting distribution for 'plone.app.form==1.0.4'. Got plone.app.form 1.0.4. Getting distribution for 'plone.app.i18n==1.0.3'. Got plone.app.i18n 1.0.3. Getting distribution for 'plone.app.iterate==1.0'. Got plone.app.iterate 1.0. Getting distribution for 'plone.app.kss==1.2.5'. Got plone.app.kss 1.2.5. Getting distribution for 'plone.app.layout==1.0.5'. Got plone.app.layout 1.0.5. Getting distribution for 'plone.app.linkintegrity==1.0.5'. Got plone.app.linkintegrity 1.0.5. Getting distribution for 'plone.app.openid==1.0.1'. Got plone.app.openid 1.0.1. Getting distribution for 'plone.app.portlets==1.0.6'. Got plone.app.portlets 1.0.6. Getting distribution for 'plone.app.redirector==1.0.5'. セグメンテーション違反です
うーん、途中で終わるんだよなぁ。Zope環境をお手軽に作成できるようなのでちゃんと動作すれば便利なんだろうけどなぁ。
*1:実体は何処にあるんだろう。