[Checkins]
SVN: zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/
Updated the test to actually make sure that the generated extension
Jim Fulton
jim at zope.com
Sun Dec 3 17:56:03 EST 2006
Log message for revision 71388:
Updated the test to actually make sure that the generated extension
actually works.
Changed:
U zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
U zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/tests.py
-=-
Modified: zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
===================================================================
--- zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/custom.txt 2006-12-03 19:56:19 UTC (rev 71387)
+++ zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/custom.txt 2006-12-03 22:56:02 UTC (rev 71388)
@@ -57,9 +57,12 @@
PyMODINIT_FUNC
initextdemo(void)
{
- PyObject *d;
- d = Py_InitModule3("extdemo", methods, "");
- PyDict_SetItemString(d, "val", PyInt_FromLong(EXTDEMO));
+ PyObject *m;
+ m = Py_InitModule3("extdemo", methods, "");
+ PyModule_AddObject(m, "val", PyInt_FromLong(EXTDEMO));
+ #ifdef VAL2
+ PyModule_AddObject(m, "val2", PyInt_FromLong(2));
+ #endif
}
The extension depends on a system-dependnt include file, extdemo.h,
@@ -71,10 +74,11 @@
We have a sample buildout that we'll add an include directory to with
the necessary include file:
- >>> mkdir(sample_buildout, 'include')
- >>> import os
- >>> open(os.path.join(sample_buildout, 'include', 'extdemo.h'), 'w').write(
- ... "#define EXTDEMO 42\n")
+ >>> mkdir('include')
+ >>> write('include', 'extdemo.h',
+ ... """
+ ... #define EXTDEMO 42
+ ... """)
We'll also update the buildout configuration file to define a part for
the egg:
@@ -91,8 +95,7 @@
... include-dirs = include
... """ % dict(server=link_server))
- >>> os.chdir(sample_buildout)
- >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
+ >>> buildout = join('bin', 'buildout')
>>> print system(buildout),
buildout: Installing extdemo
@@ -113,3 +116,49 @@
dependencies or scripts for a custom egg, define another part and use
the zc.recipe.egg recipe, listing the custom egg as one of the eggs to
be installed. The zc.recipe.egg recipe will use the installed egg.
+
+Let's define a script that uses out ext demo:
+
+ >>> mkdir('demo')
+ >>> write('demo', 'demo.py',
+ ... """
+ ... import extdemo
+ ... def main():
+ ... print extdemo.val
+ ... """)
+
+ >>> write('demo', 'setup.py',
+ ... """
+ ... from setuptools import setup
+ ... setup(name='demo')
+ ... """)
+
+
+ >>> write('buildout.cfg',
+ ... """
+ ... [buildout]
+ ... develop = demo
+ ... parts = extdemo demo
+ ...
+ ... [extdemo]
+ ... recipe = zc.recipe.egg:custom
+ ... find-links = %(server)s
+ ... index = %(server)s/index
+ ... include-dirs = include
+ ...
+ ... [demo]
+ ... recipe = zc.recipe.egg
+ ... eggs = demo
+ ... extdemo
+ ... entry-points = demo=demo:main
+ ... """ % dict(server=link_server))
+
+ >>> print system(buildout),
+ buildout: Develop: /sample-buildout/demo
+ buildout: Updating extdemo
+ buildout: Installing demo
+
+When we run the script, we'll 42 printed:
+
+ >>> print system(join('bin', 'demo')),
+ 42
Modified: zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/tests.py
===================================================================
--- zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2006-12-03 19:56:19 UTC (rev 71387)
+++ zc.buildout/branches/dev/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2006-12-03 22:56:02 UTC (rev 71388)
@@ -78,6 +78,7 @@
'custom.txt',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
+ zc.buildout.testing.normalize_path,
(re.compile("(d ((ext)?demo(needed)?|other)"
"-\d[.]\d-py)\d[.]\d(-\S+)?[.]egg"),
'\\1V.V.egg'),
More information about the Checkins
mailing list