已解决:Plone 不会通过 SVN 检查开发插件。原因:Plone 附加组件的名称中不能有破折号

SOLVED: Plone does not checkout a development addon over SVN. Reason: Plone add-ons cannot have dashes in the name

问题已解决: 在创建 Plone 插件项目时,请确保您的插件名称在使用 Mr. Bob 创建时没有任何破折号。我花了大约 3 个小时才弄明白。

我打算为 Plone 开发一个附加组件。根据我阅读手册后收集到的信息,与我的开发工具兼容的最佳方法是设置一个独立的 SVN HTTP 服务器并让 Plone 将我的附加组件的源代码检出到它自己的目录中。

读完之后,我开始安装 Mr. Bob 和 Plone 的 bobtemplates (pip install mr.bob bobtemplates.plone)。然后我在我的 SVN 服务器上创建了一个新目录,使用 svn checkout https://192.168.1.10/svn/SVN/plone-test/trunk 将它检出到我本地文件系统中的一个新目录中,并以这种方式初始化了一个新项目:

~/plone/test/trunk$ mrbob -O plone.app.RAKK-test bobtemplates.plone:addon

Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.

Answer with a question mark to display help.
Values in square brackets at the end of the questions show the default value if there is no answer.


--> Author's name [FakeGitUserOrEmail]: RAKK

--> Author's email [FakeGitUserOrEmail]: rakk@example.com

--> Author's GitHub username:

--> Package description [An add-on for Plone]: Add-on test for Plone

--> Do you want me to initialze a GIT repository in your new package? (y/n) [y]: n

--> Plone version [5.1]: 5.2

--> Python version for virtualenv [python2.7]: python3.7


git init is disabled!
Generated file structure at /home/user/plone/test/trunk/plone.app.RAKK-test

然后我将新创建的源上传到 Subversion:svn add *,然后 svn commit

随着我新创建的项目,我在我的配置文件中添加了以下条目/opt/plone/zinstance/develop.cfg:

[sources]
plone.app.RAKK-test = svn https://192.168.1.10/svn/SVN/plone-test/trunk/plone.app.RAKK-test

[buildout]
always-accept-server-certificate = true

为了排除证书接受可能出现的问题,我创建了一个名为 /tmp/plone-temp 的临时目录并将其所有权设置为 chown -R plone_buildout:plone_group /tmp/plone-temp,然后 运行 用户 [=20] 下的 SVN 检出=]:sudo -u plone_buildout svn checkout https://192.168.1.10/svn/SVN/plone-test/trunk/plone.app.RAKK-test。 SVN 确实要求我信任我的服务器证书,对此我选择了永久信任它的选项。

然后,在没有 Plone 运行 的情况下,我让 Buildout 应用开发配置:cd /opt/plone/zinstance,然后 sudo -u plone_buildout bin/buildout -c develop.cfg.

但是,Buildout 失败并出现以下错误:

root@host:/opt/plone/zinstance# sudo -u plone_buildout bin/buildout -c develop.cfg
mr.developer: Queued 'plone.app.RAKK-test' for checkout.
mr.developer: Checked out 'plone.app.RAKK-test' with subversion.
Develop: '/opt/plone/zinstance/src/plone.app.RAKK-test'
error in plone.app.RAKK-test setup command: ("EntryPoint must be in 'name=module:attrs [extras]' format", 'update_locale = plone.app.RAKK-test.locales.update:update_locale')
While:
  Installing.
  Processing develop directory '/opt/plone/zinstance/src/plone.app.RAKK-test'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/opt/plone/zinstance/lib/python3.7/site-packages/zc/buildout/buildout.py", line 2174, in main
    getattr(buildout, command)(args)
  File "/opt/plone/zinstance/lib/python3.7/site-packages/zc/buildout/buildout.py", line 679, in install
    installed_develop_eggs = self._develop()
  File "/opt/plone/zinstance/lib/python3.7/site-packages/zc/buildout/buildout.py", line 922, in _develop
    zc.buildout.easy_install.develop(setup, dest)
  File "/opt/plone/zinstance/lib/python3.7/site-packages/zc/buildout/easy_install.py", line 1100, in develop
    call_subprocess(args)
  File "/opt/plone/zinstance/lib/python3.7/site-packages/zc/buildout/easy_install.py", line 166, in call_subprocess
    % repr(args)[1:-1])
Exception: Failed to run command:
'/opt/plone/zinstance/bin/python3.7', '/tmp/tmp7pwev_7c', '-q', 'develop', '-mN', '-d', '/opt/plone/zinstance/develop-eggs/tmpd785ylqtbuild'

这意味着你的项目名称中有一个连字符,这使得它与 pip 不兼容,pip 显然是 Plone 用来加载自定义开发的插件的后端。

在用头撞墙 3 小时并第 10 次重新阅读所有内容后,我发现在我之前链接的线程上有一条建议,我的包名称中有一个破折号可能会导致它与 pip 不兼容。再次执行所有这些步骤但没有连字符的名称后,Buildout 终于拿起了我的包裹。

因此我宣布这个问题已解决,并将这个问题留在这里是为了 public 让每个人的生活更轻松,因为很容易陷入这个错误并且弄清楚它并非易事。