Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 183236 | Differences between
and this patch

Collapse All | Expand All

(-)numpy-1.0.4/numpy/distutils/cpuinfo.py (-25 / +35 lines)
Lines 18-23 Link Here
18
import os
18
import os
19
import commands
19
import commands
20
import warnings
20
import warnings
21
import platform
21
22
22
def getoutput(cmd, successful_status=(0,), stacklevel=1):
23
def getoutput(cmd, successful_status=(0,), stacklevel=1):
23
    try:
24
    try:
Lines 80-87 Link Here
80
    def _getNCPUs(self):
81
    def _getNCPUs(self):
81
        return 1
82
        return 1
82
83
84
    def __get_nbits(self):
85
        abits = platform.architecture()[0]
86
        nbits = re.compile('(\d+)bit').search(abits).group(1)
87
        return nbits
88
83
    def _is_32bit(self):
89
    def _is_32bit(self):
84
        return not self.is_64bit()
90
        return self.__get_nbits() == '32'
91
92
    def _is_64bit(self):
93
        return self.__get_nbits() == '64'
85
94
86
class LinuxCPUInfo(CPUInfoBase):
95
class LinuxCPUInfo(CPUInfoBase):
87
96
Lines 104-110 Link Here
104
                if len(name_value) != 2:
113
                if len(name_value) != 2:
105
                    continue
114
                    continue
106
                name, value = name_value
115
                name, value = name_value
107
                if not info or info[-1].has_key(name): # next processor
116
                if not info or name in info[-1]: # next processor
108
                    info.append({})
117
                    info.append({})
109
                info[-1][name] = value
118
                info[-1][name] = value
110
            fo.close()
119
            fo.close()
Lines 134-140 Link Here
134
                        self.info[0]['model name']) is not None
143
                        self.info[0]['model name']) is not None
135
144
136
    def _is_AMD64(self):
145
    def _is_AMD64(self):
137
        return self.is_AMD() and self.info[0]['family'] == '15'
146
        if 'family' in self.info[0]:
147
          family=self.info[0]['family'] in ['15','16']
148
        else:
149
          family=False
150
        if 'cpu family' in self.info[0]:
151
          cpu_family=self.info[0]['cpu family']in ['15','16']
152
        else:
153
          cpu_family=False
154
        result=(self.is_AMD() and family) or cpu_family
155
        return result    	
138
156
139
    def _is_Athlon64(self):
157
    def _is_Athlon64(self):
140
        return re.match(r'.*?Athlon\(tm\) 64\b',
158
        return re.match(r'.*?Athlon\(tm\) 64\b',
Lines 152-157 Link Here
152
        return re.match(r'.*?Hammer\b',
170
        return re.match(r'.*?Hammer\b',
153
                        self.info[0]['model name']) is not None
171
                        self.info[0]['model name']) is not None
154
172
173
    def _is_Phenom(self):
174
	return re.match(r'.*?Phenom\b',
175
			self.info[0]['model name']) is not None
176
155
    # Alpha
177
    # Alpha
156
178
157
    def _is_Alpha(self):
179
    def _is_Alpha(self):
Lines 222-228 Link Here
222
        return self.is_PentiumIV() and self.has_sse3()
244
        return self.is_PentiumIV() and self.has_sse3()
223
245
224
    def _is_Nocona(self):
246
    def _is_Nocona(self):
225
        return self.is_64bit() and self.is_PentiumIV()
247
        return self.is_Intel() \
248
               and (self.info[0]['cpu family'] == '6' \
249
                    or self.info[0]['cpu family'] == '15' ) \
250
               and (self.has_sse3() and not self.has_ssse3())\
251
               and re.match(r'.*?\blm\b',self.info[0]['flags']) is not None
226
252
227
    def _is_Core2(self):
253
    def _is_Core2(self):
228
        return self.is_64bit() and self.is_Intel() and \
254
        return self.is_64bit() and self.is_Intel() and \
Lines 263-269 Link Here
263
        return re.match(r'.*?\bsse2\b',self.info[0]['flags']) is not None
289
        return re.match(r'.*?\bsse2\b',self.info[0]['flags']) is not None
264
290
265
    def _has_sse3(self):
291
    def _has_sse3(self):
266
        return re.match(r'.*?\bsse3\b',self.info[0]['flags']) is not None
292
        return re.match(r'.*?\bpni\b',self.info[0]['flags']) is not None
293
294
    def _has_ssse3(self):
295
        return re.match(r'.*?\bssse3\b',self.info[0]['flags']) is not None
267
296
268
    def _has_3dnow(self):
297
    def _has_3dnow(self):
269
        return re.match(r'.*?\b3dnow\b',self.info[0]['flags']) is not None
298
        return re.match(r'.*?\b3dnow\b',self.info[0]['flags']) is not None
Lines 271-290 Link Here
271
    def _has_3dnowext(self):
300
    def _has_3dnowext(self):
272
        return re.match(r'.*?\b3dnowext\b',self.info[0]['flags']) is not None
301
        return re.match(r'.*?\b3dnowext\b',self.info[0]['flags']) is not None
273
302
274
    def _is_64bit(self):
275
        if self.is_Alpha():
276
            return True
277
        if self.info[0].get('clflush size','')=='64':
278
            return True
279
        if self.info[0].get('uname_m','')=='x86_64':
280
            return True
281
        if self.info[0].get('arch','')=='IA-64':
282
            return True
283
        return False
284
285
    def _is_32bit(self):
286
        return not self.is_64bit()
287
288
class IRIXCPUInfo(CPUInfoBase):
303
class IRIXCPUInfo(CPUInfoBase):
289
    info = None
304
    info = None
290
305
Lines 412-422 Link Here
412
427
413
    def _not_impl(self): pass
428
    def _not_impl(self): pass
414
429
415
    def _is_32bit(self):
416
        return self.info['isainfo_b']=='32'
417
    def _is_64bit(self):
418
        return self.info['isainfo_b']=='64'
419
420
    def _is_i386(self):
430
    def _is_i386(self):
421
        return self.info['isainfo_n']=='i386'
431
        return self.info['isainfo_n']=='i386'
422
    def _is_sparc(self):
432
    def _is_sparc(self):
Lines 552-558 Link Here
552
    # require looking at the 'brand' from cpuid
562
    # require looking at the 'brand' from cpuid
553
563
554
    def _is_AMD64(self):
564
    def _is_AMD64(self):
555
        return self.is_AMD() and self.info[0]['Family'] == 15
565
        return self.is_AMD() and self.info[0]['Family'] in [15,16]
556
566
557
    # Intel
567
    # Intel
558
568

Return to bug 183236