~ubuntu-branches/ubuntu/precise/pyzmq/precise

« back to all changes in this revision

Viewing changes to buildutils.py

  • Committer: Package Import Robot
  • Author(s): Debian Python Modules Team
  • Date: 2011-09-23 00:16:39 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: package-import@ubuntu.com-20110923001639-girjqodpb7uv17yu
Tags: 2.1.9-1
* New upstream version
  - should build on kFreeBSD without patches (Closes: #637777).
* Build-depend on zeromq 2.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import os
27
27
import logging
28
28
import pickle
 
29
import platform
29
30
from distutils import ccompiler
 
31
from distutils.sysconfig import customize_compiler
30
32
from subprocess import Popen, PIPE
31
33
 
32
34
try:
83
85
    """
84
86
 
85
87
    cc = ccompiler.new_compiler()
 
88
    customize_compiler(cc)
86
89
    for name, val in compiler_attrs.items():
87
90
        setattr(cc, name, val)
88
91
 
96
99
#include <stdio.h>
97
100
#include "zmq.h"
98
101
 
99
 
int main(){
100
 
    unsigned int major, minor, patch;
 
102
int main(void){
 
103
    int major, minor, patch;
101
104
    zmq_version(&major, &minor, &patch);
102
105
    fprintf(stdout, "vers: %d.%d.%d\n", major, minor, patch);
103
106
    return 0;
105
108
""")
106
109
    finally:
107
110
        f.close()
108
 
 
 
111
    
 
112
    cpreargs = lpreargs = None
109
113
    if sys.platform == 'darwin':
110
 
        # allow for missing UB arch, since it will still work:
111
 
        preargs = ['-undefined', 'dynamic_lookup']
112
 
    else:
113
 
        preargs = None
 
114
        # use appropriate arch for comiler
 
115
        if platform.architecture()[0]=='32bit':
 
116
            cpreargs = ['-arch','i386']
 
117
            lpreargs = ['-arch', 'i386', '-undefined', 'dynamic_lookup']
 
118
        else:
 
119
            # allow for missing UB arch, since it will still work:
 
120
            lpreargs = ['-undefined', 'dynamic_lookup']
114
121
 
115
 
    objs = cc.compile([cfile])
116
 
    cc.link_executable(objs, efile, extra_preargs=preargs)
 
122
    objs = cc.compile([cfile],extra_preargs=cpreargs)
 
123
    cc.link_executable(objs, efile, extra_preargs=lpreargs)
117
124
 
118
125
    result = Popen(efile, stdout=PIPE, stderr=PIPE)
119
126
    so, se = result.communicate()