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
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
ZEO
Commits
ccb4748d
Commit
ccb4748d
authored
Apr 05, 2001
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redid ZServer search to use package path info.
parent
aa0d4f47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
17 deletions
+30
-17
src/ZEO/fap.py
src/ZEO/fap.py
+30
-17
No files found.
src/ZEO/fap.py
View file @
ccb4748d
...
...
@@ -88,40 +88,40 @@
Try to fix up the imports of these to make these dependencies work,
localizing the hacks^H^H^H^H^Hchanges here.
"""
import
sys
import
sys
,
os
def
whiff
(
where
):
if
not
where
:
return
0
import
os
,
imp
import
imp
try
:
m
=
imp
.
find_module
(
'ZServer'
,
[
where
])
except
:
return
0
else
:
return
1
def
fap
(
where
=
''
):
def
fap
():
# if we are using an old version of Python, our asyncore is likely to
# be out of date. If ZServer is sitting around, we can get a current
# version of ayncore from it. In any case, if we are going to be used
# with Zope, it's important to use the version from Zope.
try
:
from
ZServer.medusa
import
asyncore
import
ZServer
except
:
# Try a little harder to import ZServer
import
os
,
imp
location
=
package_home
()
location
=
os
.
path
.
split
(
location
)[
0
]
location
=
os
.
path
.
split
(
location
)[
0
]
location
=
os
.
path
.
split
(
location
)[
0
]
if
whiff
(
location
):
sys
.
path
.
append
(
location
)
try
:
import
ZServer
except
:
pass
asyncore
=
None
for
location
in
where
,
'.'
,
os
.
path
.
join
(
'..'
,
'..'
):
if
whiff
(
location
):
sys
.
path
.
append
(
location
)
try
:
from
ZServer.medusa
import
asyncore
except
:
import
asyncore
break
if
asyncore
is
None
:
import
asyncore
import
asyncore
if
sys
.
version
[:
1
]
<
'2'
and
asyncore
.
loop
.
func_code
.
co_argcount
<
3
:
raise
ImportError
,
'Cannot import an up-to-date asyncore'
...
...
@@ -146,3 +146,16 @@ def fap(where=''):
except
:
raise
ImportError
,
'Cannot import an up-to-date cPickle'
def
package_home
():
m
=
sys
.
modules
[
__name__
]
if
hasattr
(
m
,
'__path__'
):
r
=
m
.
__path__
[
0
]
elif
"."
in
__name__
:
from
string
import
rfind
r
=
sys
.
modules
[
__name__
[:
rfind
(
__name__
,
'.'
)]].
__path__
[
0
]
else
:
r
=
__name__
return
os
.
path
.
join
(
os
.
getcwd
(),
r
)
fap
()
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