Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
8eaa6efb
Commit
8eaa6efb
authored
Jul 16, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import code formatting and use 2.1isms such as string methods.
parent
22e838ba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
57 deletions
+67
-57
src/ZEO/start.py
src/ZEO/start.py
+67
-57
No files found.
src/ZEO/start.py
View file @
8eaa6efb
...
@@ -12,69 +12,68 @@
...
@@ -12,69 +12,68 @@
#
#
##############################################################################
##############################################################################
"""Start the server storage.
"""Start the server storage.
"""
__version__
=
"$Revision: 1.34 $"
[
11
:
-
2
]
$Id: start.py,v 1.35 2002/07/16 18:30:03 jeremy Exp $
"""
import
sys
,
os
,
getopt
,
string
import
sys
,
os
,
getopt
import
types
def
directory
(
p
,
n
=
1
):
def
directory
(
p
,
n
=
1
):
d
=
p
d
=
p
while
n
:
while
n
:
d
=
os
.
path
.
split
(
d
)[
0
]
d
=
os
.
path
.
split
(
d
)[
0
]
if
not
d
or
d
==
'.'
:
d
=
os
.
getcwd
()
if
not
d
or
d
==
'.'
:
n
=
n
-
1
d
=
os
.
getcwd
()
n
-=
1
return
d
return
d
def
get_storage
(
m
,
n
,
cache
=
{}):
def
get_storage
(
m
,
n
,
cache
=
{}):
p
=
sys
.
path
p
=
sys
.
path
d
,
m
=
os
.
path
.
split
(
m
)
d
,
m
=
os
.
path
.
split
(
m
)
if
m
[
-
3
:]
==
'.py'
:
m
=
m
[:
-
3
]
if
m
.
endswith
(
'.py'
):
im
=
cache
.
get
((
d
,
m
),
0
)
m
=
m
[:
-
3
]
if
im
==
0
:
im
=
cache
.
get
((
d
,
m
))
if
d
:
p
=
[
d
]
+
p
if
im
is
None
:
if
d
:
p
=
[
d
]
+
p
import
imp
import
imp
im
=
imp
.
find_module
(
m
,
p
)
im
=
imp
.
find_module
(
m
,
p
)
im
=
imp
.
load_module
(
m
,
im
[
0
],
im
[
1
],
im
[
2
]
)
im
=
imp
.
load_module
(
m
,
*
im
)
cache
[(
d
,
m
)]
=
im
cache
[(
d
,
m
)]
=
im
return
getattr
(
im
,
n
)
return
getattr
(
im
,
n
)
def
main
(
argv
):
def
main
(
argv
):
me
=
argv
[
0
]
me
=
argv
[
0
]
sys
.
path
.
insert
(
0
,
directory
(
me
,
2
))
sys
.
path
.
insert
(
0
,
directory
(
me
,
2
))
# XXX hack for profiling support
# XXX hack for profiling support
global
unix
,
storages
,
zeo_pid
,
asyncore
global
unix
,
storages
,
zeo_pid
,
asyncore
args
=
[]
args
=
[]
last
=
''
last
=
''
for
a
in
argv
[
1
:]:
for
a
in
argv
[
1
:]:
if
(
a
[:
1
]
!=
'-'
and
string
.
find
(
a
,
'='
)
>
0
if
(
a
[:
1
]
!=
'-'
and
a
.
find
(
'='
)
>
0
and
last
!=
'-S'
):
# lame, sorry
and
last
!=
'-S'
# lame, sorry
a
=
a
.
split
(
"="
)
):
os
.
environ
[
a
[
0
]]
=
"="
.
join
(
a
[
1
:])
a
=
string
.
split
(
a
,
'='
)
os
.
environ
[
a
[
0
]]
=
string
.
join
(
a
[
1
:],
'='
)
continue
continue
args
.
append
(
a
)
args
.
append
(
a
)
last
=
a
last
=
a
if
os
.
environ
.
has_key
(
'INSTANCE_HOME'
):
if
os
.
environ
.
has_key
(
'INSTANCE_HOME'
):
INSTANCE_HOME
=
os
.
environ
[
'INSTANCE_HOME'
]
INSTANCE_HOME
=
os
.
environ
[
'INSTANCE_HOME'
]
elif
os
.
path
.
isdir
(
os
.
path
.
join
(
directory
(
me
,
4
),
'var'
)):
elif
os
.
path
.
isdir
(
os
.
path
.
join
(
directory
(
me
,
4
),
'var'
)):
INSTANCE_HOME
=
directory
(
me
,
4
)
INSTANCE_HOME
=
directory
(
me
,
4
)
else
:
else
:
INSTANCE_HOME
=
os
.
getcwd
()
INSTANCE_HOME
=
os
.
getcwd
()
if
os
.
path
.
isdir
(
os
.
path
.
join
(
INSTANCE_HOME
,
'var'
)):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
INSTANCE_HOME
,
'var'
)):
var
=
os
.
path
.
join
(
INSTANCE_HOME
,
'var'
)
var
=
os
.
path
.
join
(
INSTANCE_HOME
,
'var'
)
else
:
else
:
var
=
INSTANCE_HOME
var
=
INSTANCE_HOME
zeo_pid
=
os
.
environ
.
get
(
'ZEO_SERVER_PID'
,
zeo_pid
=
os
.
environ
.
get
(
'ZEO_SERVER_PID'
,
os
.
path
.
join
(
var
,
'ZEO_SERVER.pid'
)
os
.
path
.
join
(
var
,
'ZEO_SERVER.pid'
))
)
fs
=
os
.
path
.
join
(
var
,
'Data.fs'
)
fs
=
os
.
path
.
join
(
var
,
'Data.fs'
)
...
@@ -168,9 +167,9 @@ def main(argv):
...
@@ -168,9 +167,9 @@ def main(argv):
print
usage
print
usage
print
'Unrecognizd arguments: '
,
string
.
join
(
args
[
1
:])
print
'Unrecognizd arguments: '
,
string
.
join
(
args
[
1
:])
sys
.
exit
(
1
)
sys
.
exit
(
1
)
fs
=
args
[
0
]
fs
=
args
[
0
]
__builtins__
.
__debug__
=
debug
## __builtins__.__debug__ =
debug
if
debug
:
if
debug
:
os
.
environ
[
'Z_DEBUG_MODE'
]
=
'1'
os
.
environ
[
'Z_DEBUG_MODE'
]
=
'1'
if
detailed
:
if
detailed
:
...
@@ -184,13 +183,15 @@ def main(argv):
...
@@ -184,13 +183,15 @@ def main(argv):
try
:
try
:
import
pwd
import
pwd
try
:
try
:
try
:
UID
=
string
.
atoi
(
UID
)
try
:
except
:
pass
UID
=
int
(
UID
)
except
:
pass
gid
=
None
gid
=
None
if
type
(
UID
)
==
type
(
""
):
if
isinstance
(
UID
,
types
.
StringType
):
uid
=
pwd
.
getpwnam
(
UID
)[
2
]
uid
=
pwd
.
getpwnam
(
UID
)[
2
]
gid
=
pwd
.
getpwnam
(
UID
)[
3
]
gid
=
pwd
.
getpwnam
(
UID
)[
3
]
elif
type
(
UID
)
==
type
(
1
):
elif
isinstance
(
UID
,
types
.
IntType
):
uid
=
pwd
.
getpwuid
(
UID
)[
2
]
uid
=
pwd
.
getpwuid
(
UID
)[
2
]
gid
=
pwd
.
getpwuid
(
UID
)[
3
]
gid
=
pwd
.
getpwuid
(
UID
)[
3
]
else
:
else
:
...
@@ -210,8 +211,10 @@ def main(argv):
...
@@ -210,8 +211,10 @@ def main(argv):
pass
pass
if
Z
:
if
Z
:
try
:
import
posix
try
:
except
:
pass
import
posix
except
:
pass
else
:
else
:
import
zdaemon
import
zdaemon
zdaemon
.
run
(
sys
.
argv
,
''
)
zdaemon
.
run
(
sys
.
argv
,
''
)
...
@@ -255,12 +258,13 @@ def main(argv):
...
@@ -255,12 +258,13 @@ def main(argv):
except
:
except
:
pass
pass
items
=
storages
.
items
()
items
=
storages
.
items
()
items
.
sort
()
items
.
sort
()
for
kv
in
items
:
for
kv
in
items
:
LOG
(
'ZEO Server'
,
INFO
,
'Serving %s:
\
t
%s'
%
kv
)
LOG
(
'ZEO Server'
,
INFO
,
'Serving %s:
\
t
%s'
%
kv
)
if
not
unix
:
unix
=
host
,
port
if
not
unix
:
unix
=
host
,
port
ZEO
.
StorageServer
.
StorageServer
(
unix
,
storages
)
ZEO
.
StorageServer
.
StorageServer
(
unix
,
storages
)
...
@@ -276,13 +280,12 @@ def main(argv):
...
@@ -276,13 +280,12 @@ def main(argv):
info
=
sys
.
exc_info
()
info
=
sys
.
exc_info
()
try
:
try
:
import
zLOG
import
zLOG
zLOG
.
LOG
(
"z2"
,
zLOG
.
PANIC
,
"Startup exception"
,
zLOG
.
LOG
(
"z2"
,
zLOG
.
PANIC
,
"Startup exception"
,
error
=
info
)
error
=
info
)
except
:
except
:
pass
pass
import
traceback
import
traceback
apply
(
traceback
.
print_exception
,
info
)
traceback
.
print_exception
(
*
info
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -310,21 +313,28 @@ def shutdown(storages, die=1):
...
@@ -310,21 +313,28 @@ def shutdown(storages, die=1):
# unnecessary, since we now use so_reuseaddr.
# unnecessary, since we now use so_reuseaddr.
for
ignored
in
1
,
2
:
for
ignored
in
1
,
2
:
for
socket
in
asyncore
.
socket_map
.
values
():
for
socket
in
asyncore
.
socket_map
.
values
():
try
:
socket
.
close
()
try
:
except
:
pass
socket
.
close
()
except
:
pass
for
storage
in
storages
.
values
():
for
storage
in
storages
.
values
():
try
:
storage
.
close
()
try
:
finally
:
pass
storage
.
close
()
finally
:
pass
try
:
try
:
from
zLOG
import
LOG
,
INFO
from
zLOG
import
LOG
,
INFO
LOG
(
'ZEO Server'
,
INFO
,
s
=
die
and
"shutdown"
or
"restart"
"Shutting down (%s)"
%
(
die
and
"shutdown"
or
"restart"
)
LOG
(
'ZEO Server'
,
INFO
,
"Shutting down (%s)"
%
s
)
)
except
:
except
:
pass
pass
if
die
:
sys
.
exit
(
0
)
if
die
:
else
:
sys
.
exit
(
1
)
sys
.
exit
(
0
)
else
:
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
main
(
sys
.
argv
)
if
__name__
==
'__main__'
:
main
(
sys
.
argv
)
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