@@ -30,23 +30,28 @@ test = env.Alias('test', develop,
30
30
'$python -m pyobjcryst.tests.run' )
31
31
AlwaysBuild (test )
32
32
33
- # normal install - trick distutils into using this module.
34
- distmodfile = pyoutput ('\n ' .join ([
35
- "from setuptools import Distribution, Extension" ,
36
- "ext = Extension('pyobjcryst._pyobjcryst', [])" ,
37
- "attrs = dict(ext_modules=[ext])" ,
38
- "dist = Distribution(attrs)" ,
39
- "bcmd = dist.get_command_obj('build_ext')" ,
40
- "bcmd.finalize_options()" ,
41
- "print(bcmd.get_ext_fullpath(ext.name))" ,
42
- ]))
33
+ def resolve_distutils_target (target , source , env ):
34
+ tgt = pyoutput ('\n ' .join ([
35
+ "from setuptools import Distribution, Extension" ,
36
+ "ext = Extension('pyobjcryst._pyobjcryst', [])" ,
37
+ "attrs = dict(ext_modules=[ext])" ,
38
+ "dist = Distribution(attrs)" ,
39
+ "bcmd = dist.get_command_obj('build_ext')" ,
40
+ "bcmd.finalize_options()" ,
41
+ "print(bcmd.get_ext_fullpath(ext.name))" ,
42
+ ]))
43
+ env ['distsofile' ] = env .File (tgt )
44
+ return 0
45
+
43
46
cmd_install = '$python setup.py install'
44
47
if 'prefix' in env :
45
- cmd_install += ' --prefix=' + env ['prefix' ]
48
+ cmd_install += ' --prefix=$prefix'
49
+
46
50
install = env .Alias ('install' , module , [
47
- Mkdir (os .path .dirname (distmodfile )),
48
- Copy (distmodfile , '$SOURCE' ),
49
- Touch (distmodfile ),
51
+ resolve_distutils_target ,
52
+ Mkdir ('$distsofile.dir' ),
53
+ Copy ('$distsofile' , '$SOURCE' ),
54
+ Touch ('$distsofile' ),
50
55
cmd_install ,
51
56
])
52
57
AlwaysBuild (install )
0 commit comments