Return a list of library paths valid on 32 or 64 bit systems. Inputs: paths : sequence A sequence of strings (typically paths) bits : int An integer, the only valid values are 32 or 64. A ValueError exception is raised otherwise. Examples: Consider a
(paths, bits)
| 233 | |
| 234 | |
| 235 | def libpaths(paths, bits): |
| 236 | """Return a list of library paths valid on 32 or 64 bit systems. |
| 237 | |
| 238 | Inputs: |
| 239 | paths : sequence |
| 240 | A sequence of strings (typically paths) |
| 241 | bits : int |
| 242 | An integer, the only valid values are 32 or 64. A ValueError exception |
| 243 | is raised otherwise. |
| 244 | |
| 245 | Examples: |
| 246 | |
| 247 | Consider a list of directories |
| 248 | >>> paths = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib'] |
| 249 | |
| 250 | For a 32-bit platform, this is already valid: |
| 251 | >>> np.distutils.system_info.libpaths(paths,32) |
| 252 | ['/usr/X11R6/lib', '/usr/X11/lib', '/usr/lib'] |
| 253 | |
| 254 | On 64 bits, we prepend the '64' postfix |
| 255 | >>> np.distutils.system_info.libpaths(paths,64) |
| 256 | ['/usr/X11R6/lib64', '/usr/X11R6/lib', '/usr/X11/lib64', '/usr/X11/lib', |
| 257 | '/usr/lib64', '/usr/lib'] |
| 258 | """ |
| 259 | if bits not in (32, 64): |
| 260 | raise ValueError("Invalid bit size in libpaths: 32 or 64 only") |
| 261 | |
| 262 | # Handle 32bit case |
| 263 | if bits == 32: |
| 264 | return paths |
| 265 | |
| 266 | # Handle 64bit case |
| 267 | out = [] |
| 268 | for p in paths: |
| 269 | out.extend([p + '64', p]) |
| 270 | |
| 271 | return out |
| 272 | |
| 273 | |
| 274 | if sys.platform == 'win32': |