[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:
parent
d02d937b74
commit
86155cceb8
|
@ -135,6 +135,12 @@ def set_registry_value(reg, key, value_name, value):
|
||||||
def setup(pkg, **kw):
|
def setup(pkg, **kw):
|
||||||
""" invoke distutils on a given package.
|
""" 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)
|
params = Params(pkg)
|
||||||
#dump(params)
|
#dump(params)
|
||||||
source = getattr(pkg, '__package__', pkg)
|
source = getattr(pkg, '__package__', pkg)
|
||||||
|
|
|
@ -31,38 +31,42 @@ def make_module_from_c(cfile):
|
||||||
raise ImportError, "cannot find the file name suffix of C ext modules"
|
raise ImportError, "cannot find the file name suffix of C ext modules"
|
||||||
lib = dirpath.join(modname+ext)
|
lib = dirpath.join(modname+ext)
|
||||||
|
|
||||||
# argl! we need better "build"-locations alltogether!
|
# XXX argl! we need better "build"-locations alltogether!
|
||||||
if lib.check():
|
if lib.check():
|
||||||
lib.remove()
|
|
||||||
|
|
||||||
c = py.io.StdCaptureFD()
|
|
||||||
try:
|
|
||||||
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:
|
try:
|
||||||
lastdir = dirpath.chdir()
|
saved_environ = os.environ.items()
|
||||||
try:
|
try:
|
||||||
setup(
|
lastdir = dirpath.chdir()
|
||||||
name = "pylibmodules",
|
try:
|
||||||
ext_modules=[
|
setup(
|
||||||
Extension(modname, [str(cfile)])
|
name = "pylibmodules",
|
||||||
],
|
ext_modules=[
|
||||||
script_name = 'setup.py',
|
Extension(modname, [str(cfile)])
|
||||||
script_args = ['-q', 'build_ext', '--inplace']
|
],
|
||||||
#script_args = ['build_ext', '--inplace']
|
script_name = 'setup.py',
|
||||||
)
|
script_args = ['-q', 'build_ext', '--inplace']
|
||||||
|
#script_args = ['build_ext', '--inplace']
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
lastdir.chdir()
|
||||||
finally:
|
finally:
|
||||||
lastdir.chdir()
|
for key, value in saved_environ:
|
||||||
|
if os.environ.get(key) != value:
|
||||||
|
os.environ[key] = value
|
||||||
finally:
|
finally:
|
||||||
for key, value in saved_environ:
|
foutput, foutput = c.done()
|
||||||
if os.environ.get(key) != value:
|
except KeyboardInterrupt:
|
||||||
os.environ[key] = value
|
raise
|
||||||
finally:
|
except SystemExit, e:
|
||||||
foutput, foutput = c.done()
|
raise RuntimeError("cannot compile %s: %s\n%s" % (cfile, e,
|
||||||
except KeyboardInterrupt:
|
|
||||||
raise
|
|
||||||
except SystemExit, e:
|
|
||||||
raise RuntimeError("cannot compile %s: %s\n%s" % (cfile, e,
|
|
||||||
foutput.read()))
|
foutput.read()))
|
||||||
# XXX do we need to do some check on fout/ferr?
|
# XXX do we need to do some check on fout/ferr?
|
||||||
# XXX not a nice way to import a module
|
# XXX not a nice way to import a module
|
||||||
|
|
Loading…
Reference in New Issue