[svn r38808] trying to be more ignorant about missing abilities

to remove c-extension modules (they might be in
site-packages) and adding a hack to make sure
that the greenlet module gets build ahead of
the setup install.

--HG--
branch : trunk
This commit is contained in:
hpk 2007-02-14 13:13:39 +01:00
parent d02d937b74
commit 86155cceb8
2 changed files with 36 additions and 26 deletions

View File

@ -135,6 +135,12 @@ def set_registry_value(reg, key, value_name, value):
def setup(pkg, **kw):
""" invoke distutils on a given package.
"""
print "precompiling greenlet module"
try:
x = py.magic.greenlet()
except ImportError:
print "could not precompile greenlet module, skipping"
params = Params(pkg)
#dump(params)
source = getattr(pkg, '__package__', pkg)

View File

@ -31,38 +31,42 @@ def make_module_from_c(cfile):
raise ImportError, "cannot find the file name suffix of C ext modules"
lib = dirpath.join(modname+ext)
# argl! we need better "build"-locations alltogether!
# XXX argl! we need better "build"-locations alltogether!
if lib.check():
lib.remove()
c = py.io.StdCaptureFD()
try:
try:
saved_environ = os.environ.items()
lib.remove()
except EnvironmentError:
pass # XXX we just use the existing version, bah
if not lib.check():
c = py.io.StdCaptureFD()
try:
try:
lastdir = dirpath.chdir()
saved_environ = os.environ.items()
try:
setup(
name = "pylibmodules",
ext_modules=[
Extension(modname, [str(cfile)])
],
script_name = 'setup.py',
script_args = ['-q', 'build_ext', '--inplace']
#script_args = ['build_ext', '--inplace']
)
lastdir = dirpath.chdir()
try:
setup(
name = "pylibmodules",
ext_modules=[
Extension(modname, [str(cfile)])
],
script_name = 'setup.py',
script_args = ['-q', 'build_ext', '--inplace']
#script_args = ['build_ext', '--inplace']
)
finally:
lastdir.chdir()
finally:
lastdir.chdir()
for key, value in saved_environ:
if os.environ.get(key) != value:
os.environ[key] = value
finally:
for key, value in saved_environ:
if os.environ.get(key) != value:
os.environ[key] = value
finally:
foutput, foutput = c.done()
except KeyboardInterrupt:
raise
except SystemExit, e:
raise RuntimeError("cannot compile %s: %s\n%s" % (cfile, e,
foutput, foutput = c.done()
except KeyboardInterrupt:
raise
except SystemExit, e:
raise RuntimeError("cannot compile %s: %s\n%s" % (cfile, e,
foutput.read()))
# XXX do we need to do some check on fout/ferr?
# XXX not a nice way to import a module