Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ceb44e28
Commit
ceb44e28
authored
Feb 19, 2009
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-removed repoze' instance.py
parent
72b20414
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
86 deletions
+0
-86
src/Zope2/utilities/instance.py
src/Zope2/utilities/instance.py
+0
-86
No files found.
src/Zope2/utilities/instance.py
deleted
100644 → 0
View file @
72b20414
import
optparse
import
os
import
os.path
import
sys
import
re
here
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
# I would use string.Template, but it's just too hard to change it to
# respect only ${brace} syntax instead of both that and $name syntax.
TOKEN_RE
=
re
.
compile
(
r'\
$
\{([\
.
\w/-]+)\
}
')
def rewrite(repltext, **kw):
def replace(match):
return kw[match.group(1)]
return TOKEN_RE.sub(replace, repltext)
def mkinstance(conf):
sandbox = conf['
sandbox
']
for dir in ('
bin
', '
etc
', '
var
', '
Products
', '
import
', '
log
'):
path = os.path.join(sandbox, dir)
if not os.path.exists(path):
os.makedirs(path)
try:
# this is (stupidly) required by the zdrun key in the <runner>
# section of zeo.conf
import zdaemon
conf['
zdaemon_pkgdir
'] = zdaemon.__path__[0]
except ImportError:
conf['
zdaemon_pkgdir
'] = '
{
unknown
}
'
zope_conf = conf['
zope_conf
']
site_zcml = conf['
site_zcml
']
for source, target in (
('
zope2
.
ini
', '
zope2
.
ini
'),
(site_zcml, '
site
.
zcml
'),
(zope_conf, '
zope
.
conf
'),
('
apache2
.
conf
', '
apache2
.
conf
'),
('
zeo
.
conf
', '
zeo
.
conf
'),
):
template = open(os.path.join(here, '
etc
', source), 'r').read()
result = rewrite(template, **conf)
targetfile = os.path.join(sandbox, '
etc
', target)
if not os.path.exists(targetfile):
open(targetfile, '
w
').write(result)
template = open(os.path.join(here, '
etc
', '
zope2
.
wsgi
'), 'r').read()
result = rewrite(template, **conf)
targetfile = os.path.join(sandbox, '
bin
', '
zope2
.
wsgi
')
if not os.path.exists(targetfile):
open(targetfile, '
w
').write(result)
os.chmod(targetfile, 0755)
def main(argv=sys.argv):
""" Console script target """
parser = optparse.OptionParser(
usage='
%
prog
[
OPTIONS
]
'
)
parser.add_option('
-
s
', '
--
sandbox
', action='
store
', dest='
sandbox
',
default='
.
', help='
Create
the
instance
in
this
directory
')
parser.add_option('
-
p
', '
--
zope
-
port
', action='
store
', dest='
zope_port
',
default='
8080
', help='
Zope
HTTP
port
')
parser.add_option('
-
j
', '
--
zeo
-
port
', action='
store
', dest='
zeo_port
',
default='
8100
', help='
ZEO
server
port
number
')
parser.add_option('
-
z
', '
--
use
-
zeo
', action='
store_true
', dest='
use_zeo
',
default=False, help='
Use
ZEO
to
house
main
storage
')
options, args = parser.parse_args(argv)
try:
# Zope 2.10+ (Five 1.5.3?+)
from Products.Five.fivedirectives import IRegisterPackageDirective
options.site_zcml = '
zope
-
2.10
+-
site
.
zcml
'
except ImportError:
# Zope 2.9 (or Five before 1.5.3?)
options.site_zcml = '
zope
-
2.9
-
site
.
zcml
'
if options.use_zeo:
options.zope_conf = '
zope
-
zeoclient
.
conf
'
else:
options.zope_conf = '
zope
-
nonzeoclient
.
conf
'
options.python = sys.executable
conf = options.__dict__
sandbox = conf['
sandbox
']
conf['
sandbox
'] = os.path.abspath(os.path.normpath(os.path.expanduser(
sandbox)))
mkinstance(conf)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment