Mercurial > cpython-lru_cache-weakref
annotate Misc/python-config.sh.in @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | 7b165c7ab7ef |
| children |
| rev | line source |
|---|---|
|
81752
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
1 #!/bin/sh |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
2 |
|
84947
7b165c7ab7ef
- Issue #18257: Fix readlink usage in python-config. Install the python
doko@ubuntu.com
parents:
81752
diff
changeset
|
3 # Keep this script in sync with python-config.in |
|
7b165c7ab7ef
- Issue #18257: Fix readlink usage in python-config. Install the python
doko@ubuntu.com
parents:
81752
diff
changeset
|
4 |
|
81752
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
5 exit_with_usage () |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
6 { |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
7 echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
8 exit $1 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
9 } |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
10 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
11 if [ "$1" = "" ] ; then |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
12 exit_with_usage 1 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
13 fi |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
14 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
15 # Returns the actual prefix where this script was installed to. |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
16 installed_prefix () |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
17 { |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
18 RESULT=$(dirname $(cd $(dirname "$1") && pwd -P)) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
19 if which readlink >/dev/null 2>&1 ; then |
|
84947
7b165c7ab7ef
- Issue #18257: Fix readlink usage in python-config. Install the python
doko@ubuntu.com
parents:
81752
diff
changeset
|
20 if readlink -f "$RESULT" >/dev/null 2>&1; then |
|
7b165c7ab7ef
- Issue #18257: Fix readlink usage in python-config. Install the python
doko@ubuntu.com
parents:
81752
diff
changeset
|
21 RESULT=$(readlink -f "$RESULT") |
|
7b165c7ab7ef
- Issue #18257: Fix readlink usage in python-config. Install the python
doko@ubuntu.com
parents:
81752
diff
changeset
|
22 fi |
|
81752
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
23 fi |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
24 echo $RESULT |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
25 } |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
26 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
27 prefix_build="@prefix@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
28 prefix_real=$(installed_prefix "$0") |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
29 |
|
84947
7b165c7ab7ef
- Issue #18257: Fix readlink usage in python-config. Install the python
doko@ubuntu.com
parents:
81752
diff
changeset
|
30 # Use sed to fix paths from their built-to locations to their installed-to |
|
7b165c7ab7ef
- Issue #18257: Fix readlink usage in python-config. Install the python
doko@ubuntu.com
parents:
81752
diff
changeset
|
31 # locations. |
|
81752
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
32 prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#") |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
33 exec_prefix_build="@exec_prefix@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
34 exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#") |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
35 includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#") |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
36 libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#") |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
37 CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#") |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
38 VERSION="@VERSION@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
39 LIBM="@LIBM@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
40 LIBC="@LIBC@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
41 SYSLIBS="$LIBM $LIBC" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
42 ABIFLAGS="@ABIFLAGS@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
43 LIBS="@LIBS@ $SYSLIBS -lpython${VERSION}${ABIFLAGS}" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
44 BASECFLAGS="@BASECFLAGS@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
45 LDLIBRARY="@LDLIBRARY@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
46 LINKFORSHARED="@LINKFORSHARED@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
47 OPT="@OPT@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
48 PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
49 LDVERSION="@LDVERSION@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
50 LIBDEST=${prefix}/lib/python${VERSION} |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
51 LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#") |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
52 SO="@SO@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
53 PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
54 INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
55 PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
56 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
57 # Scan for --help or unknown argument. |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
58 for ARG in $* |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
59 do |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
60 case $ARG in |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
61 --help) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
62 exit_with_usage 0 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
63 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
64 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
65 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
66 *) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
67 exit_with_usage 1 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
68 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
69 esac |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
70 done |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
71 |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
72 for ARG in "$@" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
73 do |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
74 case "$ARG" in |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
75 --prefix) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
76 echo "$prefix" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
77 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
78 --exec-prefix) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
79 echo "$exec_prefix" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
80 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
81 --includes) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
82 echo "$INCDIR $PLATINCDIR" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
83 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
84 --cflags) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
85 echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
86 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
87 --libs) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
88 echo "$LIBS" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
89 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
90 --ldflags) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
91 LINKFORSHAREDUSED= |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
92 if [ -z "$PYTHONFRAMEWORK" ] ; then |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
93 LINKFORSHAREDUSED=$LINKFORSHARED |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
94 fi |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
95 LIBPLUSED= |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
96 if [ "$PY_ENABLE_SHARED" = "0" ] ; then |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
97 LIBPLUSED="-L$LIBPL" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
98 fi |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
99 echo "$LIBPLUSED -L$libdir $LIBS $LINKFORSHAREDUSED" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
100 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
101 --extension-suffix) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
102 echo "$SO" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
103 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
104 --abiflags) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
105 echo "$ABIFLAGS" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
106 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
107 --configdir) |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
108 echo "$LIBPL" |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
109 ;; |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
110 esac |
|
c0370730b364
- Issue #16235: Implement python-config as a shell script.
doko@python.org
parents:
diff
changeset
|
111 done |
