OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This figures out the architecture of the version of Python we are building | 6 # This figures out the architecture of the version of Python we are building |
7 # pyautolib against. | 7 # pyautolib against. |
8 # | 8 # |
9 # python_arch.sh /usr/lib/libpython2.5.so.1.0 | 9 # python_arch.sh /usr/lib/libpython2.5.so.1.0 |
10 # python_arch.sh /path/to/sysroot/usr/lib/libpython2.4.so.1.0 | 10 # python_arch.sh /path/to/sysroot/usr/lib/libpython2.4.so.1.0 |
11 # | 11 # |
12 | 12 |
13 set -e | |
14 | |
15 python=$(readlink -f "$1") | 13 python=$(readlink -f "$1") |
| 14 if [ -z "$python" ]; then |
| 15 echo unknown |
| 16 exit 0; |
| 17 fi |
16 file_out=$(file "$python") | 18 file_out=$(file "$python") |
17 | 19 if [ -z "$file_out" ]; then |
18 set +e | 20 echo unknown |
| 21 exit 0; |
| 22 fi |
19 | 23 |
20 echo $file_out | grep -qs "ARM" | 24 echo $file_out | grep -qs "ARM" |
21 if [ $? -eq 0 ]; then | 25 if [ $? -eq 0 ]; then |
22 echo arm | 26 echo arm |
23 exit 0 | 27 exit 0 |
24 fi | 28 fi |
25 | 29 |
26 echo $file_out | grep -qs "x86-64" | 30 echo $file_out | grep -qs "x86-64" |
27 if [ $? -eq 0 ]; then | 31 if [ $? -eq 0 ]; then |
28 echo x64 | 32 echo x64 |
29 exit 0 | 33 exit 0 |
30 fi | 34 fi |
31 | 35 |
32 echo $file_out | grep -qs "Intel 80386" | 36 echo $file_out | grep -qs "Intel 80386" |
33 if [ $? -eq 0 ]; then | 37 if [ $? -eq 0 ]; then |
34 echo ia32 | 38 echo ia32 |
35 exit 0 | 39 exit 0 |
36 fi | 40 fi |
37 | 41 |
38 exit 1 | 42 exit 1 |
OLD | NEW |