Personal tools
You are here: Home なごぶろ

Windows上のbuildoutな環境で素のPloneをセットアップする

※パスにスペースが含まれないディレクトリで作業を行う。ここでは「C:\」で作業を進める

Python2.4にeasy_installをインストールし、これを使ってZopeSkelをインストールする。

pasterコマンドでテンプレートを確認。

C:\>paster create --list-template
Available templates:
  archetype:          A Plone project that uses Archetypes
  basic_namespace:    A project with a namespace package
  basic_package:      A basic setuptools-enabled package
  basic_zope:         A Zope project
  kss_plugin:         A KSS plugin template
  nested_namespace:   A project with two nested namespaces.
  paste_deploy:       A web application deployed through paste.deploy
  plone:              A Plone project
  plone2.5_buildout:  A buildout for Plone 2.5 projects
  plone2.5_theme:     A Theme for Plone 2.5
  plone2_theme:       A Theme Product for Plone 2.1 & Plone 2.5
  plone3_buildout:    A buildout for Plone 3 projects
  plone3_portlet:     A Plone 3 portlet
  plone3_theme:       A Theme for Plone 3.0
  plone_app:          A Plone App project
  plone_hosting:      Plone hosting: buildout with ZEO and any Plone version
  plone_pas:          A Plone PAS project
  recipe:             A recipe project for zc.buildout
  silva_buildout:     A buildout for Silva projects

続けて「Python Win32 extensions for Python 2.4」と「mingw32 compiler」をインストール。環境変数に「C:\MingW32\bin」を追加。

※後にこの「C:\MingW32\bin」で罠にはまる。

最後にdistutilsの設定。「C:\Python24\Lib\distutils」の中に「distutils.cfg」というファイルを作成し、内容を下記のようにする。

[build]
compiler=mingw32

 pasterを使ってスキン作成用のbuildoutを生成する。

C:\>paster create -t plone3_buildout skinproject
Selected and implied templates:
  zopeskel#plone3_buildout  A buildout for Plone 3 projects
 
Variables:
  egg:      skinproject
  package:  skinproject
  project:  skinproject
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) ['']: hoge
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 .\skinproject
  Copying README.txt to .\skinproject\README.txt
  Copying bootstrap.py to .\skinproject\bootstrap.py
C:\Python24\lib\site-packages\cheetah-2.0.1-py2.4.egg\Cheetah\Compiler.py:1531:
UserWarning:
You don't have the C version of NameMapper installed! I'm disabling Cheetah's us
eStackFrames option as it is painfully slow with the Python version of NameMappe
r. You should get a copy of Cheetah with the compiled C version of NameMapper.
  warnings.warn(
  Copying buildout.cfg_tmpl to .\skinproject\buildout.cfg
  Recursing into products
    Creating .\skinproject\products/
    Copying README.txt to .\skinproject\products\README.txt
  Recursing into src
    Creating .\skinproject\src/
    Copying README.txt to .\skinproject\src\README.txt
  Recursing into var
    Creating .\skinproject\var/
    Copying README.txt to .\skinproject\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
-----------------------------------------------------------

ひな形ができたのでプロジェクトフォルダへ移動してブートストラップを実行する。

C:\>cd skinproject
 
C:\skinproject>python bootstrap.py
Creating directory 'C:\\skinproject\\bin'.
Creating directory 'C:\\skinproject\\parts'.
Creating directory 'C:\\skinproject\\eggs'.
Creating directory 'C:\\skinproject\\develop-eggs'.
Generated script 'C:\\skinproject\\bin\\buildout'.

binフォルダの中に「buildout.exe」と「buildout-script.py」が生成されているようだ。exeを実行してもうまくいかないので、スクリプトの方を実行してみる。

C:\skinproject>python bin/buildout-script.py
Getting distribution for 'plone.recipe.plone>=3.1.1,<3.2dev'.
Got plone.recipe.plone 3.1.5.1.
Getting distribution for 'plone.recipe.distros'.
Got plone.recipe.distros 1.3.
Getting distribution for 'zc.recipe.egg'.
Got zc.recipe.egg 1.1.0.
Getting distribution for 'plone.recipe.zope2install'.
Got plone.recipe.zope2install 2.3.
Getting distribution for 'plone.recipe.zope2instance'.
Got plone.recipe.zope2instance 2.4.
Installing plone.
Getting distribution for 'archetypes.kss==1.4.2'.
Got archetypes.kss 1.4.2.
Getting distribution for 'borg.localrole==2.0.1'.
Got borg.localrole 2.0.1.
Getting distribution for 'kss.core==1.4.3'.
Got kss.core 1.4.3.
Getting distribution for 'kss.demo==1.4.3'.
Got kss.demo 1.4.3.
Getting distribution for 'plone.app.content==1.3'.
Got plone.app.content 1.3.
Getting distribution for 'plone.app.contentmenu==1.1.5'.
Got plone.app.contentmenu 1.1.5.
Getting distribution for 'plone.app.contentrules==1.1.5'.
Got plone.app.contentrules 1.1.5.
Getting distribution for 'plone.app.controlpanel==1.1.2'.
Got plone.app.controlpanel 1.1.2.
Getting distribution for 'plone.app.customerize==1.1.2'.
Got plone.app.customerize 1.1.2.
Getting distribution for 'plone.app.form==1.1.5'.
Got plone.app.form 1.1.5.
Getting distribution for 'plone.app.i18n==1.0.5'.
Got plone.app.i18n 1.0.5.
Getting distribution for 'plone.app.iterate==1.1.5'.
Got plone.app.iterate 1.1.5.
Getting distribution for 'plone.app.kss==1.4.3'.
Got plone.app.kss 1.4.3.
Getting distribution for 'plone.app.layout==1.1.5'.
Got plone.app.layout 1.1.5.
Getting distribution for 'plone.app.linkintegrity==1.0.10'.
Got plone.app.linkintegrity 1.0.10.
Getting distribution for 'plone.app.openid==1.1'.
Got plone.app.openid 1.1.
Getting distribution for 'plone.app.portlets==1.1.5.1'.
Got plone.app.portlets 1.1.5.1.
Getting distribution for 'plone.app.redirector==1.0.9'.
Got plone.app.redirector 1.0.9.
Getting distribution for 'plone.app.viewletmanager==1.2.1'.
Got plone.app.viewletmanager 1.2.1.
Getting distribution for 'plone.app.vocabularies==1.0.5'.
Got plone.app.vocabularies 1.0.5.
Getting distribution for 'plone.app.workflow==1.1.5'.
Got plone.app.workflow 1.1.5.
Getting distribution for 'plone.browserlayer==1.0.0'.
Got plone.browserlayer 1.0.0.
Getting distribution for 'plone.contentrules==1.1.0'.
Got plone.contentrules 1.1.0.
Getting distribution for 'plone.fieldsets==1.0.3'.
Got plone.fieldsets 1.0.3.
Getting distribution for 'plone.i18n==1.0.6'.
Got plone.i18n 1.0.6.
Getting distribution for 'plone.intelligenttext==1.0.2'.
Got plone.intelligenttext 1.0.2.
Getting distribution for 'plone.keyring==1.2'.
Got plone.keyring 1.2.
Getting distribution for 'plone.locking==1.0.5'.
Got plone.locking 1.0.5.
Getting distribution for 'plone.memoize==1.0.4'.
Got plone.memoize 1.0.4.
Getting distribution for 'plone.openid==1.2'.
Got plone.openid 1.2.
Getting distribution for 'plone.portlets==1.1.0'.
Got plone.portlets 1.1.0.
Getting distribution for 'plone.protect==1.1'.
Got plone.protect 1.1.
Getting distribution for 'plone.session==2.0'.
Got plone.session 2.0.
Getting distribution for 'plone.theme==1.0'.
Got plone.theme 1.0.
Getting distribution for 'plone.portlet.collection==1.1.3'.
Got plone.portlet.collection 1.1.3.
Getting distribution for 'plone.portlet.static==1.1.5'.
Got plone.portlet.static 1.1.5.
Getting distribution for 'wicked==1.1.6'.
Got wicked 1.1.6.
Getting distribution for 'five.customerize==0.3'.
Got five.customerize 0.3.
Getting distribution for 'five.localsitemanager==0.4'
Got five.localsitemanager 0.4.
Getting distribution for 'python-openid>=2.2.1,<2.3dev'.
warning: no files found matching 'README' under directory 'examples'
warning: no files found matching 'discover' under directory 'examples'
warning: no files found matching 'dhpriv' under directory 'openid\test'
warning: no files found matching 'n2b64' under directory 'openid\test'
zip_safe flag not set; analyzing archive contents...
Got python-openid 2.2.1.
Getting distribution for 'elementtree'.
Got elementtree 1.2.7-20070827-preview.
Installing zope2.
running build_ext
creating zope.proxy
copying zope/proxy\proxy.h -> zope.proxy
building 'AccessControl.cAccessControl' extension
creating build
creating build\temp.win32-2.4
creating build\temp.win32-2.4\Release
creating build\temp.win32-2.4\Release\accesscontrol
gcc -mno-cygwin -mdll -O -Wall -IExtensionClass -I. -IAcquisition -IC:\Python24\
include -IC:\Python24\PC -c AccessControl/cAccessControl.c -o build\temp.win32-2
.4\Release\accesscontrol\caccesscontrol.o
error: command 'gcc' failed: No such file or directory
While:
  Installing zope2.
 
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "c:\docume~1\nyusuke\locals~1\temp\tmppcyhrl\zc.buildout-1.1.1-py2.4.egg\
zc\buildout\buildout.py", line 1477, in main
  File "c:\docume~1\nyusuke\locals~1\temp\tmppcyhrl\zc.buildout-1.1.1-py2.4.egg\
zc\buildout\buildout.py", line 462, in install
  File "c:\docume~1\nyusuke\locals~1\temp\tmppcyhrl\zc.buildout-1.1.1-py2.4.egg\
zc\buildout\buildout.py", line 1060, in _call
  File "c:\skinproject\eggs\plone.recipe.zope2install-2.3-py2.4.egg\plone\recipe
\zope2install\__init__.py", line 146, in install
    'build_ext', '-i',
AssertionError

コンパイルでエラー。gccが見つからない???

よく見たらコンパイラのパスが「MingW32」ではなく「MinGW」であることが判明。パスを「C:\MinGW\bin」に変更して再度「python bin/buildout-script.py」を実行。無事に最後まで作業が進んだ模様。

binディレクトリの内容はこんな感じ。

C:\skinproject>dir bin
 ドライブ C のボリューム ラベルがありません。
 ボリューム シリアル番号は 107C-971F です
 
 C:\skinproject\bin のディレクトリ
 
2008/09/04  02:37    <DIR>          .
2008/09/04  02:37    <DIR>          ..
2008/09/04  02:13               273 buildout-script.py
2008/09/04  02:13             6,656 buildout.exe
2008/09/04  02:37             3,153 instance-script.py
2008/09/04  02:37             6,656 instance.exe
2008/09/04  02:37               239 repozo-script.py
2008/09/04  02:37             6,656 repozo.exe
2008/09/04  02:37             3,191 zopepy-script.py
2008/09/04  02:37             6,656 zopepy.exe
               8 個のファイル              33,480 バイト
               2 個のディレクトリ  56,740,868,096 バイトの空き領域 

instance-script.pyを実行してみる。

C:\skinproject>python bin/instance-script.py fg
C:\skinproject\parts\instance\bin\runzope -X debug-mode=on
 
C:\skinproject>"C:\Python24\python.exe" "C:\skinproject\parts\instance\bin\servi
cewrapper.py" -C "C:\skinproject\parts\instance\etc\zope.conf" "-X" "debug-mode=
on"
2008-09-04 02:40:19 INFO ZServer HTTP server started at Thu Sep 04 02:40:19 2008
 
        Hostname: wxp
        Port: 8080

今回は管理者名「admin」、パスワード「hoge」で設定してあるので、ZMIへ入る。Ploneインスタンスはまだ無い。ひとまずPloneを追加できることを確認。

眠いので寝る。

Ploneサイトをbuildout対応にするための準備 - ドキュメントを読む

まずはbuildoutについて理解を深めないといけないと思い立ってドキュメントを読了しました。落語を聞きながら訳していたので意味不明な箇所がボロボロ出てきましたが、ざっとわかればよいという程度なので流し読み&意訳

少し手間がかかりそうなので、buildout対応するより先にデザイン作った方がいいのかもしれません。とりあえずオールドスタイルでスキンプロダクトを作って、その後buildout対応する流れを考えていますが、どちらも結構なパワーが必要になりそうで、楽しそうでありながらもめんどくささも感じている次第です。

Category(s)
Plone Plone

COREBlog2のコメント・トラックバック一覧でエラーが出ていた

管理者で特定のエントリを表示したときに、コメント一覧とかトラックバック一覧のタブが表示されますが、これをクリックしたときにエラーが出てしまいました。

portal_skin/COREBlog2/cbentry_commentsを見てみると、

<metal:block use-macro="here/folder_contents/macros/folder_listing" />

<metal:block use-macro="here/folder_contents/macros/folder_buttons" />

の部分でエラーを吐いている模様でしたが、調べてみてもどうもよくわかりませんでした。

仕方なく

<metal:block use-macro="here/folder_contents/macros/folder_listing | here/old_folder_contents/macros/folder_listing" />

<metal:block use-macro="here/folder_contents/macros/folder_buttons | here/old_folder_contents/macros/folder_buttons" />

という激しく後ろ向きな回避策で対応しました。何がダメなんだろう…。

※ついでにコメントでエラーが出る不具合も修正しました。