[Zope3-Users] Re: mkzopeapp to create project.package named
applications?
Philipp von Weitershausen
philipp at weitershausen.de
Mon Jul 9 03:12:33 EDT 2007
Jeff Kowalczyk wrote:
> Phillip, thanks for releasing mkzopeapp. I recently got started with a
> buildout-enabled zope-3 project by imitating the layout of z3c.formdemo.
>
> How would I use mkzopeapp to create a project.package name like
> z3c.formdemo, or is this not generally recommended for application
> packages?
Currently mkzopeapp doesn't support the creation of namespaced packages
out of the box, but it's really easy to do this manually (see below).
> $ mkzopeapp AcmeSite
> Selected and implied templates:
> mkzopeapp#zope_app Package that contains a Zope application
>
> Variables:
> egg: AcmeSite
> package: acmesite
> project: AcmeSite
> Creating template zope_app
> Creating directory ./AcmeSite
> Recursing into +package+
> Creating ./AcmeSite/acmesite/
> Copying __init__.py to ./AcmeSite/acmesite/__init__.py
> Copying configure.zcml_tmpl to ./AcmeSite/acmesite/configure.zcml
> Copying develop.ini to ./AcmeSite/acmesite/develop.ini
> Copying main.py_tmpl to ./AcmeSite/acmesite/main.py
> Recursing into var
> Creating ./AcmeSite/acmesite/var/
> Copying README.txt to ./AcmeSite/acmesite/var/README.txt
> Copying setup.py_tmpl to ./AcmeSite/setup.py
> Running /usr/bin/python setup.py egg_info
To convert the 'acmesite' package into a package called 'jeff.acmesite',
simply do:
$ cd AcmeSite
$ mkdir jeff
$ mv acmesite jeff
Then create jeff/__init__.py:
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
Then edit setup.py and add the following parameter:
namespace_packages=['jeff'],
Done.
--
http://worldcookery.com -- Professional Zope documentation and training
More information about the Zope3-users
mailing list