ZTWHHH commited on
Commit
269a416
·
verified ·
1 Parent(s): af919af

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. evalkit_cambrian/lib/python3.10/config-3.10-x86_64-linux-gnu/Makefile +2108 -0
  3. evalkit_cambrian/lib/python3.10/config-3.10-x86_64-linux-gnu/config.c.in +67 -0
  4. evalkit_cambrian/lib/python3.10/config-3.10-x86_64-linux-gnu/python.o +0 -0
  5. evalkit_cambrian/lib/python3.10/ctypes/__init__.py +563 -0
  6. evalkit_cambrian/lib/python3.10/ctypes/util.py +397 -0
  7. evalkit_cambrian/lib/python3.10/ctypes/wintypes.py +202 -0
  8. evalkit_cambrian/lib/python3.10/curses/__init__.py +101 -0
  9. evalkit_cambrian/lib/python3.10/curses/__pycache__/panel.cpython-310.pyc +0 -0
  10. evalkit_cambrian/lib/python3.10/curses/has_key.py +192 -0
  11. evalkit_cambrian/lib/python3.10/curses/textpad.py +201 -0
  12. evalkit_cambrian/lib/python3.10/dbm/__init__.py +189 -0
  13. evalkit_cambrian/lib/python3.10/venv/scripts/common/Activate.ps1 +247 -0
  14. evalkit_cambrian/lib/python3.10/wsgiref/__pycache__/__init__.cpython-310.pyc +0 -0
  15. evalkit_tf449/lib/python3.10/site-packages/numba/__pycache__/__main__.cpython-310.pyc +0 -0
  16. evalkit_tf449/lib/python3.10/site-packages/numba/__pycache__/_version.cpython-310.pyc +0 -0
  17. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/__init__.cpython-310.pyc +0 -0
  18. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/compiler.cpython-310.pyc +0 -0
  19. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/cudamath.cpython-310.pyc +0 -0
  20. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/device_init.cpython-310.pyc +0 -0
  21. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/dispatcher.cpython-310.pyc +0 -0
  22. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/intrinsic_wrapper.cpython-310.pyc +0 -0
  23. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/printimpl.cpython-310.pyc +0 -0
  24. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/types.cpython-310.pyc +0 -0
  25. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/vectorizers.cpython-310.pyc +0 -0
  26. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/__init__.py +0 -0
  27. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/__pycache__/reduction.cpython-310.pyc +0 -0
  28. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/reduction.py +262 -0
  29. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/transpose.py +65 -0
  30. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/__init__.cpython-310.pyc +0 -0
  31. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/cache_usecases.cpython-310.pyc +0 -0
  32. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/cache_with_cpu_usecases.cpython-310.pyc +0 -0
  33. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/extensions_usecases.cpython-310.pyc +0 -0
  34. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_array_methods.cpython-310.pyc +0 -0
  35. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_blackscholes.cpython-310.pyc +0 -0
  36. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_caching.cpython-310.pyc +0 -0
  37. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_complex_kernel.cpython-310.pyc +0 -0
  38. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_cuda_jit_no_types.cpython-310.pyc +0 -0
  39. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_datetime.cpython-310.pyc +0 -0
  40. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_debug.cpython-310.pyc +0 -0
  41. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_freevar.cpython-310.pyc +0 -0
  42. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_frexp_ldexp.cpython-310.pyc +0 -0
  43. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_globals.cpython-310.pyc +0 -0
  44. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_gufunc_scalar.cpython-310.pyc +0 -0
  45. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_gufunc_scheduling.cpython-310.pyc +0 -0
  46. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_inspect.cpython-310.pyc +0 -0
  47. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_intrinsics.cpython-310.pyc +0 -0
  48. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_ipc.cpython-310.pyc +0 -0
  49. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_iterators.cpython-310.pyc +0 -0
  50. evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_laplace.cpython-310.pyc +0 -0
.gitattributes CHANGED
@@ -1172,3 +1172,5 @@ evalkit_tf449/lib/python3.10/site-packages/sklearn/utils/_readonly_array_wrapper
1172
  evalkit_tf449/lib/python3.10/site-packages/numba/core/runtime/_nrt_python.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1173
  evalkit_tf449/lib/python3.10/site-packages/numba/parfors/__pycache__/parfor.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1174
  evalkit_tf449/lib/python3.10/site-packages/numba/_dispatcher.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
 
1172
  evalkit_tf449/lib/python3.10/site-packages/numba/core/runtime/_nrt_python.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1173
  evalkit_tf449/lib/python3.10/site-packages/numba/parfors/__pycache__/parfor.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
1174
  evalkit_tf449/lib/python3.10/site-packages/numba/_dispatcher.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
1175
+ janusflow/lib/libpython3.10.so.1.0 filter=lfs diff=lfs merge=lfs -text
1176
+ evalkit_tf449/lib/python3.10/site-packages/numba/np/__pycache__/new_arraymath.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
evalkit_cambrian/lib/python3.10/config-3.10-x86_64-linux-gnu/Makefile ADDED
@@ -0,0 +1,2108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated automatically from Makefile.pre by makesetup.
2
+ # Top-level Makefile for Python
3
+ #
4
+ # As distributed, this file is called Makefile.pre.in; it is processed
5
+ # into the real Makefile by running the script ./configure, which
6
+ # replaces things like @spam@ with values appropriate for your system.
7
+ # This means that if you edit Makefile, your changes get lost the next
8
+ # time you run the configure script. Ideally, you can do:
9
+ #
10
+ # ./configure
11
+ # make
12
+ # make test
13
+ # make install
14
+ #
15
+ # If you have a previous version of Python installed that you don't
16
+ # want to overwrite, you can use "make altinstall" instead of "make
17
+ # install". Refer to the "Installing" section in the README file for
18
+ # additional details.
19
+ #
20
+ # See also the section "Build instructions" in the README file.
21
+
22
+ # === Variables set by makesetup ===
23
+
24
+ MODBUILT_NAMES= posix errno pwd _sre _codecs _weakref _functools _operator _collections _abc itertools atexit _signal _stat time _thread _locale _io faulthandler _tracemalloc _symtable xxsubtype
25
+ MODDISABLED_NAMES=
26
+ MODOBJS= Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/_abc.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_threadmodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/symtablemodule.o Modules/xxsubtype.o
27
+ MODLIBS= $(LOCALMODLIBS) $(BASEMODLIBS)
28
+
29
+ # === Variables set by configure
30
+ VERSION= 3.10
31
+ srcdir= /croot/python-split_1733933809325/work
32
+ VPATH= /croot/python-split_1733933809325/work
33
+ abs_srcdir= /croot/python-split_1733933809325/work
34
+ abs_builddir= /croot/python-split_1733933809325/work/build-static
35
+
36
+
37
+ CC= x86_64-conda-linux-gnu-gcc -pthread
38
+ CXX= x86_64-conda-linux-gnu-c++ -pthread
39
+ MAINCC= $(CC)
40
+ LINKCC= $(PURIFY) $(MAINCC)
41
+ AR= x86_64-conda-linux-gnu-ar
42
+ READELF= x86_64-conda-linux-gnu-readelf
43
+ SOABI= cpython-310-x86_64-linux-gnu
44
+ LDVERSION= $(VERSION)$(ABIFLAGS)
45
+ LIBPYTHON=
46
+ GITVERSION=
47
+ GITTAG=
48
+ GITBRANCH=
49
+ PGO_PROF_GEN_FLAG=-fprofile-generate
50
+ PGO_PROF_USE_FLAG=
51
+ LLVM_PROF_MERGER=true
52
+ LLVM_PROF_FILE=
53
+ LLVM_PROF_ERR=no
54
+ DTRACE=
55
+ DFLAGS=
56
+ DTRACE_HEADERS=
57
+ DTRACE_OBJS=
58
+
59
+ GNULD= yes
60
+
61
+ # Shell used by make (some versions default to the login shell, which is bad)
62
+ SHELL= /bin/sh
63
+
64
+ # Use this to make a link between python$(VERSION) and python in $(BINDIR)
65
+ LN= ln
66
+
67
+ # Portable install script (configure doesn't always guess right)
68
+ INSTALL= /usr/bin/install -c
69
+ INSTALL_PROGRAM=${INSTALL}
70
+ INSTALL_SCRIPT= ${INSTALL}
71
+ INSTALL_DATA= ${INSTALL} -m 644
72
+ # Shared libraries must be installed with executable mode on some systems;
73
+ # rather than figuring out exactly which, we always give them executable mode.
74
+ INSTALL_SHARED= ${INSTALL} -m 755
75
+
76
+ MKDIR_P= /usr/bin/mkdir -p
77
+
78
+ MAKESETUP= $(srcdir)/Modules/makesetup
79
+
80
+ # Compiler options
81
+ OPT= -DNDEBUG -fwrapv -O2 -Wall
82
+ BASECFLAGS= -Wno-unused-result -Wsign-compare
83
+ BASECPPFLAGS= -IObjects -IInclude -IPython
84
+ CONFIGURE_CFLAGS= -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /root/envs/evalkit_cambrian/include -fdebug-prefix-map=/croot/python-split_1733933809325/work=/usr/local/src/conda/python-3.10.16 -fdebug-prefix-map=/root/envs/evalkit_cambrian=/usr/local/src/conda-prefix
85
+ # CFLAGS_NODIST is used for building the interpreter and stdlib C extensions.
86
+ # Use it when a compiler flag should _not_ be part of the distutils CFLAGS
87
+ # once Python is installed (Issue #21121).
88
+ CONFIGURE_CFLAGS_NODIST= -fno-semantic-interposition -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden
89
+ # LDFLAGS_NODIST is used in the same manner as CFLAGS_NODIST.
90
+ # Use it when a linker flag should _not_ be part of the distutils LDFLAGS
91
+ # once Python is installed (bpo-35257)
92
+ CONFIGURE_LDFLAGS_NODIST= -fno-semantic-interposition -g
93
+ CONFIGURE_CPPFLAGS= -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /root/envs/evalkit_cambrian/include -I/root/envs/evalkit_cambrian/include
94
+ CONFIGURE_LDFLAGS= -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/root/envs/evalkit_cambrian/lib -Wl,-rpath-link,/root/envs/evalkit_cambrian/lib -L/root/envs/evalkit_cambrian/lib
95
+ # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
96
+ # command line to append to these values without stomping the pre-set
97
+ # values.
98
+ PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
99
+ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/internal
100
+ # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
101
+ # be able to build extension modules using the directories specified in the
102
+ # environment variables
103
+ PY_CPPFLAGS= $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
104
+ PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
105
+ PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
106
+ NO_AS_NEEDED= -Wl,--no-as-needed
107
+ CCSHARED= -fPIC
108
+ # LINKFORSHARED are the flags passed to the $(CC) command that links
109
+ # the python executable -- this is only needed for a few systems
110
+ LINKFORSHARED= -Xlinker -export-dynamic
111
+ ARFLAGS= rcs
112
+ # Extra C flags added for building the interpreter object files.
113
+ CFLAGSFORSHARED=
114
+ # C flags used for building the interpreter object files
115
+ PY_STDMODULE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED)
116
+ PY_BUILTIN_MODULE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN
117
+ PY_CORE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE
118
+ # Linker flags used for building the interpreter object files
119
+ PY_CORE_LDFLAGS=$(PY_LDFLAGS) $(PY_LDFLAGS_NODIST)
120
+ # Strict or non-strict aliasing flags used to compile dtoa.c, see above
121
+ CFLAGS_ALIASING=
122
+
123
+
124
+ # Machine-dependent subdirectories
125
+ MACHDEP= linux
126
+
127
+ # Multiarch directory (may be empty)
128
+ MULTIARCH= x86_64-linux-gnu
129
+ MULTIARCH_CPPFLAGS = -DMULTIARCH=\"x86_64-linux-gnu\"
130
+
131
+ # Install prefix for architecture-independent files
132
+ prefix= /root/envs/evalkit_cambrian
133
+
134
+ # Install prefix for architecture-dependent files
135
+ exec_prefix= ${prefix}
136
+
137
+ # Install prefix for data files
138
+ datarootdir= ${prefix}/share
139
+
140
+ # Expanded directories
141
+ BINDIR= ${exec_prefix}/bin
142
+ LIBDIR= ${exec_prefix}/lib
143
+ MANDIR= ${datarootdir}/man
144
+ INCLUDEDIR= ${prefix}/include
145
+ CONFINCLUDEDIR= $(exec_prefix)/include
146
+ PLATLIBDIR= lib
147
+ SCRIPTDIR= $(prefix)/$(PLATLIBDIR)
148
+ ABIFLAGS=
149
+ # Variable used by ensurepip
150
+ WHEEL_PKG_DIR=
151
+
152
+ # Detailed destination directories
153
+ BINLIBDEST= ${exec_prefix}/${PLATLIBDIR}/python$(VERSION)
154
+ LIBDEST= $(SCRIPTDIR)/python$(VERSION)
155
+ INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
156
+ CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
157
+
158
+ # Symbols used for using shared libraries
159
+ SHLIB_SUFFIX= .so
160
+ EXT_SUFFIX= .cpython-310-x86_64-linux-gnu.so
161
+ LDSHARED= $(CC) -shared $(PY_LDFLAGS)
162
+ BLDSHARED= $(CC) -shared $(PY_CORE_LDFLAGS)
163
+ LDCXXSHARED= $(CXX) -shared
164
+ DESTSHARED= $(BINLIBDEST)/lib-dynload
165
+
166
+ # List of exported symbols for AIX
167
+ EXPORTSYMS=
168
+ EXPORTSFROM=
169
+
170
+ # Executable suffix (.exe on Windows and Mac OS X)
171
+ EXE=
172
+ BUILDEXE=
173
+
174
+ # Short name and location for Mac OS X Python framework
175
+ UNIVERSALSDK=
176
+ PYTHONFRAMEWORK=
177
+ PYTHONFRAMEWORKDIR= no-framework
178
+ PYTHONFRAMEWORKPREFIX=
179
+ PYTHONFRAMEWORKINSTALLDIR=
180
+ # Deployment target selected during configure, to be checked
181
+ # by distutils. The export statement is needed to ensure that the
182
+ # deployment target is active during build.
183
+ MACOSX_DEPLOYMENT_TARGET=
184
+ #export MACOSX_DEPLOYMENT_TARGET
185
+
186
+ # Option to install to strip binaries
187
+ STRIPFLAG=-s
188
+
189
+ # Flags to lipo to produce a 32-bit-only universal executable
190
+ LIPO_32BIT_FLAGS=
191
+
192
+ # Flags to lipo to produce an intel-64-only universal executable
193
+ LIPO_INTEL64_FLAGS=
194
+
195
+ # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
196
+ OTHER_LIBTOOL_OPT=
197
+
198
+ # Environment to run shared python without installed libraries
199
+ RUNSHARED=
200
+
201
+ # ensurepip options
202
+ ENSUREPIP= no
203
+
204
+ # OpenSSL options for setup.py so sysconfig can pick up AC_SUBST() vars.
205
+ OPENSSL_INCLUDES=-I/root/envs/evalkit_cambrian/include
206
+ OPENSSL_LIBS=-lssl -lcrypto
207
+ OPENSSL_LDFLAGS=-L/root/envs/evalkit_cambrian/lib
208
+ OPENSSL_RPATH=
209
+
210
+ # Default zoneinfo.TZPATH. Added here to expose it in sysconfig.get_config_var
211
+ TZPATH=/root/envs/evalkit_cambrian/share/zoneinfo
212
+
213
+ # Modes for directories, executables and data files created by the
214
+ # install process. Default to user-only-writable for all file types.
215
+ DIRMODE= 755
216
+ EXEMODE= 755
217
+ FILEMODE= 644
218
+
219
+ # configure script arguments
220
+ CONFIG_ARGS= '--prefix=/root/envs/evalkit_cambrian' '--build=x86_64-conda-linux-gnu' '--host=x86_64-conda-linux-gnu' '--enable-ipv6' '--with-ensurepip=no' '--with-tzpath=/root/envs/evalkit_cambrian/share/zoneinfo' '--with-computed-gotos' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-tcltk-includes=-I/root/envs/evalkit_cambrian/include' '--with-tcltk-libs=-L/root/envs/evalkit_cambrian/lib -ltcl8.6 -ltk8.6' '--with-platlibdir=lib' '--with-lto' '--enable-optimizations' '-oldincludedir=/croot/python-split_1733933809325/_build_env/x86_64-conda-linux-gnu/sysroot/usr/include' '--disable-shared' 'PROFILE_TASK=-m test --pgo' 'build_alias=x86_64-conda-linux-gnu' 'host_alias=x86_64-conda-linux-gnu' 'MACHDEP=linux' 'CC=x86_64-conda-linux-gnu-gcc' 'CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /root/envs/evalkit_cambrian/include -fdebug-prefix-map=/croot/python-split_1733933809325/work=/usr/local/src/conda/python-3.10.16 -fdebug-prefix-map=/root/envs/evalkit_cambrian=/usr/local/src/conda-prefix ' 'LDFLAGS=-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/root/envs/evalkit_cambrian/lib -Wl,-rpath-link,/root/envs/evalkit_cambrian/lib -L/root/envs/evalkit_cambrian/lib' 'CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /root/envs/evalkit_cambrian/include -I/root/envs/evalkit_cambrian/include' 'CPP=/croot/python-split_1733933809325/_build_env/bin/x86_64-conda-linux-gnu-cpp' 'PKG_CONFIG_PATH=/root/envs/evalkit_cambrian/lib/pkgconfig'
221
+
222
+
223
+ # Subdirectories with code
224
+ SRCDIRS= Parser Objects Python Modules Modules/_io Programs
225
+
226
+ # Other subdirectories
227
+ SUBDIRSTOO= Include Lib Misc
228
+
229
+ # Files and directories to be distributed
230
+ CONFIGFILES= configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
231
+ DISTFILES= README.rst ChangeLog $(CONFIGFILES)
232
+ DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
233
+ DIST= $(DISTFILES) $(DISTDIRS)
234
+
235
+
236
+ LIBRARY= libpython$(VERSION)$(ABIFLAGS).a
237
+ LDLIBRARY= libpython$(VERSION)$(ABIFLAGS).a
238
+ BLDLIBRARY= $(LDLIBRARY)
239
+ PY3LIBRARY=
240
+ DLLLIBRARY=
241
+ LDLIBRARYDIR=
242
+ INSTSONAME= $(LDLIBRARY)
243
+ LIBRARY_DEPS= $(LIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
244
+ PY_ENABLE_SHARED= 0
245
+ STATIC_LIBPYTHON= 1
246
+
247
+
248
+ LIBS= -lcrypt -lpthread -ldl -lutil -lm
249
+ LIBM= -lm
250
+ LIBC=
251
+ SYSLIBS= $(LIBM) $(LIBC)
252
+ SHLIBS= $(LIBS)
253
+
254
+ DLINCLDIR= .
255
+ DYNLOADFILE= dynload_shlib.o
256
+ MACHDEP_OBJS=
257
+ LIBOBJDIR= Python/
258
+ LIBOBJS=
259
+
260
+ PYTHON= python$(EXE)
261
+ BUILDPYTHON= python$(BUILDEXE)
262
+
263
+ PYTHON_FOR_REGEN?=python3
264
+ UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
265
+ PY_BUILD_ENVIRON=
266
+ PYTHON_FOR_BUILD=./$(BUILDPYTHON) -E
267
+ _PYTHON_HOST_PLATFORM=linux-x86_64
268
+ BUILD_GNU_TYPE= x86_64-conda-linux-gnu
269
+ HOST_GNU_TYPE= x86_64-conda-linux-gnu
270
+
271
+ # Tcl and Tk config info from --with-tcltk-includes and -libs options
272
+ TCLTK_INCLUDES= -I/root/envs/evalkit_cambrian/include
273
+ TCLTK_LIBS= -L/root/envs/evalkit_cambrian/lib -ltcl8.6 -ltk8.6
274
+
275
+ # The task to run while instrumented when building the profile-opt target.
276
+ # To speed up profile generation, we don't run the full unit test suite
277
+ # by default. The default is "-m test --pgo". To run more tests, use
278
+ # PROFILE_TASK="-m test --pgo-extended"
279
+ PROFILE_TASK= -m test --pgo
280
+
281
+ # report files for gcov / lcov coverage report
282
+ COVERAGE_INFO= $(abs_builddir)/coverage.info
283
+ COVERAGE_REPORT=$(abs_builddir)/lcov-report
284
+ COVERAGE_REPORT_OPTIONS=--no-branch-coverage --title "CPython lcov report"
285
+
286
+
287
+ # === Definitions added by makesetup ===
288
+
289
+ LOCALMODLIBS=
290
+ BASEMODLIBS=
291
+ PYTHONPATH=$(COREPYTHONPATH)
292
+ COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)
293
+ TESTPATH=
294
+ SITEPATH=
295
+ DESTPATH=
296
+ MACHDESTLIB=$(BINLIBDEST)
297
+ DESTLIB=$(LIBDEST)
298
+
299
+
300
+
301
+ ##########################################################################
302
+ # Modules
303
+ MODULE_OBJS= \
304
+ Modules/config.o \
305
+ Modules/getpath.o \
306
+ Modules/main.o \
307
+ Modules/gcmodule.o
308
+
309
+ IO_H= Modules/_io/_iomodule.h
310
+
311
+ IO_OBJS= \
312
+ Modules/_io/_iomodule.o \
313
+ Modules/_io/iobase.o \
314
+ Modules/_io/fileio.o \
315
+ Modules/_io/bufferedio.o \
316
+ Modules/_io/textio.o \
317
+ Modules/_io/bytesio.o \
318
+ Modules/_io/stringio.o
319
+
320
+ ##########################################################################
321
+
322
+ LIBFFI_INCLUDEDIR= /root/envs/evalkit_cambrian/include
323
+
324
+ ##########################################################################
325
+ # Parser
326
+
327
+ PEGEN_OBJS= \
328
+ Parser/pegen.o \
329
+ Parser/parser.o \
330
+ Parser/string_parser.o \
331
+ Parser/peg_api.o
332
+
333
+
334
+ PEGEN_HEADERS= \
335
+ $(srcdir)/Include/internal/pycore_parser.h \
336
+ $(srcdir)/Parser/pegen.h \
337
+ $(srcdir)/Parser/string_parser.h
338
+
339
+ POBJS= \
340
+ Parser/token.o \
341
+
342
+ PARSER_OBJS= $(POBJS) $(PEGEN_OBJS) Parser/myreadline.o Parser/tokenizer.o
343
+
344
+ PARSER_HEADERS= \
345
+ $(PEGEN_HEADERS) \
346
+ $(srcdir)/Parser/tokenizer.h
347
+
348
+ ##########################################################################
349
+ # Python
350
+
351
+ PYTHON_OBJS= \
352
+ Python/_warnings.o \
353
+ Python/Python-ast.o \
354
+ Python/asdl.o \
355
+ Python/ast.o \
356
+ Python/ast_opt.o \
357
+ Python/ast_unparse.o \
358
+ Python/bltinmodule.o \
359
+ Python/ceval.o \
360
+ Python/codecs.o \
361
+ Python/compile.o \
362
+ Python/context.o \
363
+ Python/dynamic_annotations.o \
364
+ Python/errors.o \
365
+ Python/frozenmain.o \
366
+ Python/future.o \
367
+ Python/getargs.o \
368
+ Python/getcompiler.o \
369
+ Python/getcopyright.o \
370
+ Python/getplatform.o \
371
+ Python/getversion.o \
372
+ Python/hamt.o \
373
+ Python/hashtable.o \
374
+ Python/import.o \
375
+ Python/importdl.o \
376
+ Python/initconfig.o \
377
+ Python/marshal.o \
378
+ Python/modsupport.o \
379
+ Python/mysnprintf.o \
380
+ Python/mystrtoul.o \
381
+ Python/pathconfig.o \
382
+ Python/preconfig.o \
383
+ Python/pyarena.o \
384
+ Python/pyctype.o \
385
+ Python/pyfpe.o \
386
+ Python/pyhash.o \
387
+ Python/pylifecycle.o \
388
+ Python/pymath.o \
389
+ Python/pystate.o \
390
+ Python/pythonrun.o \
391
+ Python/pytime.o \
392
+ Python/bootstrap_hash.o \
393
+ Python/structmember.o \
394
+ Python/symtable.o \
395
+ Python/sysmodule.o \
396
+ Python/thread.o \
397
+ Python/traceback.o \
398
+ Python/getopt.o \
399
+ Python/pystrcmp.o \
400
+ Python/pystrtod.o \
401
+ Python/pystrhex.o \
402
+ Python/dtoa.o \
403
+ Python/formatter_unicode.o \
404
+ Python/fileutils.o \
405
+ Python/suggestions.o \
406
+ Python/$(DYNLOADFILE) \
407
+ $(LIBOBJS) \
408
+ $(MACHDEP_OBJS) \
409
+ $(DTRACE_OBJS)
410
+
411
+
412
+ ##########################################################################
413
+ # Objects
414
+ OBJECT_OBJS= \
415
+ Objects/abstract.o \
416
+ Objects/accu.o \
417
+ Objects/boolobject.o \
418
+ Objects/bytes_methods.o \
419
+ Objects/bytearrayobject.o \
420
+ Objects/bytesobject.o \
421
+ Objects/call.o \
422
+ Objects/capsule.o \
423
+ Objects/cellobject.o \
424
+ Objects/classobject.o \
425
+ Objects/codeobject.o \
426
+ Objects/complexobject.o \
427
+ Objects/descrobject.o \
428
+ Objects/enumobject.o \
429
+ Objects/exceptions.o \
430
+ Objects/genericaliasobject.o \
431
+ Objects/genobject.o \
432
+ Objects/fileobject.o \
433
+ Objects/floatobject.o \
434
+ Objects/frameobject.o \
435
+ Objects/funcobject.o \
436
+ Objects/interpreteridobject.o \
437
+ Objects/iterobject.o \
438
+ Objects/listobject.o \
439
+ Objects/longobject.o \
440
+ Objects/dictobject.o \
441
+ Objects/odictobject.o \
442
+ Objects/memoryobject.o \
443
+ Objects/methodobject.o \
444
+ Objects/moduleobject.o \
445
+ Objects/namespaceobject.o \
446
+ Objects/object.o \
447
+ Objects/obmalloc.o \
448
+ Objects/picklebufobject.o \
449
+ Objects/rangeobject.o \
450
+ Objects/setobject.o \
451
+ Objects/sliceobject.o \
452
+ Objects/structseq.o \
453
+ Objects/tupleobject.o \
454
+ Objects/typeobject.o \
455
+ Objects/unicodeobject.o \
456
+ Objects/unicodectype.o \
457
+ Objects/unionobject.o \
458
+ Objects/weakrefobject.o
459
+
460
+ ##########################################################################
461
+ # objects that get linked into the Python library
462
+ LIBRARY_OBJS_OMIT_FROZEN= \
463
+ Modules/getbuildinfo.o \
464
+ $(PARSER_OBJS) \
465
+ $(OBJECT_OBJS) \
466
+ $(PYTHON_OBJS) \
467
+ $(MODULE_OBJS) \
468
+ $(MODOBJS)
469
+
470
+ LIBRARY_OBJS= \
471
+ $(LIBRARY_OBJS_OMIT_FROZEN) \
472
+ Python/frozen.o
473
+
474
+ ##########################################################################
475
+ # DTrace
476
+
477
+ # On some systems, object files that reference DTrace probes need to be modified
478
+ # in-place by dtrace(1).
479
+ DTRACE_DEPS = \
480
+ Python/ceval.o Python/import.o Python/sysmodule.o Modules/gcmodule.o
481
+
482
+ #########################################################################
483
+ # Rules
484
+
485
+ # Default target
486
+ all: profile-opt
487
+ build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks \
488
+ Programs/_testembed python-config
489
+
490
+ # Check that the source is clean when building out of source.
491
+ check-clean-src:
492
+ @if test -n "$(VPATH)" -a -f "$(srcdir)/Programs/python.o"; then \
493
+ echo "Error: The source directory ($(srcdir)) is not clean" ; \
494
+ echo "Building Python out of the source tree (in $(abs_builddir)) requires a clean source tree ($(abs_srcdir))" ; \
495
+ echo "Try to run: make -C \"$(srcdir)\" clean" ; \
496
+ exit 1; \
497
+ fi
498
+
499
+ # Profile generation build must start from a clean tree.
500
+ profile-clean-stamp:
501
+ $(MAKE) clean
502
+ touch $@
503
+
504
+ # Compile with profile generation enabled.
505
+ profile-gen-stamp: profile-clean-stamp
506
+ @if [ $(LLVM_PROF_ERR) = yes ]; then \
507
+ echo "Error: Cannot perform PGO build because llvm-profdata was not found in PATH" ;\
508
+ echo "Please add it to PATH and run ./configure again" ;\
509
+ exit 1;\
510
+ fi
511
+ @echo "Building with support for profile generation:"
512
+ $(MAKE) build_all_generate_profile
513
+ touch $@
514
+
515
+ # Run task with profile generation build to create profile information.
516
+ profile-run-stamp:
517
+ @echo "Running code to generate profile data (this can take a while):"
518
+ # First, we need to create a clean build with profile generation
519
+ # enabled.
520
+ $(MAKE) profile-gen-stamp
521
+ # Next, run the profile task to generate the profile information.
522
+ $(MAKE) run_profile_task
523
+ $(MAKE) build_all_merge_profile
524
+ # Remove profile generation binary since we are done with it.
525
+ $(MAKE) clean-retain-profile
526
+ # This is an expensive target to build and it does not have proper
527
+ # makefile dependency information. So, we create a "stamp" file
528
+ # to record its completion and avoid re-running it.
529
+ touch $@
530
+
531
+ build_all_generate_profile:
532
+ $(MAKE) build_all CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LDFLAGS_NODIST="$(LDFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)"
533
+
534
+ run_profile_task:
535
+ @ # FIXME: can't run for a cross build
536
+ $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true
537
+
538
+ build_all_merge_profile:
539
+ $(LLVM_PROF_MERGER)
540
+
541
+ # Compile Python binary with profile guided optimization.
542
+ # To force re-running of the profile task, remove the profile-run-stamp file.
543
+ profile-opt: profile-run-stamp
544
+ @echo "Rebuilding with profile guided optimizations:"
545
+ -rm -f profile-clean-stamp
546
+ $(MAKE) build_all CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_USE_FLAG)" LDFLAGS_NODIST="$(LDFLAGS_NODIST)"
547
+
548
+ # Compile and run with gcov
549
+ .PHONY=coverage coverage-lcov coverage-report
550
+ coverage:
551
+ @echo "Building with support for coverage checking:"
552
+ $(MAKE) clean
553
+ $(MAKE) build_all CFLAGS="$(CFLAGS) -O0 -pg --coverage" LIBS="$(LIBS) --coverage"
554
+
555
+ coverage-lcov:
556
+ @echo "Creating Coverage HTML report with LCOV:"
557
+ @rm -f $(COVERAGE_INFO)
558
+ @rm -rf $(COVERAGE_REPORT)
559
+ @lcov --capture --directory $(abs_builddir) \
560
+ --base-directory $(realpath $(abs_builddir)) \
561
+ --path $(realpath $(abs_srcdir)) \
562
+ --output-file $(COVERAGE_INFO)
563
+ @ # remove 3rd party modules, system headers and internal files with
564
+ @ # debug, test or dummy functions.
565
+ @lcov --remove $(COVERAGE_INFO) \
566
+ '*/Modules/_blake2/impl/*' \
567
+ '*/Modules/_ctypes/libffi*/*' \
568
+ '*/Modules/_decimal/libmpdec/*' \
569
+ '*/Modules/_sha3/kcp/*' \
570
+ '*/Modules/expat/*' \
571
+ '*/Modules/zlib/*' \
572
+ '*/Include/*' \
573
+ '*/Modules/xx*.c' \
574
+ '*/Python/pyfpe.c' \
575
+ '*/Python/pystrcmp.c' \
576
+ '/usr/include/*' \
577
+ '/usr/local/include/*' \
578
+ '/usr/lib/gcc/*' \
579
+ --output-file $(COVERAGE_INFO)
580
+ @genhtml $(COVERAGE_INFO) --output-directory $(COVERAGE_REPORT) \
581
+ $(COVERAGE_REPORT_OPTIONS)
582
+ @echo
583
+ @echo "lcov report at $(COVERAGE_REPORT)/index.html"
584
+ @echo
585
+
586
+ # Force regeneration of parser and importlib
587
+ coverage-report: regen-token regen-importlib
588
+ @ # build with coverage info
589
+ $(MAKE) coverage
590
+ @ # run tests, ignore failures
591
+ $(TESTRUNNER) $(TESTOPTS) || true
592
+ @ # build lcov report
593
+ $(MAKE) coverage-lcov
594
+
595
+ # Run "Argument Clinic" over all source files
596
+ .PHONY=clinic
597
+ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
598
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
599
+
600
+ # Build the interpreter
601
+ $(BUILDPYTHON): Programs/python.o $(LIBRARY_DEPS)
602
+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
603
+
604
+ platform: $(BUILDPYTHON) pybuilddir.txt
605
+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
606
+
607
+ # Create build directory and generate the sysconfig build-time data there.
608
+ # pybuilddir.txt contains the name of the build dir and is used for
609
+ # sys.path fixup -- see Modules/getpath.c.
610
+ # Since this step runs before shared modules are built, try to avoid bootstrap
611
+ # problems by creating a dummy pybuilddir.txt just to allow interpreter
612
+ # initialization to succeed. It will be overwritten by generate-posix-vars
613
+ # or removed in case of failure.
614
+ pybuilddir.txt: $(BUILDPYTHON)
615
+ @echo "none" > ./pybuilddir.txt
616
+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
617
+ if test $$? -ne 0 ; then \
618
+ echo "generate-posix-vars failed" ; \
619
+ rm -f ./pybuilddir.txt ; \
620
+ exit 1 ; \
621
+ fi
622
+
623
+ # This is shared by the math and cmath modules
624
+ Modules/_math.o: Modules/_math.c Modules/_math.h
625
+ $(CC) -c $(CCSHARED) $(PY_CORE_CFLAGS) -o $@ $<
626
+
627
+ # blake2s is auto-generated from blake2b
628
+ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl.c $(srcdir)/Modules/_blake2/blake2b2s.py
629
+ $(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py
630
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@
631
+
632
+ # Build the shared modules
633
+ # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
634
+ # -s, --silent or --quiet is always the first char.
635
+ # Under BSD make, MAKEFLAGS might be " -s -v x=y".
636
+ # Ignore macros passed by GNU make, passed after --
637
+ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
638
+ @case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
639
+ *\ -s*|s*) quiet="-q";; \
640
+ *) quiet="";; \
641
+ esac; \
642
+ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
643
+ _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
644
+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
645
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
646
+ _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
647
+ $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
648
+
649
+
650
+ # Build static library
651
+ $(LIBRARY): $(LIBRARY_OBJS)
652
+ -rm -f $@
653
+ $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS)
654
+
655
+ libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS)
656
+ if test $(INSTSONAME) != $(LDLIBRARY); then \
657
+ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
658
+ $(LN) -f $(INSTSONAME) $@; \
659
+ else \
660
+ $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
661
+ fi
662
+
663
+ libpython3.so: libpython$(LDVERSION).so
664
+ $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
665
+
666
+ libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
667
+ $(CC) -dynamiclib -Wl,-single_module $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
668
+
669
+
670
+ libpython$(VERSION).sl: $(LIBRARY_OBJS)
671
+ $(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM)
672
+
673
+ # List of exported symbols for AIX
674
+ Modules/python.exp: $(LIBRARY)
675
+ $(srcdir)/Modules/makexp_aix $@ "$(EXPORTSFROM)" $?
676
+
677
+ # Copy up the gdb python hooks into a position where they can be automatically
678
+ # loaded by gdb during Lib/test/test_gdb.py
679
+ #
680
+ # Distributors are likely to want to install this somewhere else e.g. relative
681
+ # to the stripped DWARF data for the shared library.
682
+ gdbhooks: $(BUILDPYTHON)-gdb.py
683
+
684
+ SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
685
+ $(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
686
+ $(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py
687
+
688
+ # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
689
+ # minimal framework (not including the Lib directory and such) in the current
690
+ # directory.
691
+ RESSRCDIR=Mac/Resources/framework
692
+ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
693
+ $(LIBRARY) \
694
+ $(RESSRCDIR)/Info.plist
695
+ $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
696
+ $(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
697
+ -all_load $(LIBRARY) -Wl,-single_module \
698
+ -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
699
+ -compatibility_version $(VERSION) \
700
+ -current_version $(VERSION) \
701
+ -framework CoreFoundation $(LIBS);
702
+ $(INSTALL) -d -m $(DIRMODE) \
703
+ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
704
+ $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
705
+ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
706
+ $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
707
+ $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
708
+ $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
709
+
710
+ # This rule builds the Cygwin Python DLL and import library if configured
711
+ # for a shared core library; otherwise, this rule is a noop.
712
+ $(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
713
+ if test -n "$(DLLLIBRARY)"; then \
714
+ $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
715
+ $(LIBS) $(MODLIBS) $(SYSLIBS); \
716
+ else true; \
717
+ fi
718
+
719
+
720
+ oldsharedmods: $(SHAREDMODS)
721
+
722
+
723
+ Makefile Modules/config.c: Makefile.pre \
724
+ $(srcdir)/Modules/config.c.in \
725
+ $(MAKESETUP) \
726
+ $(srcdir)/Modules/Setup \
727
+ Modules/Setup.local
728
+ $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
729
+ -s Modules \
730
+ Modules/Setup.local \
731
+ $(srcdir)/Modules/Setup
732
+ @mv config.c Modules
733
+ @echo "The Makefile was updated, you may need to re-run make."
734
+
735
+
736
+ Programs/_testembed: Programs/_testembed.o $(LIBRARY_DEPS)
737
+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
738
+
739
+ ############################################################################
740
+ # Importlib
741
+
742
+ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
743
+
744
+ Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
745
+ $(LINKCC) $(PY_CORE_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS)
746
+
747
+ .PHONY: regen-importlib
748
+ regen-importlib: Programs/_freeze_importlib
749
+ # Regenerate Python/importlib_external.h
750
+ # from Lib/importlib/_bootstrap_external.py using _freeze_importlib
751
+ ./Programs/_freeze_importlib importlib._bootstrap_external \
752
+ $(srcdir)/Lib/importlib/_bootstrap_external.py \
753
+ $(srcdir)/Python/importlib_external.h.new
754
+ $(UPDATE_FILE) $(srcdir)/Python/importlib_external.h $(srcdir)/Python/importlib_external.h.new
755
+ # Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py
756
+ # using _freeze_importlib
757
+ ./Programs/_freeze_importlib importlib._bootstrap \
758
+ $(srcdir)/Lib/importlib/_bootstrap.py \
759
+ $(srcdir)/Python/importlib.h.new
760
+ $(UPDATE_FILE) $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib.h.new
761
+ # Regenerate Python/importlib_zipimport.h from Lib/zipimport.py
762
+ # using _freeze_importlib
763
+ ./Programs/_freeze_importlib zipimport \
764
+ $(srcdir)/Lib/zipimport.py \
765
+ $(srcdir)/Python/importlib_zipimport.h.new
766
+ $(UPDATE_FILE) $(srcdir)/Python/importlib_zipimport.h $(srcdir)/Python/importlib_zipimport.h.new
767
+
768
+ regen-abidump: all
769
+ @$(MKDIR_P) $(srcdir)/Doc/data/
770
+ abidw "libpython$(LDVERSION).so" --no-architecture --out-file $(srcdir)/Doc/data/python$(LDVERSION).abi.new
771
+ @$(UPDATE_FILE) $(srcdir)/Doc/data/python$(LDVERSION).abi $(srcdir)/Doc/data/python$(LDVERSION).abi.new
772
+
773
+ check-abidump: all
774
+ abidiff $(srcdir)/Doc/data/python$(LDVERSION).abi "libpython$(LDVERSION).so" --drop-private-types --no-architecture --no-added-syms
775
+
776
+ regen-limited-abi: all
777
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/stable_abi.py --generate-all $(srcdir)/Misc/stable_abi.txt
778
+
779
+
780
+ ############################################################################
781
+ # Regenerate all generated files
782
+
783
+ regen-all: regen-opcode regen-opcode-targets regen-typeslots \
784
+ regen-token regen-ast regen-keyword regen-importlib clinic \
785
+ regen-pegen-metaparser regen-pegen regen-frozen
786
+ @echo
787
+ @echo "Note: make regen-stdlib-module-names and autoconf should be run manually"
788
+
789
+ ############################################################################
790
+ # Special rules for object files
791
+
792
+ Modules/getbuildinfo.o: $(PARSER_OBJS) \
793
+ $(OBJECT_OBJS) \
794
+ $(PYTHON_OBJS) \
795
+ $(MODULE_OBJS) \
796
+ $(MODOBJS) \
797
+ $(DTRACE_OBJS) \
798
+ $(srcdir)/Modules/getbuildinfo.c
799
+ $(CC) -c $(PY_CORE_CFLAGS) \
800
+ -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
801
+ -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
802
+ -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
803
+ -o $@ $(srcdir)/Modules/getbuildinfo.c
804
+
805
+ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
806
+ $(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
807
+ -DPREFIX='"$(prefix)"' \
808
+ -DEXEC_PREFIX='"$(exec_prefix)"' \
809
+ -DVERSION='"$(VERSION)"' \
810
+ -DVPATH='"$(VPATH)"' \
811
+ -o $@ $(srcdir)/Modules/getpath.c
812
+
813
+ Programs/python.o: $(srcdir)/Programs/python.c
814
+ $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/python.c
815
+
816
+ Programs/_testembed.o: $(srcdir)/Programs/_testembed.c
817
+ $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/_testembed.c
818
+
819
+ Modules/_sre.o: $(srcdir)/Modules/_sre.c $(srcdir)/Modules/sre.h $(srcdir)/Modules/sre_constants.h $(srcdir)/Modules/sre_lib.h
820
+
821
+ Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c $(srcdir)/Modules/posixmodule.h
822
+
823
+ Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule.h
824
+
825
+ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.h
826
+
827
+ Modules/signalmodule.o: $(srcdir)/Modules/signalmodule.c $(srcdir)/Modules/posixmodule.h
828
+
829
+ Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
830
+ $(CC) -c $(PY_CORE_CFLAGS) \
831
+ -DSOABI='"$(SOABI)"' \
832
+ -o $@ $(srcdir)/Python/dynload_shlib.c
833
+
834
+ Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile
835
+ $(CC) -c $(PY_CORE_CFLAGS) \
836
+ -DSHLIB_EXT='"$(EXT_SUFFIX)"' \
837
+ -o $@ $(srcdir)/Python/dynload_hpux.c
838
+
839
+ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(srcdir)/Include/pydtrace.h
840
+ $(CC) -c $(PY_CORE_CFLAGS) \
841
+ -DABIFLAGS='"$(ABIFLAGS)"' \
842
+ $(MULTIARCH_CPPFLAGS) \
843
+ -o $@ $(srcdir)/Python/sysmodule.c
844
+
845
+ Python/initconfig.o: $(srcdir)/Python/initconfig.c
846
+ $(CC) -c $(PY_CORE_CFLAGS) \
847
+ -DPLATLIBDIR='"$(PLATLIBDIR)"' \
848
+ -o $@ $(srcdir)/Python/initconfig.c
849
+
850
+ $(IO_OBJS): $(IO_H)
851
+
852
+ .PHONY: regen-pegen-metaparser
853
+ regen-pegen-metaparser:
854
+ @$(MKDIR_P) $(srcdir)/Tools/peg_generator/pegen
855
+ PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -q python \
856
+ $(srcdir)/Tools/peg_generator/pegen/metagrammar.gram \
857
+ -o $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py.new
858
+ $(UPDATE_FILE) $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py \
859
+ $(srcdir)/Tools/peg_generator/pegen/grammar_parser.py.new
860
+
861
+ .PHONY: regen-pegen
862
+ regen-pegen:
863
+ @$(MKDIR_P) $(srcdir)/Parser
864
+ PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -q c \
865
+ $(srcdir)/Grammar/python.gram \
866
+ $(srcdir)/Grammar/Tokens \
867
+ -o $(srcdir)/Parser/parser.new.c
868
+ $(UPDATE_FILE) $(srcdir)/Parser/parser.c $(srcdir)/Parser/parser.new.c
869
+
870
+ .PHONY=regen-ast
871
+ regen-ast:
872
+ # Regenerate 3 files using using Parser/asdl_c.py:
873
+ # - Include/internal/pycore_ast.h
874
+ # - Include/internal/pycore_ast_state.h
875
+ # - Python/Python-ast.c
876
+ $(MKDIR_P) $(srcdir)/Include
877
+ $(MKDIR_P) $(srcdir)/Python
878
+ $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
879
+ $(srcdir)/Parser/Python.asdl \
880
+ -H $(srcdir)/Include/internal/pycore_ast.h.new \
881
+ -I $(srcdir)/Include/internal/pycore_ast_state.h.new \
882
+ -C $(srcdir)/Python/Python-ast.c.new
883
+
884
+ $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast.h $(srcdir)/Include/internal/pycore_ast.h.new
885
+ $(UPDATE_FILE) $(srcdir)/Include/internal/pycore_ast_state.h $(srcdir)/Include/internal/pycore_ast_state.h.new
886
+ $(UPDATE_FILE) $(srcdir)/Python/Python-ast.c $(srcdir)/Python/Python-ast.c.new
887
+
888
+ .PHONY: regen-opcode
889
+ regen-opcode:
890
+ # Regenerate Include/opcode.h from Lib/opcode.py
891
+ # using Tools/scripts/generate_opcode_h.py
892
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_opcode_h.py \
893
+ $(srcdir)/Lib/opcode.py \
894
+ $(srcdir)/Include/opcode.h.new
895
+ $(UPDATE_FILE) $(srcdir)/Include/opcode.h $(srcdir)/Include/opcode.h.new
896
+
897
+ .PHONY: regen-frozen
898
+ regen-frozen: Programs/_freeze_importlib
899
+ # Regenerate code for frozen module "__hello__".
900
+ ./Programs/_freeze_importlib hello \
901
+ $(srcdir)/Tools/freeze/flag.py \
902
+ $(srcdir)/Python/frozen_hello.h.new
903
+ $(UPDATE_FILE) $(srcdir)/Python/frozen_hello.h \
904
+ $(srcdir)/Python/frozen_hello.h.new
905
+
906
+ .PHONY: regen-token
907
+ regen-token:
908
+ # Regenerate Doc/library/token-list.inc from Grammar/Tokens
909
+ # using Tools/scripts/generate_token.py
910
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_token.py rst \
911
+ $(srcdir)/Grammar/Tokens \
912
+ $(srcdir)/Doc/library/token-list.inc
913
+ # Regenerate Include/token.h from Grammar/Tokens
914
+ # using Tools/scripts/generate_token.py
915
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_token.py h \
916
+ $(srcdir)/Grammar/Tokens \
917
+ $(srcdir)/Include/token.h
918
+ # Regenerate Parser/token.c from Grammar/Tokens
919
+ # using Tools/scripts/generate_token.py
920
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_token.py c \
921
+ $(srcdir)/Grammar/Tokens \
922
+ $(srcdir)/Parser/token.c
923
+ # Regenerate Lib/token.py from Grammar/Tokens
924
+ # using Tools/scripts/generate_token.py
925
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_token.py py \
926
+ $(srcdir)/Grammar/Tokens \
927
+ $(srcdir)/Lib/token.py
928
+
929
+ .PHONY: regen-keyword
930
+ regen-keyword:
931
+ # Regenerate Lib/keyword.py from Grammar/python.gram and Grammar/Tokens
932
+ # using Tools/peg_generator/pegen
933
+ PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen.keywordgen \
934
+ $(srcdir)/Grammar/python.gram \
935
+ $(srcdir)/Grammar/Tokens \
936
+ $(srcdir)/Lib/keyword.py.new
937
+ $(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new
938
+
939
+ .PHONY: regen-stdlib-module-names
940
+ regen-stdlib-module-names: build_all Programs/_testembed
941
+ # Regenerate Python/stdlib_module_names.h
942
+ # using Tools/scripts/generate_stdlib_module_names.py
943
+ $(RUNSHARED) ./$(BUILDPYTHON) \
944
+ $(srcdir)/Tools/scripts/generate_stdlib_module_names.py \
945
+ > $(srcdir)/Python/stdlib_module_names.h.new
946
+ $(UPDATE_FILE) $(srcdir)/Python/stdlib_module_names.h $(srcdir)/Python/stdlib_module_names.h.new
947
+
948
+ Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o: $(srcdir)/Include/internal/pycore_ast.h
949
+
950
+ Python/getplatform.o: $(srcdir)/Python/getplatform.c
951
+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
952
+
953
+ Python/importdl.o: $(srcdir)/Python/importdl.c
954
+ $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
955
+
956
+ Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
957
+ $(srcdir)/Objects/unicodetype_db.h
958
+
959
+ BYTESTR_DEPS = \
960
+ $(srcdir)/Objects/stringlib/count.h \
961
+ $(srcdir)/Objects/stringlib/ctype.h \
962
+ $(srcdir)/Objects/stringlib/fastsearch.h \
963
+ $(srcdir)/Objects/stringlib/find.h \
964
+ $(srcdir)/Objects/stringlib/join.h \
965
+ $(srcdir)/Objects/stringlib/partition.h \
966
+ $(srcdir)/Objects/stringlib/split.h \
967
+ $(srcdir)/Objects/stringlib/stringdefs.h \
968
+ $(srcdir)/Objects/stringlib/transmogrify.h
969
+
970
+ UNICODE_DEPS = \
971
+ $(srcdir)/Objects/stringlib/asciilib.h \
972
+ $(srcdir)/Objects/stringlib/codecs.h \
973
+ $(srcdir)/Objects/stringlib/count.h \
974
+ $(srcdir)/Objects/stringlib/fastsearch.h \
975
+ $(srcdir)/Objects/stringlib/find.h \
976
+ $(srcdir)/Objects/stringlib/find_max_char.h \
977
+ $(srcdir)/Objects/stringlib/localeutil.h \
978
+ $(srcdir)/Objects/stringlib/partition.h \
979
+ $(srcdir)/Objects/stringlib/replace.h \
980
+ $(srcdir)/Objects/stringlib/split.h \
981
+ $(srcdir)/Objects/stringlib/ucs1lib.h \
982
+ $(srcdir)/Objects/stringlib/ucs2lib.h \
983
+ $(srcdir)/Objects/stringlib/ucs4lib.h \
984
+ $(srcdir)/Objects/stringlib/undef.h \
985
+ $(srcdir)/Objects/stringlib/unicode_format.h \
986
+ $(srcdir)/Objects/stringlib/unicodedefs.h
987
+
988
+ Objects/bytes_methods.o: $(srcdir)/Objects/bytes_methods.c $(BYTESTR_DEPS)
989
+ Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS)
990
+ Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS)
991
+
992
+ Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS)
993
+
994
+ Objects/odictobject.o: $(srcdir)/Objects/dict-common.h
995
+ Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h $(srcdir)/Objects/dict-common.h
996
+ Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
997
+
998
+ .PHONY: regen-opcode-targets
999
+ regen-opcode-targets:
1000
+ # Regenerate Python/opcode_targets.h from Lib/opcode.py
1001
+ # using Python/makeopcodetargets.py
1002
+ $(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \
1003
+ $(srcdir)/Python/opcode_targets.h.new
1004
+ $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new
1005
+
1006
+ Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h \
1007
+ $(srcdir)/Python/condvar.h
1008
+
1009
+ Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h \
1010
+ $(srcdir)/Python/importlib_zipimport.h $(srcdir)/Python/frozen_hello.h
1011
+
1012
+ # Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to
1013
+ # follow our naming conventions. dtrace(1) uses the output filename to generate
1014
+ # an include guard, so we can't use a pipeline to transform its output.
1015
+ Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d
1016
+ $(MKDIR_P) Include
1017
+ $(DTRACE) $(DFLAGS) -o $@ -h -s $<
1018
+ : sed in-place edit with POSIX-only tools
1019
+ sed 's/PYTHON_/PyDTrace_/' $@ > [email protected]
1020
1021
+
1022
+ Python/ceval.o: $(srcdir)/Include/pydtrace.h
1023
+ Python/import.o: $(srcdir)/Include/pydtrace.h
1024
+ Modules/gcmodule.o: $(srcdir)/Include/pydtrace.h
1025
+
1026
+ Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
1027
+ $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
1028
+
1029
+ Objects/typeobject.o: Objects/typeslots.inc
1030
+
1031
+ .PHONY: regen-typeslots
1032
+ regen-typeslots:
1033
+ # Regenerate Objects/typeslots.inc from Include/typeslotsh
1034
+ # using Objects/typeslots.py
1035
+ $(PYTHON_FOR_REGEN) $(srcdir)/Objects/typeslots.py \
1036
+ < $(srcdir)/Include/typeslots.h \
1037
+ $(srcdir)/Objects/typeslots.inc.new
1038
+ $(UPDATE_FILE) $(srcdir)/Objects/typeslots.inc $(srcdir)/Objects/typeslots.inc.new
1039
+
1040
+ ############################################################################
1041
+ # Header files
1042
+
1043
+ PYTHON_HEADERS= \
1044
+ $(srcdir)/Include/Python.h \
1045
+ $(srcdir)/Include/abstract.h \
1046
+ $(srcdir)/Include/bltinmodule.h \
1047
+ $(srcdir)/Include/boolobject.h \
1048
+ $(srcdir)/Include/bytearrayobject.h \
1049
+ $(srcdir)/Include/bytesobject.h \
1050
+ $(srcdir)/Include/cellobject.h \
1051
+ $(srcdir)/Include/ceval.h \
1052
+ $(srcdir)/Include/classobject.h \
1053
+ $(srcdir)/Include/code.h \
1054
+ $(srcdir)/Include/codecs.h \
1055
+ $(srcdir)/Include/compile.h \
1056
+ $(srcdir)/Include/complexobject.h \
1057
+ $(srcdir)/Include/context.h \
1058
+ $(srcdir)/Include/descrobject.h \
1059
+ $(srcdir)/Include/dictobject.h \
1060
+ $(srcdir)/Include/dynamic_annotations.h \
1061
+ $(srcdir)/Include/enumobject.h \
1062
+ $(srcdir)/Include/errcode.h \
1063
+ $(srcdir)/Include/eval.h \
1064
+ $(srcdir)/Include/fileobject.h \
1065
+ $(srcdir)/Include/fileutils.h \
1066
+ $(srcdir)/Include/floatobject.h \
1067
+ $(srcdir)/Include/frameobject.h \
1068
+ $(srcdir)/Include/funcobject.h \
1069
+ $(srcdir)/Include/genobject.h \
1070
+ $(srcdir)/Include/import.h \
1071
+ $(srcdir)/Include/interpreteridobject.h \
1072
+ $(srcdir)/Include/intrcheck.h \
1073
+ $(srcdir)/Include/iterobject.h \
1074
+ $(srcdir)/Include/listobject.h \
1075
+ $(srcdir)/Include/longintrepr.h \
1076
+ $(srcdir)/Include/longobject.h \
1077
+ $(srcdir)/Include/marshal.h \
1078
+ $(srcdir)/Include/memoryobject.h \
1079
+ $(srcdir)/Include/methodobject.h \
1080
+ $(srcdir)/Include/modsupport.h \
1081
+ $(srcdir)/Include/moduleobject.h \
1082
+ $(srcdir)/Include/namespaceobject.h \
1083
+ $(srcdir)/Include/object.h \
1084
+ $(srcdir)/Include/objimpl.h \
1085
+ $(srcdir)/Include/opcode.h \
1086
+ $(srcdir)/Include/osdefs.h \
1087
+ $(srcdir)/Include/osmodule.h \
1088
+ $(srcdir)/Include/patchlevel.h \
1089
+ $(srcdir)/Include/pycapsule.h \
1090
+ $(srcdir)/Include/pydtrace.h \
1091
+ $(srcdir)/Include/pyerrors.h \
1092
+ $(srcdir)/Include/pyframe.h \
1093
+ $(srcdir)/Include/pyhash.h \
1094
+ $(srcdir)/Include/pylifecycle.h \
1095
+ $(srcdir)/Include/pymacconfig.h \
1096
+ $(srcdir)/Include/pymacro.h \
1097
+ $(srcdir)/Include/pymath.h \
1098
+ $(srcdir)/Include/pymem.h \
1099
+ $(srcdir)/Include/pyport.h \
1100
+ $(srcdir)/Include/pystate.h \
1101
+ $(srcdir)/Include/pystrcmp.h \
1102
+ $(srcdir)/Include/pystrhex.h \
1103
+ $(srcdir)/Include/pystrtod.h \
1104
+ $(srcdir)/Include/pythonrun.h \
1105
+ $(srcdir)/Include/pythread.h \
1106
+ $(srcdir)/Include/rangeobject.h \
1107
+ $(srcdir)/Include/setobject.h \
1108
+ $(srcdir)/Include/sliceobject.h \
1109
+ $(srcdir)/Include/structmember.h \
1110
+ $(srcdir)/Include/structseq.h \
1111
+ $(srcdir)/Include/sysmodule.h \
1112
+ $(srcdir)/Include/token.h \
1113
+ $(srcdir)/Include/traceback.h \
1114
+ $(srcdir)/Include/tracemalloc.h \
1115
+ $(srcdir)/Include/tupleobject.h \
1116
+ $(srcdir)/Include/unicodeobject.h \
1117
+ $(srcdir)/Include/warnings.h \
1118
+ $(srcdir)/Include/weakrefobject.h \
1119
+ \
1120
+ pyconfig.h \
1121
+ $(PARSER_HEADERS) \
1122
+ \
1123
+ $(srcdir)/Include/cpython/abstract.h \
1124
+ $(srcdir)/Include/cpython/bytearrayobject.h \
1125
+ $(srcdir)/Include/cpython/bytesobject.h \
1126
+ $(srcdir)/Include/cpython/ceval.h \
1127
+ $(srcdir)/Include/cpython/code.h \
1128
+ $(srcdir)/Include/cpython/compile.h \
1129
+ $(srcdir)/Include/cpython/dictobject.h \
1130
+ $(srcdir)/Include/cpython/fileobject.h \
1131
+ $(srcdir)/Include/cpython/fileutils.h \
1132
+ $(srcdir)/Include/cpython/frameobject.h \
1133
+ $(srcdir)/Include/cpython/import.h \
1134
+ $(srcdir)/Include/cpython/initconfig.h \
1135
+ $(srcdir)/Include/cpython/interpreteridobject.h \
1136
+ $(srcdir)/Include/cpython/listobject.h \
1137
+ $(srcdir)/Include/cpython/methodobject.h \
1138
+ $(srcdir)/Include/cpython/object.h \
1139
+ $(srcdir)/Include/cpython/objimpl.h \
1140
+ $(srcdir)/Include/cpython/odictobject.h \
1141
+ $(srcdir)/Include/cpython/picklebufobject.h \
1142
+ $(srcdir)/Include/cpython/pyctype.h \
1143
+ $(srcdir)/Include/cpython/pydebug.h \
1144
+ $(srcdir)/Include/cpython/pyerrors.h \
1145
+ $(srcdir)/Include/cpython/pyfpe.h \
1146
+ $(srcdir)/Include/cpython/pylifecycle.h \
1147
+ $(srcdir)/Include/cpython/pymem.h \
1148
+ $(srcdir)/Include/cpython/pystate.h \
1149
+ $(srcdir)/Include/cpython/pythonrun.h \
1150
+ $(srcdir)/Include/cpython/pytime.h \
1151
+ $(srcdir)/Include/cpython/sysmodule.h \
1152
+ $(srcdir)/Include/cpython/traceback.h \
1153
+ $(srcdir)/Include/cpython/tupleobject.h \
1154
+ $(srcdir)/Include/cpython/unicodeobject.h \
1155
+ \
1156
+ $(srcdir)/Include/internal/pycore_abstract.h \
1157
+ $(srcdir)/Include/internal/pycore_accu.h \
1158
+ $(srcdir)/Include/internal/pycore_asdl.h \
1159
+ $(srcdir)/Include/internal/pycore_ast.h \
1160
+ $(srcdir)/Include/internal/pycore_ast_state.h \
1161
+ $(srcdir)/Include/internal/pycore_atomic.h \
1162
+ $(srcdir)/Include/internal/pycore_atomic_funcs.h \
1163
+ $(srcdir)/Include/internal/pycore_bitutils.h \
1164
+ $(srcdir)/Include/internal/pycore_bytes_methods.h \
1165
+ $(srcdir)/Include/internal/pycore_call.h \
1166
+ $(srcdir)/Include/internal/pycore_ceval.h \
1167
+ $(srcdir)/Include/internal/pycore_code.h \
1168
+ $(srcdir)/Include/internal/pycore_compile.h \
1169
+ $(srcdir)/Include/internal/pycore_condvar.h \
1170
+ $(srcdir)/Include/internal/pycore_context.h \
1171
+ $(srcdir)/Include/internal/pycore_dtoa.h \
1172
+ $(srcdir)/Include/internal/pycore_fileutils.h \
1173
+ $(srcdir)/Include/internal/pycore_format.h \
1174
+ $(srcdir)/Include/internal/pycore_getopt.h \
1175
+ $(srcdir)/Include/internal/pycore_gil.h \
1176
+ $(srcdir)/Include/internal/pycore_hamt.h \
1177
+ $(srcdir)/Include/internal/pycore_hashtable.h \
1178
+ $(srcdir)/Include/internal/pycore_import.h \
1179
+ $(srcdir)/Include/internal/pycore_initconfig.h \
1180
+ $(srcdir)/Include/internal/pycore_interp.h \
1181
+ $(srcdir)/Include/internal/pycore_list.h \
1182
+ $(srcdir)/Include/internal/pycore_long.h \
1183
+ $(srcdir)/Include/internal/pycore_moduleobject.h \
1184
+ $(srcdir)/Include/internal/pycore_object.h \
1185
+ $(srcdir)/Include/internal/pycore_pathconfig.h \
1186
+ $(srcdir)/Include/internal/pycore_pyarena.h \
1187
+ $(srcdir)/Include/internal/pycore_pyerrors.h \
1188
+ $(srcdir)/Include/internal/pycore_pyhash.h \
1189
+ $(srcdir)/Include/internal/pycore_pylifecycle.h \
1190
+ $(srcdir)/Include/internal/pycore_pymem.h \
1191
+ $(srcdir)/Include/internal/pycore_pystate.h \
1192
+ $(srcdir)/Include/internal/pycore_runtime.h \
1193
+ $(srcdir)/Include/internal/pycore_structseq.h \
1194
+ $(srcdir)/Include/internal/pycore_symtable.h \
1195
+ $(srcdir)/Include/internal/pycore_sysmodule.h \
1196
+ $(srcdir)/Include/internal/pycore_traceback.h \
1197
+ $(srcdir)/Include/internal/pycore_tuple.h \
1198
+ $(srcdir)/Include/internal/pycore_ucnhash.h \
1199
+ $(srcdir)/Include/internal/pycore_unionobject.h \
1200
+ $(srcdir)/Include/internal/pycore_warnings.h \
1201
+ $(DTRACE_HEADERS) \
1202
+ \
1203
+ $(srcdir)/Python/stdlib_module_names.h
1204
+
1205
+ $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
1206
+
1207
+
1208
+ ######################################################################
1209
+
1210
+ TESTOPTS= $(EXTRATESTOPTS)
1211
+ TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS)
1212
+ TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py
1213
+ TESTTIMEOUT= 1200
1214
+
1215
+ .PHONY: test testall testuniversal buildbottest pythoninfo
1216
+
1217
+ # Remove "test_python_*" directories of previous failed test jobs.
1218
+ # Pass TESTOPTS options because it can contain --tempdir option.
1219
+ cleantest: build_all
1220
+ $(TESTRUNNER) $(TESTOPTS) --cleanup
1221
+
1222
+ # Run a basic set of regression tests.
1223
+ # This excludes some tests that are particularly resource-intensive.
1224
+ test: build_all platform
1225
+ $(TESTRUNNER) $(TESTOPTS)
1226
+
1227
+ # Run the full test suite twice - once without .pyc files, and once with.
1228
+ # In the past, we've had problems where bugs in the marshalling or
1229
+ # elsewhere caused bytecode read from .pyc files to behave differently
1230
+ # than bytecode generated directly from a .py source file. Sometimes
1231
+ # the bytecode read from a .pyc file had the bug, sometimes the directly
1232
+ # generated bytecode. This is sometimes a very shy bug needing a lot of
1233
+ # sample data.
1234
+ testall: build_all platform
1235
+ -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
1236
+ $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py
1237
+ -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
1238
+ -$(TESTRUNNER) -u all $(TESTOPTS)
1239
+ $(TESTRUNNER) -u all $(TESTOPTS)
1240
+
1241
+ # Run the test suite for both architectures in a Universal build on OSX.
1242
+ # Must be run on an Intel box.
1243
+ testuniversal: build_all platform
1244
+ @if [ `arch` != 'i386' ]; then \
1245
+ echo "This can only be used on OSX/i386" ;\
1246
+ exit 1 ;\
1247
+ fi
1248
+ $(TESTRUNNER) -u all $(TESTOPTS)
1249
+ $(RUNSHARED) /usr/libexec/oah/translate \
1250
+ ./$(BUILDPYTHON) -E -m test -j 0 -u all $(TESTOPTS)
1251
+
1252
+ # Like testall, but with only one pass and without multiple processes.
1253
+ # Run an optional script to include information about the build environment.
1254
+ buildbottest: build_all platform
1255
+ -@if which pybuildbot.identify >/dev/null 2>&1; then \
1256
+ pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
1257
+ fi
1258
+ $(TESTRUNNER) -j 1 -u all -W --slowest --fail-env-changed --timeout=$(TESTTIMEOUT) $(TESTOPTS)
1259
+
1260
+ pythoninfo: build_all
1261
+ $(RUNSHARED) ./$(BUILDPYTHON) -m test.pythoninfo
1262
+
1263
+ QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
1264
+ test_multibytecodec test_urllib2_localnet test_itertools \
1265
+ test_multiprocessing_fork test_multiprocessing_spawn \
1266
+ test_multiprocessing_forkserver \
1267
+ test_mailbox test_socket test_poll \
1268
+ test_select test_zipfile test_concurrent_futures
1269
+ quicktest: build_all platform
1270
+ $(TESTRUNNER) $(QUICKTESTOPTS)
1271
+
1272
+ # SSL tests
1273
+ .PHONY: multisslcompile multissltest
1274
+ multisslcompile: build_all
1275
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py --steps=modules
1276
+
1277
+ multissltest: build_all
1278
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py
1279
+
1280
+ install: commoninstall bininstall maninstall
1281
+ if test "x$(ENSUREPIP)" != "xno" ; then \
1282
+ case $(ENSUREPIP) in \
1283
+ upgrade) ensurepip="--upgrade" ;; \
1284
+ install|*) ensurepip="" ;; \
1285
+ esac; \
1286
+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -m ensurepip \
1287
+ $$ensurepip --root=$(DESTDIR)/ ; \
1288
+ fi
1289
+
1290
+ altinstall: commoninstall
1291
+ if test "x$(ENSUREPIP)" != "xno" ; then \
1292
+ case $(ENSUREPIP) in \
1293
+ upgrade) ensurepip="--altinstall --upgrade" ;; \
1294
+ install|*) ensurepip="--altinstall" ;; \
1295
+ esac; \
1296
+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -m ensurepip \
1297
+ $$ensurepip --root=$(DESTDIR)/ ; \
1298
+ fi
1299
+
1300
+ commoninstall: check-clean-src \
1301
+ altbininstall libinstall inclinstall libainstall \
1302
+ sharedinstall oldsharedinstall altmaninstall \
1303
+
1304
+
1305
+ # Install shared libraries enabled by Setup
1306
+ DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
1307
+
1308
+ oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
1309
+ @for i in X $(SHAREDMODS); do \
1310
+ if test $$i != X; then \
1311
+ echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
1312
+ $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
1313
+ fi; \
1314
+ done
1315
+
1316
+ $(DESTSHARED):
1317
+ @for i in $(DESTDIRS); \
1318
+ do \
1319
+ if test ! -d $(DESTDIR)$$i; then \
1320
+ echo "Creating directory $$i"; \
1321
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1322
+ else true; \
1323
+ fi; \
1324
+ done
1325
+
1326
+ # Install the interpreter with $(VERSION) affixed
1327
+ # This goes into $(exec_prefix)
1328
+ altbininstall: $(BUILDPYTHON)
1329
+ @for i in $(BINDIR) $(LIBDIR); \
1330
+ do \
1331
+ if test ! -d $(DESTDIR)$$i; then \
1332
+ echo "Creating directory $$i"; \
1333
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1334
+ else true; \
1335
+ fi; \
1336
+ done
1337
+ if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
1338
+ $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
1339
+ else \
1340
+ $(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
1341
+ fi
1342
+ -if test "$(VERSION)" != "$(LDVERSION)"; then \
1343
+ if test -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -o -h $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
1344
+ then rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
1345
+ fi; \
1346
+ (cd $(DESTDIR)$(BINDIR); $(LN) python$(LDVERSION)$(EXE) python$(VERSION)$(EXE)); \
1347
+ fi
1348
+ @if test "$(PY_ENABLE_SHARED)" = 1 -o "$(STATIC_LIBPYTHON)" = 1; then \
1349
+ if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
1350
+ if test -n "$(DLLLIBRARY)" ; then \
1351
+ $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
1352
+ else \
1353
+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
1354
+ if test $(LDLIBRARY) != $(INSTSONAME); then \
1355
+ (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
1356
+ fi \
1357
+ fi; \
1358
+ if test -n "$(PY3LIBRARY)"; then \
1359
+ $(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
1360
+ fi; \
1361
+ else true; \
1362
+ fi; \
1363
+ fi
1364
+ if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
1365
+ rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-32$(EXE); \
1366
+ lipo $(LIPO_32BIT_FLAGS) \
1367
+ -output $(DESTDIR)$(BINDIR)/python$(VERSION)-32$(EXE) \
1368
+ $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
1369
+ fi
1370
+ if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \
1371
+ rm -f $(DESTDIR)$(BINDIR)python$(VERSION)-intel64$(EXE); \
1372
+ lipo $(LIPO_INTEL64_FLAGS) \
1373
+ -output $(DESTDIR)$(BINDIR)/python$(VERSION)-intel64$(EXE) \
1374
+ $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
1375
+ fi
1376
+
1377
+ bininstall: altbininstall
1378
+ if test ! -d $(DESTDIR)$(LIBPC); then \
1379
+ echo "Creating directory $(LIBPC)"; \
1380
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \
1381
+ fi
1382
+ -if test -f $(DESTDIR)$(BINDIR)/python3$(EXE) -o -h $(DESTDIR)$(BINDIR)/python3$(EXE); \
1383
+ then rm -f $(DESTDIR)$(BINDIR)/python3$(EXE); \
1384
+ else true; \
1385
+ fi
1386
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python3$(EXE))
1387
+ -if test "$(VERSION)" != "$(LDVERSION)"; then \
1388
+ rm -f $(DESTDIR)$(BINDIR)/python$(VERSION)-config; \
1389
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \
1390
+ rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc; \
1391
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc); \
1392
+ rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION)-embed.pc; \
1393
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python-$(LDVERSION)-embed.pc); \
1394
+ fi
1395
+ -rm -f $(DESTDIR)$(BINDIR)/python3-config
1396
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
1397
+ -rm -f $(DESTDIR)$(LIBPC)/python3.pc
1398
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
1399
+ -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc
1400
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc)
1401
+ -rm -f $(DESTDIR)$(BINDIR)/idle3
1402
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
1403
+ -rm -f $(DESTDIR)$(BINDIR)/pydoc3
1404
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
1405
+ -rm -f $(DESTDIR)$(BINDIR)/2to3
1406
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
1407
+ if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
1408
+ rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
1409
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
1410
+ fi
1411
+ if test "x$(LIPO_INTEL64_FLAGS)" != "x" ; then \
1412
+ rm -f $(DESTDIR)$(BINDIR)/python3-intel64$(EXE); \
1413
+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-intel64$(EXE) python3-intel64$(EXE)) \
1414
+ fi
1415
+
1416
+ # Install the versioned manual page
1417
+ altmaninstall:
1418
+ @for i in $(MANDIR) $(MANDIR)/man1; \
1419
+ do \
1420
+ if test ! -d $(DESTDIR)$$i; then \
1421
+ echo "Creating directory $$i"; \
1422
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1423
+ else true; \
1424
+ fi; \
1425
+ done
1426
+ $(INSTALL_DATA) $(srcdir)/Misc/python.man \
1427
+ $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
1428
+
1429
+ # Install the unversioned manual page
1430
+ maninstall: altmaninstall
1431
+ -rm -f $(DESTDIR)$(MANDIR)/man1/python3.1
1432
+ (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python3.1)
1433
+
1434
+ # Install the library
1435
+ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
1436
+ LIBSUBDIRS= asyncio \
1437
+ collections \
1438
+ concurrent concurrent/futures \
1439
+ csv \
1440
+ ctypes ctypes/macholib \
1441
+ curses \
1442
+ dbm \
1443
+ distutils distutils/command \
1444
+ email email/mime \
1445
+ encodings \
1446
+ ensurepip ensurepip/_bundled \
1447
+ html \
1448
+ http \
1449
+ idlelib idlelib/Icons \
1450
+ importlib importlib/metadata \
1451
+ json \
1452
+ lib2to3 lib2to3/fixes lib2to3/pgen2 \
1453
+ logging \
1454
+ multiprocessing multiprocessing/dummy \
1455
+ pydoc_data \
1456
+ site-packages \
1457
+ sqlite3 \
1458
+ tkinter \
1459
+ turtledemo \
1460
+ unittest \
1461
+ urllib \
1462
+ venv venv/scripts venv/scripts/common venv/scripts/posix \
1463
+ wsgiref \
1464
+ $(XMLLIBSUBDIRS) \
1465
+ xmlrpc \
1466
+ zoneinfo
1467
+ TESTSUBDIRS= ctypes/test \
1468
+ distutils/tests \
1469
+ idlelib/idle_test \
1470
+ lib2to3/tests \
1471
+ lib2to3/tests/data \
1472
+ lib2to3/tests/data/fixers \
1473
+ lib2to3/tests/data/fixers/myfixes \
1474
+ sqlite3/test \
1475
+ test test/audiodata \
1476
+ test/capath test/cjkencodings \
1477
+ test/data test/decimaltestdata \
1478
+ test/dtracedata test/eintrdata \
1479
+ test/encoded_modules test/imghdrdata \
1480
+ test/libregrtest test/sndhdrdata \
1481
+ test/subprocessdata test/support \
1482
+ test/test_asyncio \
1483
+ test/test_email test/test_email/data \
1484
+ test/test_import \
1485
+ test/test_import/data \
1486
+ test/test_import/data/circular_imports \
1487
+ test/test_import/data/circular_imports/subpkg \
1488
+ test/test_import/data/package \
1489
+ test/test_import/data/package2 \
1490
+ test/test_import/data/unwritable \
1491
+ test/test_importlib \
1492
+ test/test_importlib/builtin \
1493
+ test/test_importlib/data \
1494
+ test/test_importlib/data01 \
1495
+ test/test_importlib/data01/subdirectory \
1496
+ test/test_importlib/data02 \
1497
+ test/test_importlib/data02/one \
1498
+ test/test_importlib/data02/two \
1499
+ test/test_importlib/data03 \
1500
+ test/test_importlib/data03/namespace \
1501
+ test/test_importlib/data03/namespace/portion1 \
1502
+ test/test_importlib/data03/namespace/portion2 \
1503
+ test/test_importlib/extension \
1504
+ test/test_importlib/frozen \
1505
+ test/test_importlib/import_ \
1506
+ test/test_importlib/namespace_pkgs \
1507
+ test/test_importlib/namespace_pkgs/both_portions \
1508
+ test/test_importlib/namespace_pkgs/both_portions/foo \
1509
+ test/test_importlib/namespace_pkgs/module_and_namespace_package \
1510
+ test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \
1511
+ test/test_importlib/namespace_pkgs/not_a_namespace_pkg \
1512
+ test/test_importlib/namespace_pkgs/not_a_namespace_pkg/foo \
1513
+ test/test_importlib/namespace_pkgs/portion1 \
1514
+ test/test_importlib/namespace_pkgs/portion1/foo \
1515
+ test/test_importlib/namespace_pkgs/portion2 \
1516
+ test/test_importlib/namespace_pkgs/portion2/foo \
1517
+ test/test_importlib/namespace_pkgs/project1 \
1518
+ test/test_importlib/namespace_pkgs/project1/parent \
1519
+ test/test_importlib/namespace_pkgs/project1/parent/child \
1520
+ test/test_importlib/namespace_pkgs/project2 \
1521
+ test/test_importlib/namespace_pkgs/project2/parent \
1522
+ test/test_importlib/namespace_pkgs/project2/parent/child \
1523
+ test/test_importlib/namespace_pkgs/project3 \
1524
+ test/test_importlib/namespace_pkgs/project3/parent \
1525
+ test/test_importlib/namespace_pkgs/project3/parent/child \
1526
+ test/test_importlib/namespacedata01 \
1527
+ test/test_importlib/partial \
1528
+ test/test_importlib/source \
1529
+ test/test_importlib/zipdata01 \
1530
+ test/test_importlib/zipdata02 \
1531
+ test/test_json \
1532
+ test/test_peg_generator \
1533
+ test/test_tools \
1534
+ test/test_warnings test/test_warnings/data \
1535
+ test/test_zoneinfo test/test_zoneinfo/data \
1536
+ test/tracedmodules \
1537
+ test/typinganndata \
1538
+ test/xmltestdata test/xmltestdata/c14n-20 \
1539
+ test/ziptestdata \
1540
+ tkinter/test tkinter/test/test_tkinter \
1541
+ tkinter/test/test_ttk \
1542
+ unittest/test unittest/test/testmock
1543
+
1544
+ TEST_MODULES=yes
1545
+ libinstall: build_all $(srcdir)/Modules/xxmodule.c
1546
+ @for i in $(SCRIPTDIR) $(LIBDEST); \
1547
+ do \
1548
+ if test ! -d $(DESTDIR)$$i; then \
1549
+ echo "Creating directory $$i"; \
1550
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1551
+ else true; \
1552
+ fi; \
1553
+ done
1554
+ @if test "$(TEST_MODULES)" = yes; then \
1555
+ subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
1556
+ else \
1557
+ subdirs="$(LIBSUBDIRS)"; \
1558
+ fi; \
1559
+ for d in $$subdirs; \
1560
+ do \
1561
+ a=$(srcdir)/Lib/$$d; \
1562
+ if test ! -d $$a; then continue; else true; fi; \
1563
+ b=$(LIBDEST)/$$d; \
1564
+ if test ! -d $(DESTDIR)$$b; then \
1565
+ echo "Creating directory $$b"; \
1566
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
1567
+ else true; \
1568
+ fi; \
1569
+ done
1570
+ @for i in $(srcdir)/Lib/*.py; \
1571
+ do \
1572
+ if test -x $$i; then \
1573
+ $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
1574
+ echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
1575
+ else \
1576
+ $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
1577
+ echo $(INSTALL_DATA) $$i $(LIBDEST); \
1578
+ fi; \
1579
+ done
1580
+ @if test "$(TEST_MODULES)" = yes; then \
1581
+ subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
1582
+ else \
1583
+ subdirs="$(LIBSUBDIRS)"; \
1584
+ fi; \
1585
+ for d in $$subdirs; \
1586
+ do \
1587
+ a=$(srcdir)/Lib/$$d; \
1588
+ if test ! -d $$a; then continue; else true; fi; \
1589
+ if test `ls $$a | wc -l` -lt 1; then continue; fi; \
1590
+ b=$(LIBDEST)/$$d; \
1591
+ for i in $$a/*; \
1592
+ do \
1593
+ case $$i in \
1594
+ *CVS) ;; \
1595
+ *.py[co]) ;; \
1596
+ *.orig) ;; \
1597
+ *~) ;; \
1598
+ *) \
1599
+ if test -d $$i; then continue; fi; \
1600
+ if test -x $$i; then \
1601
+ echo $(INSTALL_SCRIPT) $$i $$b; \
1602
+ $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
1603
+ else \
1604
+ echo $(INSTALL_DATA) $$i $$b; \
1605
+ $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
1606
+ fi;; \
1607
+ esac; \
1608
+ done; \
1609
+ done
1610
+ $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
1611
+ $(DESTDIR)$(LIBDEST); \
1612
+ $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
1613
+ if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
1614
+ $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
1615
+ $(DESTDIR)$(LIBDEST)/distutils/tests ; \
1616
+ fi
1617
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1618
+ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
1619
+ -j0 -d $(LIBDEST) -f \
1620
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1621
+ $(DESTDIR)$(LIBDEST)
1622
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1623
+ $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
1624
+ -j0 -d $(LIBDEST) -f \
1625
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1626
+ $(DESTDIR)$(LIBDEST)
1627
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1628
+ $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
1629
+ -j0 -d $(LIBDEST) -f \
1630
+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
1631
+ $(DESTDIR)$(LIBDEST)
1632
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1633
+ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
1634
+ -j0 -d $(LIBDEST)/site-packages -f \
1635
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1636
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1637
+ $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
1638
+ -j0 -d $(LIBDEST)/site-packages -f \
1639
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1640
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1641
+ $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
1642
+ -j0 -d $(LIBDEST)/site-packages -f \
1643
+ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
1644
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1645
+ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
1646
+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
1647
+ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
1648
+
1649
+ # bpo-21536: Misc/python-config.sh is generated in the build directory
1650
+ # from $(srcdir)Misc/python-config.sh.in.
1651
+ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
1652
+ @ # Substitution happens here, as the completely-expanded BINDIR
1653
+ @ # is not available in configure
1654
+ sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py
1655
+ @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
1656
+ LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config
1657
+ @ # On Darwin, always use the python version of the script, the shell
1658
+ @ # version doesn't use the compiler customizations that are provided
1659
+ @ # in python (_osx_support.py).
1660
+ @if test `uname -s` = Darwin; then \
1661
+ cp python-config.py python-config; \
1662
+ fi
1663
+
1664
+
1665
+ # Install the include files
1666
+ INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
1667
+ inclinstall:
1668
+ @for i in $(INCLDIRSTOMAKE); \
1669
+ do \
1670
+ if test ! -d $(DESTDIR)$$i; then \
1671
+ echo "Creating directory $$i"; \
1672
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1673
+ else true; \
1674
+ fi; \
1675
+ done
1676
+ @if test ! -d $(DESTDIR)$(INCLUDEPY)/cpython; then \
1677
+ echo "Creating directory $(DESTDIR)$(INCLUDEPY)/cpython"; \
1678
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(INCLUDEPY)/cpython; \
1679
+ else true; \
1680
+ fi
1681
+ @if test ! -d $(DESTDIR)$(INCLUDEPY)/internal; then \
1682
+ echo "Creating directory $(DESTDIR)$(INCLUDEPY)/internal"; \
1683
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(INCLUDEPY)/internal; \
1684
+ else true; \
1685
+ fi
1686
+ @for i in $(srcdir)/Include/*.h; \
1687
+ do \
1688
+ echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
1689
+ $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
1690
+ done
1691
+ @for i in $(srcdir)/Include/cpython/*.h; \
1692
+ do \
1693
+ echo $(INSTALL_DATA) $$i $(INCLUDEPY)/cpython; \
1694
+ $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/cpython; \
1695
+ done
1696
+ @for i in $(srcdir)/Include/internal/*.h; \
1697
+ do \
1698
+ echo $(INSTALL_DATA) $$i $(INCLUDEPY)/internal; \
1699
+ $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/internal; \
1700
+ done
1701
+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
1702
+
1703
+ # Install the library and miscellaneous stuff needed for extending/embedding
1704
+ # This goes into $(exec_prefix)
1705
+ LIBPL= $(prefix)/lib/python3.10/config-$(VERSION)$(ABIFLAGS)-x86_64-linux-gnu
1706
+
1707
+ # pkgconfig directory
1708
+ LIBPC= $(LIBDIR)/pkgconfig
1709
+
1710
+ libainstall: build_all python-config
1711
+ @for i in $(LIBDIR) $(LIBPL) $(LIBPC) $(BINDIR); \
1712
+ do \
1713
+ if test ! -d $(DESTDIR)$$i; then \
1714
+ echo "Creating directory $$i"; \
1715
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1716
+ else true; \
1717
+ fi; \
1718
+ done
1719
+ @if test "$(STATIC_LIBPYTHON)" = 1; then \
1720
+ if test -d $(LIBRARY); then :; else \
1721
+ if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1722
+ if test "$(SHLIB_SUFFIX)" = .dll; then \
1723
+ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
1724
+ else \
1725
+ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
1726
+ fi; \
1727
+ else \
1728
+ echo Skip install of $(LIBRARY) - use make frameworkinstall; \
1729
+ fi; \
1730
+ fi; \
1731
+ $(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o; \
1732
+ fi
1733
+ $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
1734
+ $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
1735
+ $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
1736
+ $(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
1737
+ $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
1738
+ $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
1739
+ $(INSTALL_DATA) Misc/python-embed.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc
1740
+ $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
1741
+ $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
1742
+ $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
1743
+ $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
1744
+ @if [ -s Modules/python.exp -a \
1745
+ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
1746
+ echo; echo "Installing support files for building shared extension modules on AIX:"; \
1747
+ $(INSTALL_DATA) Modules/python.exp \
1748
+ $(DESTDIR)$(LIBPL)/python.exp; \
1749
+ echo; echo "$(LIBPL)/python.exp"; \
1750
+ $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
1751
+ $(DESTDIR)$(LIBPL)/makexp_aix; \
1752
+ echo "$(LIBPL)/makexp_aix"; \
1753
+ $(INSTALL_SCRIPT) Modules/ld_so_aix \
1754
+ $(DESTDIR)$(LIBPL)/ld_so_aix; \
1755
+ echo "$(LIBPL)/ld_so_aix"; \
1756
+ echo; echo "See Misc/README.AIX for details."; \
1757
+ else true; \
1758
+ fi
1759
+
1760
+ # Install the dynamically loadable modules
1761
+ # This goes into $(exec_prefix)
1762
+ sharedinstall: sharedmods
1763
+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
1764
+ --prefix=$(prefix) \
1765
+ --install-scripts=$(BINDIR) \
1766
+ --install-platlib=$(DESTSHARED) \
1767
+ --root=$(DESTDIR)/
1768
+ -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
1769
+ -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
1770
+
1771
+ # Here are a couple of targets for MacOSX again, to install a full
1772
+ # framework-based Python. frameworkinstall installs everything, the
1773
+ # subtargets install specific parts. Much of the actual work is offloaded to
1774
+ # the Makefile in Mac
1775
+ #
1776
+ #
1777
+ # This target is here for backward compatibility, previous versions of Python
1778
+ # hadn't integrated framework installation in the normal install process.
1779
+ frameworkinstall: install
1780
+
1781
+ # On install, we re-make the framework
1782
+ # structure in the install location, /Library/Frameworks/ or the argument to
1783
+ # --enable-framework. If --enable-framework has been specified then we have
1784
+ # automatically set prefix to the location deep down in the framework, so we
1785
+ # only have to cater for the structural bits of the framework.
1786
+
1787
+ frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
1788
+
1789
+ frameworkinstallstructure: $(LDLIBRARY)
1790
+ @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
1791
+ echo Not configured with --enable-framework; \
1792
+ exit 1; \
1793
+ else true; \
1794
+ fi
1795
+ @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
1796
+ if test ! -d $(DESTDIR)$$i; then \
1797
+ echo "Creating directory $(DESTDIR)$$i"; \
1798
+ $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
1799
+ else true; \
1800
+ fi; \
1801
+ done
1802
+ $(LN) -fsn include/python$(LDVERSION) $(DESTDIR)$(prefix)/Headers
1803
+ sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
1804
+ $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
1805
+ $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
1806
+ $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
1807
+ $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
1808
+ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
1809
+
1810
+ # This installs Mac/Lib into the framework
1811
+ # Install a number of symlinks to keep software that expects a normal unix
1812
+ # install (which includes python-config) happy.
1813
+ frameworkinstallmaclib:
1814
+ $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).a"
1815
+ $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).dylib"
1816
+ $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).a"
1817
+ $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).dylib"
1818
+ $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(LDVERSION).dylib"
1819
+ $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib"
1820
+
1821
+ # This installs the IDE, the Launcher and other apps into /Applications
1822
+ frameworkinstallapps:
1823
+ cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
1824
+
1825
+ # Build the bootstrap executable that will spawn the interpreter inside
1826
+ # an app bundle within the framework. This allows the interpreter to
1827
+ # run OS X GUI APIs.
1828
+ frameworkpythonw:
1829
+ cd Mac && $(MAKE) pythonw
1830
+
1831
+ # This installs the python* and other bin symlinks in $prefix/bin or in
1832
+ # a bin directory relative to the framework root
1833
+ frameworkinstallunixtools:
1834
+ cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
1835
+
1836
+ frameworkaltinstallunixtools:
1837
+ cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
1838
+
1839
+ # This installs the Tools into the applications directory.
1840
+ # It is not part of a normal frameworkinstall
1841
+ frameworkinstallextras:
1842
+ cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
1843
+
1844
+ # Build the toplevel Makefile
1845
+ Makefile.pre: $(srcdir)/Makefile.pre.in config.status
1846
+ CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
1847
+ $(MAKE) -f Makefile.pre Makefile
1848
+
1849
+ # Run the configure script.
1850
+ config.status: $(srcdir)/configure
1851
+ $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
1852
+
1853
+ .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
1854
+
1855
+ # Some make's put the object file in the current directory
1856
+ .c.o:
1857
+ $(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
1858
+
1859
+ # bpo-30104: dtoa.c uses union to cast double to unsigned long[2]. clang 4.0
1860
+ # with -O2 or higher and strict aliasing miscompiles the ratio() function
1861
+ # causing rounding issues. Compile dtoa.c using -fno-strict-aliasing on clang.
1862
+ # https://bugs.llvm.org//show_bug.cgi?id=31928
1863
+ Python/dtoa.o: Python/dtoa.c
1864
+ $(CC) -c $(PY_CORE_CFLAGS) $(CFLAGS_ALIASING) -o $@ $<
1865
+
1866
+ # Run reindent on the library
1867
+ reindent:
1868
+ ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
1869
+
1870
+ # Rerun configure with the same options as it was run last time,
1871
+ # provided the config.status script exists
1872
+ recheck:
1873
+ $(SHELL) config.status --recheck
1874
+ $(SHELL) config.status
1875
+
1876
+ # Regenerate configure and pyconfig.h.in
1877
+ .PHONY: autoconf
1878
+ autoconf:
1879
+ # Regenerate the configure script from configure.ac using autoconf
1880
+ (cd $(srcdir); autoconf -Wall)
1881
+ # Regenerate pyconfig.h.in from configure.ac using autoheader
1882
+ (cd $(srcdir); autoheader -Wall)
1883
+
1884
+ # See https://github.com/tiran/cpython_autoconf container
1885
+ .PHONY: regen-configure
1886
+ regen-configure:
1887
+ @if command -v podman >/dev/null; then RUNTIME="podman"; else RUNTIME="docker"; fi; \
1888
+ if ! command -v $$RUNTIME; then echo "$@ needs either Podman or Docker container runtime." >&2; exit 1; fi; \
1889
+ if command -v selinuxenabled >/dev/null && selinuxenabled; then OPT=":Z"; fi; \
1890
+ # Manifest corresponds with tag '269' \
1891
+ CPYTHON_AUTOCONF_MANIFEST="sha256:f370fee95eefa3d57b00488bce4911635411fa83e2d293ced8cf8a3674ead939" \
1892
+ CMD="$$RUNTIME run --rm --pull=missing -v $(abs_srcdir):/src$$OPT quay.io/tiran/cpython_autoconf@$$CPYTHON_AUTOCONF_MANIFEST"; \
1893
+ echo $$CMD; \
1894
+ $$CMD || exit $?
1895
+
1896
+ # Create a tags file for vi
1897
+ tags::
1898
+ ctags -w $(srcdir)/Include/*.h $(srcdir)/Include/cpython/*.h $(srcdir)/Include/internal/*.h
1899
+ for i in $(SRCDIRS); do ctags -f tags -w -a $(srcdir)/$$i/*.[ch]; done
1900
+ ctags -f tags -w -a $(srcdir)/Modules/_ctypes/*.[ch]
1901
+ find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | ctags -f tags -w -a -L -
1902
+ LC_ALL=C sort -o tags tags
1903
+
1904
+ # Create a tags file for GNU Emacs
1905
+ TAGS::
1906
+ cd $(srcdir); \
1907
+ etags Include/*.h Include/cpython/*.h Include/internal/*.h; \
1908
+ for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1909
+ etags -a $(srcdir)/Modules/_ctypes/*.[ch]
1910
+ find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | etags - -a
1911
+
1912
+ # Sanitation targets -- clean leaves libraries, executables and tags
1913
+ # files, which clobber removes as well
1914
+ pycremoval:
1915
+ -find $(srcdir) -depth -name '__pycache__' -exec rm -rf {} ';'
1916
+ -find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
1917
+
1918
+ rmtestturds:
1919
+ -rm -f *BAD *GOOD *SKIPPED
1920
+ -rm -rf OUT
1921
+ -rm -f *.TXT
1922
+ -rm -f *.txt
1923
+ -rm -f gb-18030-2000.xml
1924
+
1925
+ docclean:
1926
+ $(MAKE) -C $(srcdir)/Doc clean
1927
+
1928
+ # like the 'clean' target but retain the profile guided optimization (PGO)
1929
+ # data. The PGO data is only valid if source code remains unchanged.
1930
+ clean-retain-profile: pycremoval
1931
+ find . -name '*.[oa]' -exec rm -f {} ';'
1932
+ find . -name '*.s[ol]' -exec rm -f {} ';'
1933
+ find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
1934
+ find . -name '*.lst' -exec rm -f {} ';'
1935
+ find build -name 'fficonfig.h' -exec rm -f {} ';' || true
1936
+ find build -name '*.py' -exec rm -f {} ';' || true
1937
+ find build -name '*.py[co]' -exec rm -f {} ';' || true
1938
+ -rm -f pybuilddir.txt
1939
+ -rm -f Lib/lib2to3/*Grammar*.pickle
1940
+ -rm -f Programs/_testembed Programs/_freeze_importlib
1941
+ -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
1942
+ -rm -f Include/pydtrace_probes.h
1943
+ -rm -f profile-gen-stamp
1944
+
1945
+ profile-removal:
1946
+ find . -name '*.gc??' -exec rm -f {} ';'
1947
+ find . -name '*.profclang?' -exec rm -f {} ';'
1948
+ find . -name '*.dyn' -exec rm -f {} ';'
1949
+ rm -f $(COVERAGE_INFO)
1950
+ rm -rf $(COVERAGE_REPORT)
1951
+ rm -f profile-run-stamp
1952
+
1953
+ clean: clean-retain-profile
1954
+ @if test profile-opt = profile-opt; then \
1955
+ rm -f profile-gen-stamp profile-clean-stamp; \
1956
+ $(MAKE) profile-removal; \
1957
+ fi
1958
+
1959
+ clobber: clean
1960
+ -rm -f $(BUILDPYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
1961
+ tags TAGS \
1962
+ config.cache config.log pyconfig.h Modules/config.c
1963
+ -rm -rf build platform
1964
+ -rm -rf $(PYTHONFRAMEWORKDIR)
1965
+ -rm -f python-config.py python-config
1966
+
1967
+ # Make things extra clean, before making a distribution:
1968
+ # remove all generated files, even Makefile[.pre]
1969
+ # Keep configure and Python-ast.[ch], it's possible they can't be generated
1970
+ distclean: clobber docclean
1971
+ for file in $(srcdir)/Lib/test/data/* ; do \
1972
+ if test "$$file" != "$(srcdir)/Lib/test/data/README"; then rm "$$file"; fi; \
1973
+ done
1974
+ -rm -f core Makefile Makefile.pre config.status Modules/Setup.local \
1975
+ Modules/ld_so_aix Modules/python.exp Misc/python.pc \
1976
+ Misc/python-embed.pc Misc/python-config.sh
1977
+ -rm -f python*-gdb.py
1978
+ # Issue #28258: set LC_ALL to avoid issues with Estonian locale.
1979
+ # Expansion is performed here by shell (spawned by make) itself before
1980
+ # arguments are passed to find. So LC_ALL=C must be set as a separate
1981
+ # command.
1982
+ LC_ALL=C; find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
1983
+ -o -name '[@,#]*' -o -name '*.old' \
1984
+ -o -name '*.orig' -o -name '*.rej' \
1985
+ -o -name '*.bak' ')' \
1986
+ -exec rm -f {} ';'
1987
+
1988
+ # Check that all symbols exported by libpython start with "Py" or "_Py"
1989
+ smelly: build_all
1990
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/smelly.py
1991
+
1992
+ # Find files with funny names
1993
+ funny:
1994
+ find $(SUBDIRS) $(SUBDIRSTOO) \
1995
+ -type d \
1996
+ -o -name '*.[chs]' \
1997
+ -o -name '*.py' \
1998
+ -o -name '*.pyw' \
1999
+ -o -name '*.dat' \
2000
+ -o -name '*.el' \
2001
+ -o -name '*.fd' \
2002
+ -o -name '*.in' \
2003
+ -o -name '*.gif' \
2004
+ -o -name '*.txt' \
2005
+ -o -name '*.xml' \
2006
+ -o -name '*.xbm' \
2007
+ -o -name '*.xpm' \
2008
+ -o -name '*.uue' \
2009
+ -o -name '*.decTest' \
2010
+ -o -name '*.tmCommand' \
2011
+ -o -name '*.tmSnippet' \
2012
+ -o -name 'Setup' \
2013
+ -o -name 'Setup.*' \
2014
+ -o -name README \
2015
+ -o -name NEWS \
2016
+ -o -name HISTORY \
2017
+ -o -name Makefile \
2018
+ -o -name ChangeLog \
2019
+ -o -name .hgignore \
2020
+ -o -name MANIFEST \
2021
+ -o -print
2022
+
2023
+ # Perform some verification checks on any modified files.
2024
+ patchcheck: build_all
2025
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
2026
+
2027
+ check-limited-abi: all
2028
+ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/stable_abi.py --all $(srcdir)/Misc/stable_abi.txt
2029
+
2030
+ .PHONY: update-config
2031
+ update-config:
2032
+ curl -sL -o config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
2033
+ curl -sL -o config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'
2034
+ chmod +x config.guess config.sub
2035
+
2036
+ # Dependencies
2037
+
2038
+ Python/thread.o: $(srcdir)/Python/thread_nt.h $(srcdir)/Python/thread_pthread.h $(srcdir)/Python/condvar.h
2039
+
2040
+ # Declare targets that aren't real files
2041
+ .PHONY: all build_all sharedmods check-clean-src oldsharedmods test quicktest
2042
+ .PHONY: install altinstall oldsharedinstall bininstall altbininstall
2043
+ .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
2044
+ .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
2045
+ .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
2046
+ .PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
2047
+ .PHONY: smelly funny patchcheck touch altmaninstall commoninstall
2048
+ .PHONY: clean-retain-profile profile-removal run_profile_task
2049
+ .PHONY: build_all_generate_profile build_all_merge_profile
2050
+ .PHONY: gdbhooks
2051
+
2052
+ # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
2053
+ # Local Variables:
2054
+ # mode: makefile
2055
+ # End:
2056
+
2057
+ # Rules appended by makesetup
2058
+
2059
+ Modules/posixmodule.o: $(srcdir)/Modules/posixmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -c $(srcdir)/Modules/posixmodule.c -o Modules/posixmodule.o
2060
+ Modules/posix$(EXT_SUFFIX): Modules/posixmodule.o; $(BLDSHARED) Modules/posixmodule.o -o Modules/posix$(EXT_SUFFIX)
2061
+ Modules/errnomodule.o: $(srcdir)/Modules/errnomodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/errnomodule.c -o Modules/errnomodule.o
2062
+ Modules/errno$(EXT_SUFFIX): Modules/errnomodule.o; $(BLDSHARED) Modules/errnomodule.o -o Modules/errno$(EXT_SUFFIX)
2063
+ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/pwdmodule.c -o Modules/pwdmodule.o
2064
+ Modules/pwd$(EXT_SUFFIX): Modules/pwdmodule.o; $(BLDSHARED) Modules/pwdmodule.o -o Modules/pwd$(EXT_SUFFIX)
2065
+ Modules/_sre.o: $(srcdir)/Modules/_sre.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -c $(srcdir)/Modules/_sre.c -o Modules/_sre.o
2066
+ Modules/_sre$(EXT_SUFFIX): Modules/_sre.o; $(BLDSHARED) Modules/_sre.o -o Modules/_sre$(EXT_SUFFIX)
2067
+ Modules/_codecsmodule.o: $(srcdir)/Modules/_codecsmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/_codecsmodule.c -o Modules/_codecsmodule.o
2068
+ Modules/_codecs$(EXT_SUFFIX): Modules/_codecsmodule.o; $(BLDSHARED) Modules/_codecsmodule.o -o Modules/_codecs$(EXT_SUFFIX)
2069
+ Modules/_weakref.o: $(srcdir)/Modules/_weakref.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/_weakref.c -o Modules/_weakref.o
2070
+ Modules/_weakref$(EXT_SUFFIX): Modules/_weakref.o; $(BLDSHARED) Modules/_weakref.o -o Modules/_weakref$(EXT_SUFFIX)
2071
+ Modules/_functoolsmodule.o: $(srcdir)/Modules/_functoolsmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -c $(srcdir)/Modules/_functoolsmodule.c -o Modules/_functoolsmodule.o
2072
+ Modules/_functools$(EXT_SUFFIX): Modules/_functoolsmodule.o; $(BLDSHARED) Modules/_functoolsmodule.o -o Modules/_functools$(EXT_SUFFIX)
2073
+ Modules/_operator.o: $(srcdir)/Modules/_operator.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -c $(srcdir)/Modules/_operator.c -o Modules/_operator.o
2074
+ Modules/_operator$(EXT_SUFFIX): Modules/_operator.o; $(BLDSHARED) Modules/_operator.o -o Modules/_operator$(EXT_SUFFIX)
2075
+ Modules/_collectionsmodule.o: $(srcdir)/Modules/_collectionsmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/_collectionsmodule.c -o Modules/_collectionsmodule.o
2076
+ Modules/_collections$(EXT_SUFFIX): Modules/_collectionsmodule.o; $(BLDSHARED) Modules/_collectionsmodule.o -o Modules/_collections$(EXT_SUFFIX)
2077
+ Modules/_abc.o: $(srcdir)/Modules/_abc.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -c $(srcdir)/Modules/_abc.c -o Modules/_abc.o
2078
+ Modules/_abc$(EXT_SUFFIX): Modules/_abc.o; $(BLDSHARED) Modules/_abc.o -o Modules/_abc$(EXT_SUFFIX)
2079
+ Modules/itertoolsmodule.o: $(srcdir)/Modules/itertoolsmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/itertoolsmodule.c -o Modules/itertoolsmodule.o
2080
+ Modules/itertools$(EXT_SUFFIX): Modules/itertoolsmodule.o; $(BLDSHARED) Modules/itertoolsmodule.o -o Modules/itertools$(EXT_SUFFIX)
2081
+ Modules/atexitmodule.o: $(srcdir)/Modules/atexitmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/atexitmodule.c -o Modules/atexitmodule.o
2082
+ Modules/atexit$(EXT_SUFFIX): Modules/atexitmodule.o; $(BLDSHARED) Modules/atexitmodule.o -o Modules/atexit$(EXT_SUFFIX)
2083
+ Modules/signalmodule.o: $(srcdir)/Modules/signalmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -c $(srcdir)/Modules/signalmodule.c -o Modules/signalmodule.o
2084
+ Modules/_signal$(EXT_SUFFIX): Modules/signalmodule.o; $(BLDSHARED) Modules/signalmodule.o -o Modules/_signal$(EXT_SUFFIX)
2085
+ Modules/_stat.o: $(srcdir)/Modules/_stat.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/_stat.c -o Modules/_stat.o
2086
+ Modules/_stat$(EXT_SUFFIX): Modules/_stat.o; $(BLDSHARED) Modules/_stat.o -o Modules/_stat$(EXT_SUFFIX)
2087
+ Modules/timemodule.o: $(srcdir)/Modules/timemodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -c $(srcdir)/Modules/timemodule.c -o Modules/timemodule.o
2088
+ Modules/time$(EXT_SUFFIX): Modules/timemodule.o; $(BLDSHARED) Modules/timemodule.o -o Modules/time$(EXT_SUFFIX)
2089
+ Modules/_threadmodule.o: $(srcdir)/Modules/_threadmodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -c $(srcdir)/Modules/_threadmodule.c -o Modules/_threadmodule.o
2090
+ Modules/_thread$(EXT_SUFFIX): Modules/_threadmodule.o; $(BLDSHARED) Modules/_threadmodule.o -o Modules/_thread$(EXT_SUFFIX)
2091
+ Modules/_localemodule.o: $(srcdir)/Modules/_localemodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -c $(srcdir)/Modules/_localemodule.c -o Modules/_localemodule.o
2092
+ Modules/_locale$(EXT_SUFFIX): Modules/_localemodule.o; $(BLDSHARED) Modules/_localemodule.o -o Modules/_locale$(EXT_SUFFIX)
2093
+ Modules/_iomodule.o: $(srcdir)/Modules/_io/_iomodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io -c $(srcdir)/Modules/_io/_iomodule.c -o Modules/_iomodule.o
2094
+ Modules/iobase.o: $(srcdir)/Modules/_io/iobase.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io -c $(srcdir)/Modules/_io/iobase.c -o Modules/iobase.o
2095
+ Modules/fileio.o: $(srcdir)/Modules/_io/fileio.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io -c $(srcdir)/Modules/_io/fileio.c -o Modules/fileio.o
2096
+ Modules/bytesio.o: $(srcdir)/Modules/_io/bytesio.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io -c $(srcdir)/Modules/_io/bytesio.c -o Modules/bytesio.o
2097
+ Modules/bufferedio.o: $(srcdir)/Modules/_io/bufferedio.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io -c $(srcdir)/Modules/_io/bufferedio.c -o Modules/bufferedio.o
2098
+ Modules/textio.o: $(srcdir)/Modules/_io/textio.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io -c $(srcdir)/Modules/_io/textio.c -o Modules/textio.o
2099
+ Modules/stringio.o: $(srcdir)/Modules/_io/stringio.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io -c $(srcdir)/Modules/_io/stringio.c -o Modules/stringio.o
2100
+ Modules/_io$(EXT_SUFFIX): Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o; $(BLDSHARED) Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o -o Modules/_io$(EXT_SUFFIX)
2101
+ Modules/faulthandler.o: $(srcdir)/Modules/faulthandler.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/faulthandler.c -o Modules/faulthandler.o
2102
+ Modules/faulthandler$(EXT_SUFFIX): Modules/faulthandler.o; $(BLDSHARED) Modules/faulthandler.o -o Modules/faulthandler$(EXT_SUFFIX)
2103
+ Modules/_tracemalloc.o: $(srcdir)/Modules/_tracemalloc.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/_tracemalloc.c -o Modules/_tracemalloc.o
2104
+ Modules/_tracemalloc$(EXT_SUFFIX): Modules/_tracemalloc.o; $(BLDSHARED) Modules/_tracemalloc.o -o Modules/_tracemalloc$(EXT_SUFFIX)
2105
+ Modules/symtablemodule.o: $(srcdir)/Modules/symtablemodule.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/symtablemodule.c -o Modules/symtablemodule.o
2106
+ Modules/_symtable$(EXT_SUFFIX): Modules/symtablemodule.o; $(BLDSHARED) Modules/symtablemodule.o -o Modules/_symtable$(EXT_SUFFIX)
2107
+ Modules/xxsubtype.o: $(srcdir)/Modules/xxsubtype.c; $(CC) $(PY_BUILTIN_MODULE_CFLAGS) -c $(srcdir)/Modules/xxsubtype.c -o Modules/xxsubtype.o
2108
+ Modules/xxsubtype$(EXT_SUFFIX): Modules/xxsubtype.o; $(BLDSHARED) Modules/xxsubtype.o -o Modules/xxsubtype$(EXT_SUFFIX)
evalkit_cambrian/lib/python3.10/config-3.10-x86_64-linux-gnu/config.c.in ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* -*- C -*- ***********************************************
2
+ Copyright (c) 2000, BeOpen.com.
3
+ Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4
+ Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5
+ All rights reserved.
6
+
7
+ See the file "Misc/COPYRIGHT" for information on usage and
8
+ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9
+ ******************************************************************/
10
+
11
+ /* Module configuration */
12
+
13
+ /* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */
14
+
15
+ /* This file contains the table of built-in modules.
16
+ See create_builtin() in import.c. */
17
+
18
+ #include "Python.h"
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+
25
+ /* -- ADDMODULE MARKER 1 -- */
26
+
27
+ extern PyObject* PyMarshal_Init(void);
28
+ extern PyObject* PyInit__imp(void);
29
+ extern PyObject* PyInit_gc(void);
30
+ extern PyObject* PyInit__ast(void);
31
+ extern PyObject* _PyWarnings_Init(void);
32
+ extern PyObject* PyInit__string(void);
33
+
34
+ struct _inittab _PyImport_Inittab[] = {
35
+
36
+ /* -- ADDMODULE MARKER 2 -- */
37
+
38
+ /* This module lives in marshal.c */
39
+ {"marshal", PyMarshal_Init},
40
+
41
+ /* This lives in import.c */
42
+ {"_imp", PyInit__imp},
43
+
44
+ /* This lives in Python/Python-ast.c */
45
+ {"_ast", PyInit__ast},
46
+
47
+ /* These entries are here for sys.builtin_module_names */
48
+ {"builtins", NULL},
49
+ {"sys", NULL},
50
+
51
+ /* This lives in gcmodule.c */
52
+ {"gc", PyInit_gc},
53
+
54
+ /* This lives in _warnings.c */
55
+ {"_warnings", _PyWarnings_Init},
56
+
57
+ /* This lives in Objects/unicodeobject.c */
58
+ {"_string", PyInit__string},
59
+
60
+ /* Sentinel */
61
+ {0, 0}
62
+ };
63
+
64
+
65
+ #ifdef __cplusplus
66
+ }
67
+ #endif
evalkit_cambrian/lib/python3.10/config-3.10-x86_64-linux-gnu/python.o ADDED
Binary file (10.7 kB). View file
 
evalkit_cambrian/lib/python3.10/ctypes/__init__.py ADDED
@@ -0,0 +1,563 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """create and manipulate C data types in Python"""
2
+
3
+ import os as _os, sys as _sys
4
+ import types as _types
5
+
6
+ __version__ = "1.1.0"
7
+
8
+ from _ctypes import Union, Structure, Array
9
+ from _ctypes import _Pointer
10
+ from _ctypes import CFuncPtr as _CFuncPtr
11
+ from _ctypes import __version__ as _ctypes_version
12
+ from _ctypes import RTLD_LOCAL, RTLD_GLOBAL
13
+ from _ctypes import ArgumentError
14
+
15
+ from struct import calcsize as _calcsize
16
+
17
+ if __version__ != _ctypes_version:
18
+ raise Exception("Version number mismatch", __version__, _ctypes_version)
19
+
20
+ if _os.name == "nt":
21
+ from _ctypes import FormatError
22
+
23
+ DEFAULT_MODE = RTLD_LOCAL
24
+ if _os.name == "posix" and _sys.platform == "darwin":
25
+ # On OS X 10.3, we use RTLD_GLOBAL as default mode
26
+ # because RTLD_LOCAL does not work at least on some
27
+ # libraries. OS X 10.3 is Darwin 7, so we check for
28
+ # that.
29
+
30
+ if int(_os.uname().release.split('.')[0]) < 8:
31
+ DEFAULT_MODE = RTLD_GLOBAL
32
+
33
+ from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \
34
+ FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI, \
35
+ FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \
36
+ FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR
37
+
38
+ # WINOLEAPI -> HRESULT
39
+ # WINOLEAPI_(type)
40
+ #
41
+ # STDMETHODCALLTYPE
42
+ #
43
+ # STDMETHOD(name)
44
+ # STDMETHOD_(type, name)
45
+ #
46
+ # STDAPICALLTYPE
47
+
48
+ def create_string_buffer(init, size=None):
49
+ """create_string_buffer(aBytes) -> character array
50
+ create_string_buffer(anInteger) -> character array
51
+ create_string_buffer(aBytes, anInteger) -> character array
52
+ """
53
+ if isinstance(init, bytes):
54
+ if size is None:
55
+ size = len(init)+1
56
+ _sys.audit("ctypes.create_string_buffer", init, size)
57
+ buftype = c_char * size
58
+ buf = buftype()
59
+ buf.value = init
60
+ return buf
61
+ elif isinstance(init, int):
62
+ _sys.audit("ctypes.create_string_buffer", None, init)
63
+ buftype = c_char * init
64
+ buf = buftype()
65
+ return buf
66
+ raise TypeError(init)
67
+
68
+ def c_buffer(init, size=None):
69
+ ## "deprecated, use create_string_buffer instead"
70
+ ## import warnings
71
+ ## warnings.warn("c_buffer is deprecated, use create_string_buffer instead",
72
+ ## DeprecationWarning, stacklevel=2)
73
+ return create_string_buffer(init, size)
74
+
75
+ _c_functype_cache = {}
76
+ def CFUNCTYPE(restype, *argtypes, **kw):
77
+ """CFUNCTYPE(restype, *argtypes,
78
+ use_errno=False, use_last_error=False) -> function prototype.
79
+
80
+ restype: the result type
81
+ argtypes: a sequence specifying the argument types
82
+
83
+ The function prototype can be called in different ways to create a
84
+ callable object:
85
+
86
+ prototype(integer address) -> foreign function
87
+ prototype(callable) -> create and return a C callable function from callable
88
+ prototype(integer index, method name[, paramflags]) -> foreign function calling a COM method
89
+ prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal
90
+ prototype((function name, dll object)[, paramflags]) -> foreign function exported by name
91
+ """
92
+ flags = _FUNCFLAG_CDECL
93
+ if kw.pop("use_errno", False):
94
+ flags |= _FUNCFLAG_USE_ERRNO
95
+ if kw.pop("use_last_error", False):
96
+ flags |= _FUNCFLAG_USE_LASTERROR
97
+ if kw:
98
+ raise ValueError("unexpected keyword argument(s) %s" % kw.keys())
99
+ try:
100
+ return _c_functype_cache[(restype, argtypes, flags)]
101
+ except KeyError:
102
+ class CFunctionType(_CFuncPtr):
103
+ _argtypes_ = argtypes
104
+ _restype_ = restype
105
+ _flags_ = flags
106
+ _c_functype_cache[(restype, argtypes, flags)] = CFunctionType
107
+ return CFunctionType
108
+
109
+ if _os.name == "nt":
110
+ from _ctypes import LoadLibrary as _dlopen
111
+ from _ctypes import FUNCFLAG_STDCALL as _FUNCFLAG_STDCALL
112
+
113
+ _win_functype_cache = {}
114
+ def WINFUNCTYPE(restype, *argtypes, **kw):
115
+ # docstring set later (very similar to CFUNCTYPE.__doc__)
116
+ flags = _FUNCFLAG_STDCALL
117
+ if kw.pop("use_errno", False):
118
+ flags |= _FUNCFLAG_USE_ERRNO
119
+ if kw.pop("use_last_error", False):
120
+ flags |= _FUNCFLAG_USE_LASTERROR
121
+ if kw:
122
+ raise ValueError("unexpected keyword argument(s) %s" % kw.keys())
123
+ try:
124
+ return _win_functype_cache[(restype, argtypes, flags)]
125
+ except KeyError:
126
+ class WinFunctionType(_CFuncPtr):
127
+ _argtypes_ = argtypes
128
+ _restype_ = restype
129
+ _flags_ = flags
130
+ _win_functype_cache[(restype, argtypes, flags)] = WinFunctionType
131
+ return WinFunctionType
132
+ if WINFUNCTYPE.__doc__:
133
+ WINFUNCTYPE.__doc__ = CFUNCTYPE.__doc__.replace("CFUNCTYPE", "WINFUNCTYPE")
134
+
135
+ elif _os.name == "posix":
136
+ from _ctypes import dlopen as _dlopen
137
+
138
+ from _ctypes import sizeof, byref, addressof, alignment, resize
139
+ from _ctypes import get_errno, set_errno
140
+ from _ctypes import _SimpleCData
141
+
142
+ def _check_size(typ, typecode=None):
143
+ # Check if sizeof(ctypes_type) against struct.calcsize. This
144
+ # should protect somewhat against a misconfigured libffi.
145
+ from struct import calcsize
146
+ if typecode is None:
147
+ # Most _type_ codes are the same as used in struct
148
+ typecode = typ._type_
149
+ actual, required = sizeof(typ), calcsize(typecode)
150
+ if actual != required:
151
+ raise SystemError("sizeof(%s) wrong: %d instead of %d" % \
152
+ (typ, actual, required))
153
+
154
+ class py_object(_SimpleCData):
155
+ _type_ = "O"
156
+ def __repr__(self):
157
+ try:
158
+ return super().__repr__()
159
+ except ValueError:
160
+ return "%s(<NULL>)" % type(self).__name__
161
+ _check_size(py_object, "P")
162
+
163
+ class c_short(_SimpleCData):
164
+ _type_ = "h"
165
+ _check_size(c_short)
166
+
167
+ class c_ushort(_SimpleCData):
168
+ _type_ = "H"
169
+ _check_size(c_ushort)
170
+
171
+ class c_long(_SimpleCData):
172
+ _type_ = "l"
173
+ _check_size(c_long)
174
+
175
+ class c_ulong(_SimpleCData):
176
+ _type_ = "L"
177
+ _check_size(c_ulong)
178
+
179
+ if _calcsize("i") == _calcsize("l"):
180
+ # if int and long have the same size, make c_int an alias for c_long
181
+ c_int = c_long
182
+ c_uint = c_ulong
183
+ else:
184
+ class c_int(_SimpleCData):
185
+ _type_ = "i"
186
+ _check_size(c_int)
187
+
188
+ class c_uint(_SimpleCData):
189
+ _type_ = "I"
190
+ _check_size(c_uint)
191
+
192
+ class c_float(_SimpleCData):
193
+ _type_ = "f"
194
+ _check_size(c_float)
195
+
196
+ class c_double(_SimpleCData):
197
+ _type_ = "d"
198
+ _check_size(c_double)
199
+
200
+ class c_longdouble(_SimpleCData):
201
+ _type_ = "g"
202
+ if sizeof(c_longdouble) == sizeof(c_double):
203
+ c_longdouble = c_double
204
+
205
+ if _calcsize("l") == _calcsize("q"):
206
+ # if long and long long have the same size, make c_longlong an alias for c_long
207
+ c_longlong = c_long
208
+ c_ulonglong = c_ulong
209
+ else:
210
+ class c_longlong(_SimpleCData):
211
+ _type_ = "q"
212
+ _check_size(c_longlong)
213
+
214
+ class c_ulonglong(_SimpleCData):
215
+ _type_ = "Q"
216
+ ## def from_param(cls, val):
217
+ ## return ('d', float(val), val)
218
+ ## from_param = classmethod(from_param)
219
+ _check_size(c_ulonglong)
220
+
221
+ class c_ubyte(_SimpleCData):
222
+ _type_ = "B"
223
+ c_ubyte.__ctype_le__ = c_ubyte.__ctype_be__ = c_ubyte
224
+ # backward compatibility:
225
+ ##c_uchar = c_ubyte
226
+ _check_size(c_ubyte)
227
+
228
+ class c_byte(_SimpleCData):
229
+ _type_ = "b"
230
+ c_byte.__ctype_le__ = c_byte.__ctype_be__ = c_byte
231
+ _check_size(c_byte)
232
+
233
+ class c_char(_SimpleCData):
234
+ _type_ = "c"
235
+ c_char.__ctype_le__ = c_char.__ctype_be__ = c_char
236
+ _check_size(c_char)
237
+
238
+ class c_char_p(_SimpleCData):
239
+ _type_ = "z"
240
+ def __repr__(self):
241
+ return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value)
242
+ _check_size(c_char_p, "P")
243
+
244
+ class c_void_p(_SimpleCData):
245
+ _type_ = "P"
246
+ c_voidp = c_void_p # backwards compatibility (to a bug)
247
+ _check_size(c_void_p)
248
+
249
+ class c_bool(_SimpleCData):
250
+ _type_ = "?"
251
+
252
+ from _ctypes import POINTER, pointer, _pointer_type_cache
253
+
254
+ class c_wchar_p(_SimpleCData):
255
+ _type_ = "Z"
256
+ def __repr__(self):
257
+ return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value)
258
+
259
+ class c_wchar(_SimpleCData):
260
+ _type_ = "u"
261
+
262
+ def _reset_cache():
263
+ _pointer_type_cache.clear()
264
+ _c_functype_cache.clear()
265
+ if _os.name == "nt":
266
+ _win_functype_cache.clear()
267
+ # _SimpleCData.c_wchar_p_from_param
268
+ POINTER(c_wchar).from_param = c_wchar_p.from_param
269
+ # _SimpleCData.c_char_p_from_param
270
+ POINTER(c_char).from_param = c_char_p.from_param
271
+ _pointer_type_cache[None] = c_void_p
272
+
273
+ def create_unicode_buffer(init, size=None):
274
+ """create_unicode_buffer(aString) -> character array
275
+ create_unicode_buffer(anInteger) -> character array
276
+ create_unicode_buffer(aString, anInteger) -> character array
277
+ """
278
+ if isinstance(init, str):
279
+ if size is None:
280
+ if sizeof(c_wchar) == 2:
281
+ # UTF-16 requires a surrogate pair (2 wchar_t) for non-BMP
282
+ # characters (outside [U+0000; U+FFFF] range). +1 for trailing
283
+ # NUL character.
284
+ size = sum(2 if ord(c) > 0xFFFF else 1 for c in init) + 1
285
+ else:
286
+ # 32-bit wchar_t (1 wchar_t per Unicode character). +1 for
287
+ # trailing NUL character.
288
+ size = len(init) + 1
289
+ _sys.audit("ctypes.create_unicode_buffer", init, size)
290
+ buftype = c_wchar * size
291
+ buf = buftype()
292
+ buf.value = init
293
+ return buf
294
+ elif isinstance(init, int):
295
+ _sys.audit("ctypes.create_unicode_buffer", None, init)
296
+ buftype = c_wchar * init
297
+ buf = buftype()
298
+ return buf
299
+ raise TypeError(init)
300
+
301
+
302
+ # XXX Deprecated
303
+ def SetPointerType(pointer, cls):
304
+ if _pointer_type_cache.get(cls, None) is not None:
305
+ raise RuntimeError("This type already exists in the cache")
306
+ if id(pointer) not in _pointer_type_cache:
307
+ raise RuntimeError("What's this???")
308
+ pointer.set_type(cls)
309
+ _pointer_type_cache[cls] = pointer
310
+ del _pointer_type_cache[id(pointer)]
311
+
312
+ # XXX Deprecated
313
+ def ARRAY(typ, len):
314
+ return typ * len
315
+
316
+ ################################################################
317
+
318
+
319
+ class CDLL(object):
320
+ """An instance of this class represents a loaded dll/shared
321
+ library, exporting functions using the standard C calling
322
+ convention (named 'cdecl' on Windows).
323
+
324
+ The exported functions can be accessed as attributes, or by
325
+ indexing with the function name. Examples:
326
+
327
+ <obj>.qsort -> callable object
328
+ <obj>['qsort'] -> callable object
329
+
330
+ Calling the functions releases the Python GIL during the call and
331
+ reacquires it afterwards.
332
+ """
333
+ _func_flags_ = _FUNCFLAG_CDECL
334
+ _func_restype_ = c_int
335
+ # default values for repr
336
+ _name = '<uninitialized>'
337
+ _handle = 0
338
+ _FuncPtr = None
339
+
340
+ def __init__(self, name, mode=DEFAULT_MODE, handle=None,
341
+ use_errno=False,
342
+ use_last_error=False,
343
+ winmode=None):
344
+ self._name = name
345
+ flags = self._func_flags_
346
+ if use_errno:
347
+ flags |= _FUNCFLAG_USE_ERRNO
348
+ if use_last_error:
349
+ flags |= _FUNCFLAG_USE_LASTERROR
350
+ if _sys.platform.startswith("aix"):
351
+ """When the name contains ".a(" and ends with ")",
352
+ e.g., "libFOO.a(libFOO.so)" - this is taken to be an
353
+ archive(member) syntax for dlopen(), and the mode is adjusted.
354
+ Otherwise, name is presented to dlopen() as a file argument.
355
+ """
356
+ if name and name.endswith(")") and ".a(" in name:
357
+ mode |= ( _os.RTLD_MEMBER | _os.RTLD_NOW )
358
+ if _os.name == "nt":
359
+ if winmode is not None:
360
+ mode = winmode
361
+ else:
362
+ import nt
363
+ mode = nt._LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
364
+ if '/' in name or '\\' in name:
365
+ self._name = nt._getfullpathname(self._name)
366
+ mode |= nt._LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
367
+
368
+ class _FuncPtr(_CFuncPtr):
369
+ _flags_ = flags
370
+ _restype_ = self._func_restype_
371
+ self._FuncPtr = _FuncPtr
372
+
373
+ if handle is None:
374
+ self._handle = _dlopen(self._name, mode)
375
+ else:
376
+ self._handle = handle
377
+
378
+ def __repr__(self):
379
+ return "<%s '%s', handle %x at %#x>" % \
380
+ (self.__class__.__name__, self._name,
381
+ (self._handle & (_sys.maxsize*2 + 1)),
382
+ id(self) & (_sys.maxsize*2 + 1))
383
+
384
+ def __getattr__(self, name):
385
+ if name.startswith('__') and name.endswith('__'):
386
+ raise AttributeError(name)
387
+ func = self.__getitem__(name)
388
+ setattr(self, name, func)
389
+ return func
390
+
391
+ def __getitem__(self, name_or_ordinal):
392
+ func = self._FuncPtr((name_or_ordinal, self))
393
+ if not isinstance(name_or_ordinal, int):
394
+ func.__name__ = name_or_ordinal
395
+ return func
396
+
397
+ class PyDLL(CDLL):
398
+ """This class represents the Python library itself. It allows
399
+ accessing Python API functions. The GIL is not released, and
400
+ Python exceptions are handled correctly.
401
+ """
402
+ _func_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI
403
+
404
+ if _os.name == "nt":
405
+
406
+ class WinDLL(CDLL):
407
+ """This class represents a dll exporting functions using the
408
+ Windows stdcall calling convention.
409
+ """
410
+ _func_flags_ = _FUNCFLAG_STDCALL
411
+
412
+ # XXX Hm, what about HRESULT as normal parameter?
413
+ # Mustn't it derive from c_long then?
414
+ from _ctypes import _check_HRESULT, _SimpleCData
415
+ class HRESULT(_SimpleCData):
416
+ _type_ = "l"
417
+ # _check_retval_ is called with the function's result when it
418
+ # is used as restype. It checks for the FAILED bit, and
419
+ # raises an OSError if it is set.
420
+ #
421
+ # The _check_retval_ method is implemented in C, so that the
422
+ # method definition itself is not included in the traceback
423
+ # when it raises an error - that is what we want (and Python
424
+ # doesn't have a way to raise an exception in the caller's
425
+ # frame).
426
+ _check_retval_ = _check_HRESULT
427
+
428
+ class OleDLL(CDLL):
429
+ """This class represents a dll exporting functions using the
430
+ Windows stdcall calling convention, and returning HRESULT.
431
+ HRESULT error values are automatically raised as OSError
432
+ exceptions.
433
+ """
434
+ _func_flags_ = _FUNCFLAG_STDCALL
435
+ _func_restype_ = HRESULT
436
+
437
+ class LibraryLoader(object):
438
+ def __init__(self, dlltype):
439
+ self._dlltype = dlltype
440
+
441
+ def __getattr__(self, name):
442
+ if name[0] == '_':
443
+ raise AttributeError(name)
444
+ dll = self._dlltype(name)
445
+ setattr(self, name, dll)
446
+ return dll
447
+
448
+ def __getitem__(self, name):
449
+ return getattr(self, name)
450
+
451
+ def LoadLibrary(self, name):
452
+ return self._dlltype(name)
453
+
454
+ __class_getitem__ = classmethod(_types.GenericAlias)
455
+
456
+ cdll = LibraryLoader(CDLL)
457
+ pydll = LibraryLoader(PyDLL)
458
+
459
+ if _os.name == "nt":
460
+ pythonapi = PyDLL("python dll", None, _sys.dllhandle)
461
+ elif _sys.platform == "cygwin":
462
+ pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
463
+ else:
464
+ pythonapi = PyDLL(None)
465
+
466
+
467
+ if _os.name == "nt":
468
+ windll = LibraryLoader(WinDLL)
469
+ oledll = LibraryLoader(OleDLL)
470
+
471
+ GetLastError = windll.kernel32.GetLastError
472
+ from _ctypes import get_last_error, set_last_error
473
+
474
+ def WinError(code=None, descr=None):
475
+ if code is None:
476
+ code = GetLastError()
477
+ if descr is None:
478
+ descr = FormatError(code).strip()
479
+ return OSError(None, descr, None, code)
480
+
481
+ if sizeof(c_uint) == sizeof(c_void_p):
482
+ c_size_t = c_uint
483
+ c_ssize_t = c_int
484
+ elif sizeof(c_ulong) == sizeof(c_void_p):
485
+ c_size_t = c_ulong
486
+ c_ssize_t = c_long
487
+ elif sizeof(c_ulonglong) == sizeof(c_void_p):
488
+ c_size_t = c_ulonglong
489
+ c_ssize_t = c_longlong
490
+
491
+ # functions
492
+
493
+ from _ctypes import _memmove_addr, _memset_addr, _string_at_addr, _cast_addr
494
+
495
+ ## void *memmove(void *, const void *, size_t);
496
+ memmove = CFUNCTYPE(c_void_p, c_void_p, c_void_p, c_size_t)(_memmove_addr)
497
+
498
+ ## void *memset(void *, int, size_t)
499
+ memset = CFUNCTYPE(c_void_p, c_void_p, c_int, c_size_t)(_memset_addr)
500
+
501
+ def PYFUNCTYPE(restype, *argtypes):
502
+ class CFunctionType(_CFuncPtr):
503
+ _argtypes_ = argtypes
504
+ _restype_ = restype
505
+ _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI
506
+ return CFunctionType
507
+
508
+ _cast = PYFUNCTYPE(py_object, c_void_p, py_object, py_object)(_cast_addr)
509
+ def cast(obj, typ):
510
+ return _cast(obj, obj, typ)
511
+
512
+ _string_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_string_at_addr)
513
+ def string_at(ptr, size=-1):
514
+ """string_at(addr[, size]) -> string
515
+
516
+ Return the string at addr."""
517
+ return _string_at(ptr, size)
518
+
519
+ try:
520
+ from _ctypes import _wstring_at_addr
521
+ except ImportError:
522
+ pass
523
+ else:
524
+ _wstring_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_wstring_at_addr)
525
+ def wstring_at(ptr, size=-1):
526
+ """wstring_at(addr[, size]) -> string
527
+
528
+ Return the string at addr."""
529
+ return _wstring_at(ptr, size)
530
+
531
+
532
+ if _os.name == "nt": # COM stuff
533
+ def DllGetClassObject(rclsid, riid, ppv):
534
+ try:
535
+ ccom = __import__("comtypes.server.inprocserver", globals(), locals(), ['*'])
536
+ except ImportError:
537
+ return -2147221231 # CLASS_E_CLASSNOTAVAILABLE
538
+ else:
539
+ return ccom.DllGetClassObject(rclsid, riid, ppv)
540
+
541
+ def DllCanUnloadNow():
542
+ try:
543
+ ccom = __import__("comtypes.server.inprocserver", globals(), locals(), ['*'])
544
+ except ImportError:
545
+ return 0 # S_OK
546
+ return ccom.DllCanUnloadNow()
547
+
548
+ from ctypes._endian import BigEndianStructure, LittleEndianStructure
549
+
550
+ # Fill in specifically-sized types
551
+ c_int8 = c_byte
552
+ c_uint8 = c_ubyte
553
+ for kind in [c_short, c_int, c_long, c_longlong]:
554
+ if sizeof(kind) == 2: c_int16 = kind
555
+ elif sizeof(kind) == 4: c_int32 = kind
556
+ elif sizeof(kind) == 8: c_int64 = kind
557
+ for kind in [c_ushort, c_uint, c_ulong, c_ulonglong]:
558
+ if sizeof(kind) == 2: c_uint16 = kind
559
+ elif sizeof(kind) == 4: c_uint32 = kind
560
+ elif sizeof(kind) == 8: c_uint64 = kind
561
+ del(kind)
562
+
563
+ _reset_cache()
evalkit_cambrian/lib/python3.10/ctypes/util.py ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+ import subprocess
4
+ import sys
5
+
6
+ # find_library(name) returns the pathname of a library, or None.
7
+ if os.name == "nt":
8
+
9
+ def _get_build_version():
10
+ """Return the version of MSVC that was used to build Python.
11
+
12
+ For Python 2.3 and up, the version number is included in
13
+ sys.version. For earlier versions, assume the compiler is MSVC 6.
14
+ """
15
+ # This function was copied from Lib/distutils/msvccompiler.py
16
+ prefix = "MSC v."
17
+ i = sys.version.find(prefix)
18
+ if i == -1:
19
+ return 6
20
+ i = i + len(prefix)
21
+ s, rest = sys.version[i:].split(" ", 1)
22
+ majorVersion = int(s[:-2]) - 6
23
+ if majorVersion >= 13:
24
+ majorVersion += 1
25
+ minorVersion = int(s[2:3]) / 10.0
26
+ # I don't think paths are affected by minor version in version 6
27
+ if majorVersion == 6:
28
+ minorVersion = 0
29
+ if majorVersion >= 6:
30
+ return majorVersion + minorVersion
31
+ # else we don't know what version of the compiler this is
32
+ return None
33
+
34
+ def find_msvcrt():
35
+ """Return the name of the VC runtime dll"""
36
+ version = _get_build_version()
37
+ if version is None:
38
+ # better be safe than sorry
39
+ return None
40
+ if version <= 6:
41
+ clibname = 'msvcrt'
42
+ elif version <= 13:
43
+ clibname = 'msvcr%d' % (version * 10)
44
+ else:
45
+ # CRT is no longer directly loadable. See issue23606 for the
46
+ # discussion about alternative approaches.
47
+ return None
48
+
49
+ # If python was built with in debug mode
50
+ import importlib.machinery
51
+ if '_d.pyd' in importlib.machinery.EXTENSION_SUFFIXES:
52
+ clibname += 'd'
53
+ return clibname+'.dll'
54
+
55
+ def find_library(name):
56
+ if name in ('c', 'm'):
57
+ return find_msvcrt()
58
+ # See MSDN for the REAL search order.
59
+ for directory in os.environ['PATH'].split(os.pathsep):
60
+ fname = os.path.join(directory, name)
61
+ if os.path.isfile(fname):
62
+ return fname
63
+ if fname.lower().endswith(".dll"):
64
+ continue
65
+ fname = fname + ".dll"
66
+ if os.path.isfile(fname):
67
+ return fname
68
+ return None
69
+
70
+ elif os.name == "posix" and sys.platform == "darwin":
71
+ from ctypes.macholib.dyld import dyld_find as _dyld_find
72
+ def find_library(name):
73
+ possible = ['@executable_path/../lib/lib%s.dylib' % name,
74
+ 'lib%s.dylib' % name,
75
+ '%s.dylib' % name,
76
+ '%s.framework/%s' % (name, name)]
77
+ for name in possible:
78
+ try:
79
+ return _dyld_find(name)
80
+ except ValueError:
81
+ continue
82
+ return None
83
+
84
+ elif sys.platform.startswith("aix"):
85
+ # AIX has two styles of storing shared libraries
86
+ # GNU auto_tools refer to these as svr4 and aix
87
+ # svr4 (System V Release 4) is a regular file, often with .so as suffix
88
+ # AIX style uses an archive (suffix .a) with members (e.g., shr.o, libssl.so)
89
+ # see issue#26439 and _aix.py for more details
90
+
91
+ from ctypes._aix import find_library
92
+
93
+ elif os.name == "posix":
94
+ # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
95
+ import re, tempfile
96
+
97
+ def _is_elf(filename):
98
+ "Return True if the given file is an ELF file"
99
+ elf_header = b'\x7fELF'
100
+ with open(filename, 'br') as thefile:
101
+ return thefile.read(4) == elf_header
102
+
103
+ def _findLib_gcc(name):
104
+ # Run GCC's linker with the -t (aka --trace) option and examine the
105
+ # library name it prints out. The GCC command will fail because we
106
+ # haven't supplied a proper program with main(), but that does not
107
+ # matter.
108
+ expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
109
+
110
+ c_compiler = shutil.which('gcc')
111
+ if not c_compiler:
112
+ c_compiler = shutil.which('cc')
113
+ if not c_compiler:
114
+ # No C compiler available, give up
115
+ return None
116
+
117
+ temp = tempfile.NamedTemporaryFile()
118
+ try:
119
+ args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
120
+
121
+ env = dict(os.environ)
122
+ env['LC_ALL'] = 'C'
123
+ env['LANG'] = 'C'
124
+ try:
125
+ proc = subprocess.Popen(args,
126
+ stdout=subprocess.PIPE,
127
+ stderr=subprocess.STDOUT,
128
+ env=env)
129
+ except OSError: # E.g. bad executable
130
+ return None
131
+ with proc:
132
+ trace = proc.stdout.read()
133
+ finally:
134
+ try:
135
+ temp.close()
136
+ except FileNotFoundError:
137
+ # Raised if the file was already removed, which is the normal
138
+ # behaviour of GCC if linking fails
139
+ pass
140
+ res = re.findall(expr, trace)
141
+ if not res:
142
+ return None
143
+
144
+ for file in res:
145
+ # Check if the given file is an elf file: gcc can report
146
+ # some files that are linker scripts and not actual
147
+ # shared objects. See bpo-41976 for more details
148
+ if not _is_elf(file):
149
+ continue
150
+ return os.fsdecode(file)
151
+
152
+
153
+ if sys.platform == "sunos5":
154
+ # use /usr/ccs/bin/dump on solaris
155
+ def _get_soname(f):
156
+ if not f:
157
+ return None
158
+
159
+ try:
160
+ proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f),
161
+ stdout=subprocess.PIPE,
162
+ stderr=subprocess.DEVNULL)
163
+ except OSError: # E.g. command not found
164
+ return None
165
+ with proc:
166
+ data = proc.stdout.read()
167
+ res = re.search(br'\[.*\]\sSONAME\s+([^\s]+)', data)
168
+ if not res:
169
+ return None
170
+ return os.fsdecode(res.group(1))
171
+ else:
172
+ def _get_soname(f):
173
+ # assuming GNU binutils / ELF
174
+ if not f:
175
+ return None
176
+ objdump = shutil.which('objdump')
177
+ if not objdump:
178
+ # objdump is not available, give up
179
+ return None
180
+
181
+ try:
182
+ proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f),
183
+ stdout=subprocess.PIPE,
184
+ stderr=subprocess.DEVNULL)
185
+ except OSError: # E.g. bad executable
186
+ return None
187
+ with proc:
188
+ dump = proc.stdout.read()
189
+ res = re.search(br'\sSONAME\s+([^\s]+)', dump)
190
+ if not res:
191
+ return None
192
+ return os.fsdecode(res.group(1))
193
+
194
+ if sys.platform.startswith(("freebsd", "openbsd", "dragonfly")):
195
+
196
+ def _num_version(libname):
197
+ # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ]
198
+ parts = libname.split(b".")
199
+ nums = []
200
+ try:
201
+ while parts:
202
+ nums.insert(0, int(parts.pop()))
203
+ except ValueError:
204
+ pass
205
+ return nums or [sys.maxsize]
206
+
207
+ def find_library(name):
208
+ ename = re.escape(name)
209
+ expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename)
210
+ expr = os.fsencode(expr)
211
+
212
+ try:
213
+ proc = subprocess.Popen(('/sbin/ldconfig', '-r'),
214
+ stdout=subprocess.PIPE,
215
+ stderr=subprocess.DEVNULL)
216
+ except OSError: # E.g. command not found
217
+ data = b''
218
+ else:
219
+ with proc:
220
+ data = proc.stdout.read()
221
+
222
+ res = re.findall(expr, data)
223
+ if not res:
224
+ return _get_soname(_findLib_gcc(name))
225
+ res.sort(key=_num_version)
226
+ return os.fsdecode(res[-1])
227
+
228
+ elif sys.platform == "sunos5":
229
+
230
+ def _findLib_crle(name, is64):
231
+ if not os.path.exists('/usr/bin/crle'):
232
+ return None
233
+
234
+ env = dict(os.environ)
235
+ env['LC_ALL'] = 'C'
236
+
237
+ if is64:
238
+ args = ('/usr/bin/crle', '-64')
239
+ else:
240
+ args = ('/usr/bin/crle',)
241
+
242
+ paths = None
243
+ try:
244
+ proc = subprocess.Popen(args,
245
+ stdout=subprocess.PIPE,
246
+ stderr=subprocess.DEVNULL,
247
+ env=env)
248
+ except OSError: # E.g. bad executable
249
+ return None
250
+ with proc:
251
+ for line in proc.stdout:
252
+ line = line.strip()
253
+ if line.startswith(b'Default Library Path (ELF):'):
254
+ paths = os.fsdecode(line).split()[4]
255
+
256
+ if not paths:
257
+ return None
258
+
259
+ for dir in paths.split(":"):
260
+ libfile = os.path.join(dir, "lib%s.so" % name)
261
+ if os.path.exists(libfile):
262
+ return libfile
263
+
264
+ return None
265
+
266
+ def find_library(name, is64 = False):
267
+ return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
268
+
269
+ else:
270
+
271
+ def _findSoname_ldconfig(name):
272
+ import struct
273
+ if struct.calcsize('l') == 4:
274
+ machine = os.uname().machine + '-32'
275
+ else:
276
+ machine = os.uname().machine + '-64'
277
+ mach_map = {
278
+ 'x86_64-64': 'libc6,x86-64',
279
+ 'ppc64-64': 'libc6,64bit',
280
+ 'sparc64-64': 'libc6,64bit',
281
+ 's390x-64': 'libc6,64bit',
282
+ 'ia64-64': 'libc6,IA-64',
283
+ }
284
+ abi_type = mach_map.get(machine, 'libc6')
285
+
286
+ # XXX assuming GLIBC's ldconfig (with option -p)
287
+ regex = r'\s+(lib%s\.[^\s]+)\s+\(%s'
288
+ regex = os.fsencode(regex % (re.escape(name), abi_type))
289
+ try:
290
+ with subprocess.Popen(['/sbin/ldconfig', '-p'],
291
+ stdin=subprocess.DEVNULL,
292
+ stderr=subprocess.DEVNULL,
293
+ stdout=subprocess.PIPE,
294
+ env={'LC_ALL': 'C', 'LANG': 'C'}) as p:
295
+ res = re.search(regex, p.stdout.read())
296
+ if res:
297
+ return os.fsdecode(res.group(1))
298
+ except OSError:
299
+ pass
300
+
301
+ def _findLib_ld(name):
302
+ # See issue #9998 for why this is needed
303
+ expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
304
+ cmd = ['ld', '-t']
305
+ libpath = os.environ.get('LD_LIBRARY_PATH')
306
+ if libpath:
307
+ for d in libpath.split(':'):
308
+ cmd.extend(['-L', d])
309
+ cmd.extend(['-o', os.devnull, '-l%s' % name])
310
+ result = None
311
+ try:
312
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
313
+ stderr=subprocess.PIPE,
314
+ universal_newlines=True)
315
+ out, _ = p.communicate()
316
+ res = re.findall(expr, os.fsdecode(out))
317
+ for file in res:
318
+ # Check if the given file is an elf file: gcc can report
319
+ # some files that are linker scripts and not actual
320
+ # shared objects. See bpo-41976 for more details
321
+ if not _is_elf(file):
322
+ continue
323
+ return os.fsdecode(file)
324
+ except Exception:
325
+ pass # result will be None
326
+ return result
327
+
328
+ def _findLib_prefix(name):
329
+ if not name:
330
+ return None
331
+ for fullname in (name, "lib%s.so" % (name)):
332
+ path = os.path.join(sys.prefix, 'lib', fullname)
333
+ if os.path.exists(path):
334
+ return path
335
+ return None
336
+
337
+ def find_library(name):
338
+ # See issue #9998
339
+ # Yes calling _findLib_prefix twice is deliberate, because _get_soname ditches
340
+ # the full path.
341
+ # When objdump is unavailable this returns None
342
+ so_name = _get_soname(_findLib_prefix(name)) or name
343
+ if so_name != name:
344
+ return _findLib_prefix(so_name) or \
345
+ _findLib_prefix(name) or \
346
+ _findSoname_ldconfig(name) or \
347
+ _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))
348
+ else:
349
+ return _findLib_prefix(name) or \
350
+ _findSoname_ldconfig(name) or \
351
+ _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))
352
+
353
+ ################################################################
354
+ # test code
355
+
356
+ def test():
357
+ from ctypes import cdll
358
+ if os.name == "nt":
359
+ print(cdll.msvcrt)
360
+ print(cdll.load("msvcrt"))
361
+ print(find_library("msvcrt"))
362
+
363
+ if os.name == "posix":
364
+ # find and load_version
365
+ print(find_library("m"))
366
+ print(find_library("c"))
367
+ print(find_library("bz2"))
368
+
369
+ # load
370
+ if sys.platform == "darwin":
371
+ print(cdll.LoadLibrary("libm.dylib"))
372
+ print(cdll.LoadLibrary("libcrypto.dylib"))
373
+ print(cdll.LoadLibrary("libSystem.dylib"))
374
+ print(cdll.LoadLibrary("System.framework/System"))
375
+ # issue-26439 - fix broken test call for AIX
376
+ elif sys.platform.startswith("aix"):
377
+ from ctypes import CDLL
378
+ if sys.maxsize < 2**32:
379
+ print(f"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr.o)', os.RTLD_MEMBER)}")
380
+ print(f"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr.o)')}")
381
+ # librpm.so is only available as 32-bit shared library
382
+ print(find_library("rpm"))
383
+ print(cdll.LoadLibrary("librpm.so"))
384
+ else:
385
+ print(f"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr_64.o)', os.RTLD_MEMBER)}")
386
+ print(f"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr_64.o)')}")
387
+ print(f"crypt\t:: {find_library('crypt')}")
388
+ print(f"crypt\t:: {cdll.LoadLibrary(find_library('crypt'))}")
389
+ print(f"crypto\t:: {find_library('crypto')}")
390
+ print(f"crypto\t:: {cdll.LoadLibrary(find_library('crypto'))}")
391
+ else:
392
+ print(cdll.LoadLibrary("libm.so"))
393
+ print(cdll.LoadLibrary("libcrypt.so"))
394
+ print(find_library("crypt"))
395
+
396
+ if __name__ == "__main__":
397
+ test()
evalkit_cambrian/lib/python3.10/ctypes/wintypes.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The most useful windows datatypes
2
+ import ctypes
3
+
4
+ BYTE = ctypes.c_byte
5
+ WORD = ctypes.c_ushort
6
+ DWORD = ctypes.c_ulong
7
+
8
+ #UCHAR = ctypes.c_uchar
9
+ CHAR = ctypes.c_char
10
+ WCHAR = ctypes.c_wchar
11
+ UINT = ctypes.c_uint
12
+ INT = ctypes.c_int
13
+
14
+ DOUBLE = ctypes.c_double
15
+ FLOAT = ctypes.c_float
16
+
17
+ BOOLEAN = BYTE
18
+ BOOL = ctypes.c_long
19
+
20
+ class VARIANT_BOOL(ctypes._SimpleCData):
21
+ _type_ = "v"
22
+ def __repr__(self):
23
+ return "%s(%r)" % (self.__class__.__name__, self.value)
24
+
25
+ ULONG = ctypes.c_ulong
26
+ LONG = ctypes.c_long
27
+
28
+ USHORT = ctypes.c_ushort
29
+ SHORT = ctypes.c_short
30
+
31
+ # in the windows header files, these are structures.
32
+ _LARGE_INTEGER = LARGE_INTEGER = ctypes.c_longlong
33
+ _ULARGE_INTEGER = ULARGE_INTEGER = ctypes.c_ulonglong
34
+
35
+ LPCOLESTR = LPOLESTR = OLESTR = ctypes.c_wchar_p
36
+ LPCWSTR = LPWSTR = ctypes.c_wchar_p
37
+ LPCSTR = LPSTR = ctypes.c_char_p
38
+ LPCVOID = LPVOID = ctypes.c_void_p
39
+
40
+ # WPARAM is defined as UINT_PTR (unsigned type)
41
+ # LPARAM is defined as LONG_PTR (signed type)
42
+ if ctypes.sizeof(ctypes.c_long) == ctypes.sizeof(ctypes.c_void_p):
43
+ WPARAM = ctypes.c_ulong
44
+ LPARAM = ctypes.c_long
45
+ elif ctypes.sizeof(ctypes.c_longlong) == ctypes.sizeof(ctypes.c_void_p):
46
+ WPARAM = ctypes.c_ulonglong
47
+ LPARAM = ctypes.c_longlong
48
+
49
+ ATOM = WORD
50
+ LANGID = WORD
51
+
52
+ COLORREF = DWORD
53
+ LGRPID = DWORD
54
+ LCTYPE = DWORD
55
+
56
+ LCID = DWORD
57
+
58
+ ################################################################
59
+ # HANDLE types
60
+ HANDLE = ctypes.c_void_p # in the header files: void *
61
+
62
+ HACCEL = HANDLE
63
+ HBITMAP = HANDLE
64
+ HBRUSH = HANDLE
65
+ HCOLORSPACE = HANDLE
66
+ HDC = HANDLE
67
+ HDESK = HANDLE
68
+ HDWP = HANDLE
69
+ HENHMETAFILE = HANDLE
70
+ HFONT = HANDLE
71
+ HGDIOBJ = HANDLE
72
+ HGLOBAL = HANDLE
73
+ HHOOK = HANDLE
74
+ HICON = HANDLE
75
+ HINSTANCE = HANDLE
76
+ HKEY = HANDLE
77
+ HKL = HANDLE
78
+ HLOCAL = HANDLE
79
+ HMENU = HANDLE
80
+ HMETAFILE = HANDLE
81
+ HMODULE = HANDLE
82
+ HMONITOR = HANDLE
83
+ HPALETTE = HANDLE
84
+ HPEN = HANDLE
85
+ HRGN = HANDLE
86
+ HRSRC = HANDLE
87
+ HSTR = HANDLE
88
+ HTASK = HANDLE
89
+ HWINSTA = HANDLE
90
+ HWND = HANDLE
91
+ SC_HANDLE = HANDLE
92
+ SERVICE_STATUS_HANDLE = HANDLE
93
+
94
+ ################################################################
95
+ # Some important structure definitions
96
+
97
+ class RECT(ctypes.Structure):
98
+ _fields_ = [("left", LONG),
99
+ ("top", LONG),
100
+ ("right", LONG),
101
+ ("bottom", LONG)]
102
+ tagRECT = _RECTL = RECTL = RECT
103
+
104
+ class _SMALL_RECT(ctypes.Structure):
105
+ _fields_ = [('Left', SHORT),
106
+ ('Top', SHORT),
107
+ ('Right', SHORT),
108
+ ('Bottom', SHORT)]
109
+ SMALL_RECT = _SMALL_RECT
110
+
111
+ class _COORD(ctypes.Structure):
112
+ _fields_ = [('X', SHORT),
113
+ ('Y', SHORT)]
114
+
115
+ class POINT(ctypes.Structure):
116
+ _fields_ = [("x", LONG),
117
+ ("y", LONG)]
118
+ tagPOINT = _POINTL = POINTL = POINT
119
+
120
+ class SIZE(ctypes.Structure):
121
+ _fields_ = [("cx", LONG),
122
+ ("cy", LONG)]
123
+ tagSIZE = SIZEL = SIZE
124
+
125
+ def RGB(red, green, blue):
126
+ return red + (green << 8) + (blue << 16)
127
+
128
+ class FILETIME(ctypes.Structure):
129
+ _fields_ = [("dwLowDateTime", DWORD),
130
+ ("dwHighDateTime", DWORD)]
131
+ _FILETIME = FILETIME
132
+
133
+ class MSG(ctypes.Structure):
134
+ _fields_ = [("hWnd", HWND),
135
+ ("message", UINT),
136
+ ("wParam", WPARAM),
137
+ ("lParam", LPARAM),
138
+ ("time", DWORD),
139
+ ("pt", POINT)]
140
+ tagMSG = MSG
141
+ MAX_PATH = 260
142
+
143
+ class WIN32_FIND_DATAA(ctypes.Structure):
144
+ _fields_ = [("dwFileAttributes", DWORD),
145
+ ("ftCreationTime", FILETIME),
146
+ ("ftLastAccessTime", FILETIME),
147
+ ("ftLastWriteTime", FILETIME),
148
+ ("nFileSizeHigh", DWORD),
149
+ ("nFileSizeLow", DWORD),
150
+ ("dwReserved0", DWORD),
151
+ ("dwReserved1", DWORD),
152
+ ("cFileName", CHAR * MAX_PATH),
153
+ ("cAlternateFileName", CHAR * 14)]
154
+
155
+ class WIN32_FIND_DATAW(ctypes.Structure):
156
+ _fields_ = [("dwFileAttributes", DWORD),
157
+ ("ftCreationTime", FILETIME),
158
+ ("ftLastAccessTime", FILETIME),
159
+ ("ftLastWriteTime", FILETIME),
160
+ ("nFileSizeHigh", DWORD),
161
+ ("nFileSizeLow", DWORD),
162
+ ("dwReserved0", DWORD),
163
+ ("dwReserved1", DWORD),
164
+ ("cFileName", WCHAR * MAX_PATH),
165
+ ("cAlternateFileName", WCHAR * 14)]
166
+
167
+ ################################################################
168
+ # Pointer types
169
+
170
+ LPBOOL = PBOOL = ctypes.POINTER(BOOL)
171
+ PBOOLEAN = ctypes.POINTER(BOOLEAN)
172
+ LPBYTE = PBYTE = ctypes.POINTER(BYTE)
173
+ PCHAR = ctypes.POINTER(CHAR)
174
+ LPCOLORREF = ctypes.POINTER(COLORREF)
175
+ LPDWORD = PDWORD = ctypes.POINTER(DWORD)
176
+ LPFILETIME = PFILETIME = ctypes.POINTER(FILETIME)
177
+ PFLOAT = ctypes.POINTER(FLOAT)
178
+ LPHANDLE = PHANDLE = ctypes.POINTER(HANDLE)
179
+ PHKEY = ctypes.POINTER(HKEY)
180
+ LPHKL = ctypes.POINTER(HKL)
181
+ LPINT = PINT = ctypes.POINTER(INT)
182
+ PLARGE_INTEGER = ctypes.POINTER(LARGE_INTEGER)
183
+ PLCID = ctypes.POINTER(LCID)
184
+ LPLONG = PLONG = ctypes.POINTER(LONG)
185
+ LPMSG = PMSG = ctypes.POINTER(MSG)
186
+ LPPOINT = PPOINT = ctypes.POINTER(POINT)
187
+ PPOINTL = ctypes.POINTER(POINTL)
188
+ LPRECT = PRECT = ctypes.POINTER(RECT)
189
+ LPRECTL = PRECTL = ctypes.POINTER(RECTL)
190
+ LPSC_HANDLE = ctypes.POINTER(SC_HANDLE)
191
+ PSHORT = ctypes.POINTER(SHORT)
192
+ LPSIZE = PSIZE = ctypes.POINTER(SIZE)
193
+ LPSIZEL = PSIZEL = ctypes.POINTER(SIZEL)
194
+ PSMALL_RECT = ctypes.POINTER(SMALL_RECT)
195
+ LPUINT = PUINT = ctypes.POINTER(UINT)
196
+ PULARGE_INTEGER = ctypes.POINTER(ULARGE_INTEGER)
197
+ PULONG = ctypes.POINTER(ULONG)
198
+ PUSHORT = ctypes.POINTER(USHORT)
199
+ PWCHAR = ctypes.POINTER(WCHAR)
200
+ LPWIN32_FIND_DATAA = PWIN32_FIND_DATAA = ctypes.POINTER(WIN32_FIND_DATAA)
201
+ LPWIN32_FIND_DATAW = PWIN32_FIND_DATAW = ctypes.POINTER(WIN32_FIND_DATAW)
202
+ LPWORD = PWORD = ctypes.POINTER(WORD)
evalkit_cambrian/lib/python3.10/curses/__init__.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """curses
2
+
3
+ The main package for curses support for Python. Normally used by importing
4
+ the package, and perhaps a particular module inside it.
5
+
6
+ import curses
7
+ from curses import textpad
8
+ curses.initscr()
9
+ ...
10
+
11
+ """
12
+
13
+ from _curses import *
14
+ import os as _os
15
+ import sys as _sys
16
+
17
+ # Some constants, most notably the ACS_* ones, are only added to the C
18
+ # _curses module's dictionary after initscr() is called. (Some
19
+ # versions of SGI's curses don't define values for those constants
20
+ # until initscr() has been called.) This wrapper function calls the
21
+ # underlying C initscr(), and then copies the constants from the
22
+ # _curses module to the curses package's dictionary. Don't do 'from
23
+ # curses import *' if you'll be needing the ACS_* constants.
24
+
25
+ def initscr():
26
+ import _curses, curses
27
+ # we call setupterm() here because it raises an error
28
+ # instead of calling exit() in error cases.
29
+ setupterm(term=_os.environ.get("TERM", "unknown"),
30
+ fd=_sys.__stdout__.fileno())
31
+ stdscr = _curses.initscr()
32
+ for key, value in _curses.__dict__.items():
33
+ if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
34
+ setattr(curses, key, value)
35
+
36
+ return stdscr
37
+
38
+ # This is a similar wrapper for start_color(), which adds the COLORS and
39
+ # COLOR_PAIRS variables which are only available after start_color() is
40
+ # called.
41
+
42
+ def start_color():
43
+ import _curses, curses
44
+ retval = _curses.start_color()
45
+ if hasattr(_curses, 'COLORS'):
46
+ curses.COLORS = _curses.COLORS
47
+ if hasattr(_curses, 'COLOR_PAIRS'):
48
+ curses.COLOR_PAIRS = _curses.COLOR_PAIRS
49
+ return retval
50
+
51
+ # Import Python has_key() implementation if _curses doesn't contain has_key()
52
+
53
+ try:
54
+ has_key
55
+ except NameError:
56
+ from .has_key import has_key
57
+
58
+ # Wrapper for the entire curses-based application. Runs a function which
59
+ # should be the rest of your curses-based application. If the application
60
+ # raises an exception, wrapper() will restore the terminal to a sane state so
61
+ # you can read the resulting traceback.
62
+
63
+ def wrapper(func, /, *args, **kwds):
64
+ """Wrapper function that initializes curses and calls another function,
65
+ restoring normal keyboard/screen behavior on error.
66
+ The callable object 'func' is then passed the main window 'stdscr'
67
+ as its first argument, followed by any other arguments passed to
68
+ wrapper().
69
+ """
70
+
71
+ try:
72
+ # Initialize curses
73
+ stdscr = initscr()
74
+
75
+ # Turn off echoing of keys, and enter cbreak mode,
76
+ # where no buffering is performed on keyboard input
77
+ noecho()
78
+ cbreak()
79
+
80
+ # In keypad mode, escape sequences for special keys
81
+ # (like the cursor keys) will be interpreted and
82
+ # a special value like curses.KEY_LEFT will be returned
83
+ stdscr.keypad(1)
84
+
85
+ # Start color, too. Harmless if the terminal doesn't have
86
+ # color; user can test with has_color() later on. The try/catch
87
+ # works around a minor bit of over-conscientiousness in the curses
88
+ # module -- the error return from C start_color() is ignorable.
89
+ try:
90
+ start_color()
91
+ except:
92
+ pass
93
+
94
+ return func(stdscr, *args, **kwds)
95
+ finally:
96
+ # Set everything back to normal
97
+ if 'stdscr' in locals():
98
+ stdscr.keypad(0)
99
+ echo()
100
+ nocbreak()
101
+ endwin()
evalkit_cambrian/lib/python3.10/curses/__pycache__/panel.cpython-310.pyc ADDED
Binary file (480 Bytes). View file
 
evalkit_cambrian/lib/python3.10/curses/has_key.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #
3
+ # Emulation of has_key() function for platforms that don't use ncurses
4
+ #
5
+
6
+ import _curses
7
+
8
+ # Table mapping curses keys to the terminfo capability name
9
+
10
+ _capability_names = {
11
+ _curses.KEY_A1: 'ka1',
12
+ _curses.KEY_A3: 'ka3',
13
+ _curses.KEY_B2: 'kb2',
14
+ _curses.KEY_BACKSPACE: 'kbs',
15
+ _curses.KEY_BEG: 'kbeg',
16
+ _curses.KEY_BTAB: 'kcbt',
17
+ _curses.KEY_C1: 'kc1',
18
+ _curses.KEY_C3: 'kc3',
19
+ _curses.KEY_CANCEL: 'kcan',
20
+ _curses.KEY_CATAB: 'ktbc',
21
+ _curses.KEY_CLEAR: 'kclr',
22
+ _curses.KEY_CLOSE: 'kclo',
23
+ _curses.KEY_COMMAND: 'kcmd',
24
+ _curses.KEY_COPY: 'kcpy',
25
+ _curses.KEY_CREATE: 'kcrt',
26
+ _curses.KEY_CTAB: 'kctab',
27
+ _curses.KEY_DC: 'kdch1',
28
+ _curses.KEY_DL: 'kdl1',
29
+ _curses.KEY_DOWN: 'kcud1',
30
+ _curses.KEY_EIC: 'krmir',
31
+ _curses.KEY_END: 'kend',
32
+ _curses.KEY_ENTER: 'kent',
33
+ _curses.KEY_EOL: 'kel',
34
+ _curses.KEY_EOS: 'ked',
35
+ _curses.KEY_EXIT: 'kext',
36
+ _curses.KEY_F0: 'kf0',
37
+ _curses.KEY_F1: 'kf1',
38
+ _curses.KEY_F10: 'kf10',
39
+ _curses.KEY_F11: 'kf11',
40
+ _curses.KEY_F12: 'kf12',
41
+ _curses.KEY_F13: 'kf13',
42
+ _curses.KEY_F14: 'kf14',
43
+ _curses.KEY_F15: 'kf15',
44
+ _curses.KEY_F16: 'kf16',
45
+ _curses.KEY_F17: 'kf17',
46
+ _curses.KEY_F18: 'kf18',
47
+ _curses.KEY_F19: 'kf19',
48
+ _curses.KEY_F2: 'kf2',
49
+ _curses.KEY_F20: 'kf20',
50
+ _curses.KEY_F21: 'kf21',
51
+ _curses.KEY_F22: 'kf22',
52
+ _curses.KEY_F23: 'kf23',
53
+ _curses.KEY_F24: 'kf24',
54
+ _curses.KEY_F25: 'kf25',
55
+ _curses.KEY_F26: 'kf26',
56
+ _curses.KEY_F27: 'kf27',
57
+ _curses.KEY_F28: 'kf28',
58
+ _curses.KEY_F29: 'kf29',
59
+ _curses.KEY_F3: 'kf3',
60
+ _curses.KEY_F30: 'kf30',
61
+ _curses.KEY_F31: 'kf31',
62
+ _curses.KEY_F32: 'kf32',
63
+ _curses.KEY_F33: 'kf33',
64
+ _curses.KEY_F34: 'kf34',
65
+ _curses.KEY_F35: 'kf35',
66
+ _curses.KEY_F36: 'kf36',
67
+ _curses.KEY_F37: 'kf37',
68
+ _curses.KEY_F38: 'kf38',
69
+ _curses.KEY_F39: 'kf39',
70
+ _curses.KEY_F4: 'kf4',
71
+ _curses.KEY_F40: 'kf40',
72
+ _curses.KEY_F41: 'kf41',
73
+ _curses.KEY_F42: 'kf42',
74
+ _curses.KEY_F43: 'kf43',
75
+ _curses.KEY_F44: 'kf44',
76
+ _curses.KEY_F45: 'kf45',
77
+ _curses.KEY_F46: 'kf46',
78
+ _curses.KEY_F47: 'kf47',
79
+ _curses.KEY_F48: 'kf48',
80
+ _curses.KEY_F49: 'kf49',
81
+ _curses.KEY_F5: 'kf5',
82
+ _curses.KEY_F50: 'kf50',
83
+ _curses.KEY_F51: 'kf51',
84
+ _curses.KEY_F52: 'kf52',
85
+ _curses.KEY_F53: 'kf53',
86
+ _curses.KEY_F54: 'kf54',
87
+ _curses.KEY_F55: 'kf55',
88
+ _curses.KEY_F56: 'kf56',
89
+ _curses.KEY_F57: 'kf57',
90
+ _curses.KEY_F58: 'kf58',
91
+ _curses.KEY_F59: 'kf59',
92
+ _curses.KEY_F6: 'kf6',
93
+ _curses.KEY_F60: 'kf60',
94
+ _curses.KEY_F61: 'kf61',
95
+ _curses.KEY_F62: 'kf62',
96
+ _curses.KEY_F63: 'kf63',
97
+ _curses.KEY_F7: 'kf7',
98
+ _curses.KEY_F8: 'kf8',
99
+ _curses.KEY_F9: 'kf9',
100
+ _curses.KEY_FIND: 'kfnd',
101
+ _curses.KEY_HELP: 'khlp',
102
+ _curses.KEY_HOME: 'khome',
103
+ _curses.KEY_IC: 'kich1',
104
+ _curses.KEY_IL: 'kil1',
105
+ _curses.KEY_LEFT: 'kcub1',
106
+ _curses.KEY_LL: 'kll',
107
+ _curses.KEY_MARK: 'kmrk',
108
+ _curses.KEY_MESSAGE: 'kmsg',
109
+ _curses.KEY_MOVE: 'kmov',
110
+ _curses.KEY_NEXT: 'knxt',
111
+ _curses.KEY_NPAGE: 'knp',
112
+ _curses.KEY_OPEN: 'kopn',
113
+ _curses.KEY_OPTIONS: 'kopt',
114
+ _curses.KEY_PPAGE: 'kpp',
115
+ _curses.KEY_PREVIOUS: 'kprv',
116
+ _curses.KEY_PRINT: 'kprt',
117
+ _curses.KEY_REDO: 'krdo',
118
+ _curses.KEY_REFERENCE: 'kref',
119
+ _curses.KEY_REFRESH: 'krfr',
120
+ _curses.KEY_REPLACE: 'krpl',
121
+ _curses.KEY_RESTART: 'krst',
122
+ _curses.KEY_RESUME: 'kres',
123
+ _curses.KEY_RIGHT: 'kcuf1',
124
+ _curses.KEY_SAVE: 'ksav',
125
+ _curses.KEY_SBEG: 'kBEG',
126
+ _curses.KEY_SCANCEL: 'kCAN',
127
+ _curses.KEY_SCOMMAND: 'kCMD',
128
+ _curses.KEY_SCOPY: 'kCPY',
129
+ _curses.KEY_SCREATE: 'kCRT',
130
+ _curses.KEY_SDC: 'kDC',
131
+ _curses.KEY_SDL: 'kDL',
132
+ _curses.KEY_SELECT: 'kslt',
133
+ _curses.KEY_SEND: 'kEND',
134
+ _curses.KEY_SEOL: 'kEOL',
135
+ _curses.KEY_SEXIT: 'kEXT',
136
+ _curses.KEY_SF: 'kind',
137
+ _curses.KEY_SFIND: 'kFND',
138
+ _curses.KEY_SHELP: 'kHLP',
139
+ _curses.KEY_SHOME: 'kHOM',
140
+ _curses.KEY_SIC: 'kIC',
141
+ _curses.KEY_SLEFT: 'kLFT',
142
+ _curses.KEY_SMESSAGE: 'kMSG',
143
+ _curses.KEY_SMOVE: 'kMOV',
144
+ _curses.KEY_SNEXT: 'kNXT',
145
+ _curses.KEY_SOPTIONS: 'kOPT',
146
+ _curses.KEY_SPREVIOUS: 'kPRV',
147
+ _curses.KEY_SPRINT: 'kPRT',
148
+ _curses.KEY_SR: 'kri',
149
+ _curses.KEY_SREDO: 'kRDO',
150
+ _curses.KEY_SREPLACE: 'kRPL',
151
+ _curses.KEY_SRIGHT: 'kRIT',
152
+ _curses.KEY_SRSUME: 'kRES',
153
+ _curses.KEY_SSAVE: 'kSAV',
154
+ _curses.KEY_SSUSPEND: 'kSPD',
155
+ _curses.KEY_STAB: 'khts',
156
+ _curses.KEY_SUNDO: 'kUND',
157
+ _curses.KEY_SUSPEND: 'kspd',
158
+ _curses.KEY_UNDO: 'kund',
159
+ _curses.KEY_UP: 'kcuu1'
160
+ }
161
+
162
+ def has_key(ch):
163
+ if isinstance(ch, str):
164
+ ch = ord(ch)
165
+
166
+ # Figure out the correct capability name for the keycode.
167
+ capability_name = _capability_names.get(ch)
168
+ if capability_name is None:
169
+ return False
170
+
171
+ #Check the current terminal description for that capability;
172
+ #if present, return true, else return false.
173
+ if _curses.tigetstr( capability_name ):
174
+ return True
175
+ else:
176
+ return False
177
+
178
+ if __name__ == '__main__':
179
+ # Compare the output of this implementation and the ncurses has_key,
180
+ # on platforms where has_key is already available
181
+ try:
182
+ L = []
183
+ _curses.initscr()
184
+ for key in _capability_names.keys():
185
+ system = _curses.has_key(key)
186
+ python = has_key(key)
187
+ if system != python:
188
+ L.append( 'Mismatch for key %s, system=%i, Python=%i'
189
+ % (_curses.keyname( key ), system, python) )
190
+ finally:
191
+ _curses.endwin()
192
+ for i in L: print(i)
evalkit_cambrian/lib/python3.10/curses/textpad.py ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Simple textbox editing widget with Emacs-like keybindings."""
2
+
3
+ import curses
4
+ import curses.ascii
5
+
6
+ def rectangle(win, uly, ulx, lry, lrx):
7
+ """Draw a rectangle with corners at the provided upper-left
8
+ and lower-right coordinates.
9
+ """
10
+ win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
11
+ win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
12
+ win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
13
+ win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1)
14
+ win.addch(uly, ulx, curses.ACS_ULCORNER)
15
+ win.addch(uly, lrx, curses.ACS_URCORNER)
16
+ win.addch(lry, lrx, curses.ACS_LRCORNER)
17
+ win.addch(lry, ulx, curses.ACS_LLCORNER)
18
+
19
+ class Textbox:
20
+ """Editing widget using the interior of a window object.
21
+ Supports the following Emacs-like key bindings:
22
+
23
+ Ctrl-A Go to left edge of window.
24
+ Ctrl-B Cursor left, wrapping to previous line if appropriate.
25
+ Ctrl-D Delete character under cursor.
26
+ Ctrl-E Go to right edge (stripspaces off) or end of line (stripspaces on).
27
+ Ctrl-F Cursor right, wrapping to next line when appropriate.
28
+ Ctrl-G Terminate, returning the window contents.
29
+ Ctrl-H Delete character backward.
30
+ Ctrl-J Terminate if the window is 1 line, otherwise insert newline.
31
+ Ctrl-K If line is blank, delete it, otherwise clear to end of line.
32
+ Ctrl-L Refresh screen.
33
+ Ctrl-N Cursor down; move down one line.
34
+ Ctrl-O Insert a blank line at cursor location.
35
+ Ctrl-P Cursor up; move up one line.
36
+
37
+ Move operations do nothing if the cursor is at an edge where the movement
38
+ is not possible. The following synonyms are supported where possible:
39
+
40
+ KEY_LEFT = Ctrl-B, KEY_RIGHT = Ctrl-F, KEY_UP = Ctrl-P, KEY_DOWN = Ctrl-N
41
+ KEY_BACKSPACE = Ctrl-h
42
+ """
43
+ def __init__(self, win, insert_mode=False):
44
+ self.win = win
45
+ self.insert_mode = insert_mode
46
+ self._update_max_yx()
47
+ self.stripspaces = 1
48
+ self.lastcmd = None
49
+ win.keypad(1)
50
+
51
+ def _update_max_yx(self):
52
+ maxy, maxx = self.win.getmaxyx()
53
+ self.maxy = maxy - 1
54
+ self.maxx = maxx - 1
55
+
56
+ def _end_of_line(self, y):
57
+ """Go to the location of the first blank on the given line,
58
+ returning the index of the last non-blank character."""
59
+ self._update_max_yx()
60
+ last = self.maxx
61
+ while True:
62
+ if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP:
63
+ last = min(self.maxx, last+1)
64
+ break
65
+ elif last == 0:
66
+ break
67
+ last = last - 1
68
+ return last
69
+
70
+ def _insert_printable_char(self, ch):
71
+ self._update_max_yx()
72
+ (y, x) = self.win.getyx()
73
+ backyx = None
74
+ while y < self.maxy or x < self.maxx:
75
+ if self.insert_mode:
76
+ oldch = self.win.inch()
77
+ # The try-catch ignores the error we trigger from some curses
78
+ # versions by trying to write into the lowest-rightmost spot
79
+ # in the window.
80
+ try:
81
+ self.win.addch(ch)
82
+ except curses.error:
83
+ pass
84
+ if not self.insert_mode or not curses.ascii.isprint(oldch):
85
+ break
86
+ ch = oldch
87
+ (y, x) = self.win.getyx()
88
+ # Remember where to put the cursor back since we are in insert_mode
89
+ if backyx is None:
90
+ backyx = y, x
91
+
92
+ if backyx is not None:
93
+ self.win.move(*backyx)
94
+
95
+ def do_command(self, ch):
96
+ "Process a single editing command."
97
+ self._update_max_yx()
98
+ (y, x) = self.win.getyx()
99
+ self.lastcmd = ch
100
+ if curses.ascii.isprint(ch):
101
+ if y < self.maxy or x < self.maxx:
102
+ self._insert_printable_char(ch)
103
+ elif ch == curses.ascii.SOH: # ^a
104
+ self.win.move(y, 0)
105
+ elif ch in (curses.ascii.STX,curses.KEY_LEFT, curses.ascii.BS,curses.KEY_BACKSPACE):
106
+ if x > 0:
107
+ self.win.move(y, x-1)
108
+ elif y == 0:
109
+ pass
110
+ elif self.stripspaces:
111
+ self.win.move(y-1, self._end_of_line(y-1))
112
+ else:
113
+ self.win.move(y-1, self.maxx)
114
+ if ch in (curses.ascii.BS, curses.KEY_BACKSPACE):
115
+ self.win.delch()
116
+ elif ch == curses.ascii.EOT: # ^d
117
+ self.win.delch()
118
+ elif ch == curses.ascii.ENQ: # ^e
119
+ if self.stripspaces:
120
+ self.win.move(y, self._end_of_line(y))
121
+ else:
122
+ self.win.move(y, self.maxx)
123
+ elif ch in (curses.ascii.ACK, curses.KEY_RIGHT): # ^f
124
+ if x < self.maxx:
125
+ self.win.move(y, x+1)
126
+ elif y == self.maxy:
127
+ pass
128
+ else:
129
+ self.win.move(y+1, 0)
130
+ elif ch == curses.ascii.BEL: # ^g
131
+ return 0
132
+ elif ch == curses.ascii.NL: # ^j
133
+ if self.maxy == 0:
134
+ return 0
135
+ elif y < self.maxy:
136
+ self.win.move(y+1, 0)
137
+ elif ch == curses.ascii.VT: # ^k
138
+ if x == 0 and self._end_of_line(y) == 0:
139
+ self.win.deleteln()
140
+ else:
141
+ # first undo the effect of self._end_of_line
142
+ self.win.move(y, x)
143
+ self.win.clrtoeol()
144
+ elif ch == curses.ascii.FF: # ^l
145
+ self.win.refresh()
146
+ elif ch in (curses.ascii.SO, curses.KEY_DOWN): # ^n
147
+ if y < self.maxy:
148
+ self.win.move(y+1, x)
149
+ if x > self._end_of_line(y+1):
150
+ self.win.move(y+1, self._end_of_line(y+1))
151
+ elif ch == curses.ascii.SI: # ^o
152
+ self.win.insertln()
153
+ elif ch in (curses.ascii.DLE, curses.KEY_UP): # ^p
154
+ if y > 0:
155
+ self.win.move(y-1, x)
156
+ if x > self._end_of_line(y-1):
157
+ self.win.move(y-1, self._end_of_line(y-1))
158
+ return 1
159
+
160
+ def gather(self):
161
+ "Collect and return the contents of the window."
162
+ result = ""
163
+ self._update_max_yx()
164
+ for y in range(self.maxy+1):
165
+ self.win.move(y, 0)
166
+ stop = self._end_of_line(y)
167
+ if stop == 0 and self.stripspaces:
168
+ continue
169
+ for x in range(self.maxx+1):
170
+ if self.stripspaces and x > stop:
171
+ break
172
+ result = result + chr(curses.ascii.ascii(self.win.inch(y, x)))
173
+ if self.maxy > 0:
174
+ result = result + "\n"
175
+ return result
176
+
177
+ def edit(self, validate=None):
178
+ "Edit in the widget window and collect the results."
179
+ while 1:
180
+ ch = self.win.getch()
181
+ if validate:
182
+ ch = validate(ch)
183
+ if not ch:
184
+ continue
185
+ if not self.do_command(ch):
186
+ break
187
+ self.win.refresh()
188
+ return self.gather()
189
+
190
+ if __name__ == '__main__':
191
+ def test_editbox(stdscr):
192
+ ncols, nlines = 9, 4
193
+ uly, ulx = 15, 20
194
+ stdscr.addstr(uly-2, ulx, "Use Ctrl-G to end editing.")
195
+ win = curses.newwin(nlines, ncols, uly, ulx)
196
+ rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
197
+ stdscr.refresh()
198
+ return Textbox(win).edit()
199
+
200
+ str = curses.wrapper(test_editbox)
201
+ print('Contents of text box:', repr(str))
evalkit_cambrian/lib/python3.10/dbm/__init__.py ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generic interface to all dbm clones.
2
+
3
+ Use
4
+
5
+ import dbm
6
+ d = dbm.open(file, 'w', 0o666)
7
+
8
+ The returned object is a dbm.gnu, dbm.ndbm or dbm.dumb object, dependent on the
9
+ type of database being opened (determined by the whichdb function) in the case
10
+ of an existing dbm. If the dbm does not exist and the create or new flag ('c'
11
+ or 'n') was specified, the dbm type will be determined by the availability of
12
+ the modules (tested in the above order).
13
+
14
+ It has the following interface (key and data are strings):
15
+
16
+ d[key] = data # store data at key (may override data at
17
+ # existing key)
18
+ data = d[key] # retrieve data at key (raise KeyError if no
19
+ # such key)
20
+ del d[key] # delete data stored at key (raises KeyError
21
+ # if no such key)
22
+ flag = key in d # true if the key exists
23
+ list = d.keys() # return a list of all existing keys (slow!)
24
+
25
+ Future versions may change the order in which implementations are
26
+ tested for existence, and add interfaces to other dbm-like
27
+ implementations.
28
+ """
29
+
30
+ __all__ = ['open', 'whichdb', 'error']
31
+
32
+ import io
33
+ import os
34
+ import struct
35
+ import sys
36
+
37
+
38
+ class error(Exception):
39
+ pass
40
+
41
+ _names = ['dbm.gnu', 'dbm.ndbm', 'dbm.dumb']
42
+ _defaultmod = None
43
+ _modules = {}
44
+
45
+ error = (error, OSError)
46
+
47
+ try:
48
+ from dbm import ndbm
49
+ except ImportError:
50
+ ndbm = None
51
+
52
+
53
+ def open(file, flag='r', mode=0o666):
54
+ """Open or create database at path given by *file*.
55
+
56
+ Optional argument *flag* can be 'r' (default) for read-only access, 'w'
57
+ for read-write access of an existing database, 'c' for read-write access
58
+ to a new or existing database, and 'n' for read-write access to a new
59
+ database.
60
+
61
+ Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
62
+ only if it doesn't exist; and 'n' always creates a new database.
63
+ """
64
+ global _defaultmod
65
+ if _defaultmod is None:
66
+ for name in _names:
67
+ try:
68
+ mod = __import__(name, fromlist=['open'])
69
+ except ImportError:
70
+ continue
71
+ if not _defaultmod:
72
+ _defaultmod = mod
73
+ _modules[name] = mod
74
+ if not _defaultmod:
75
+ raise ImportError("no dbm clone found; tried %s" % _names)
76
+
77
+ # guess the type of an existing database, if not creating a new one
78
+ result = whichdb(file) if 'n' not in flag else None
79
+ if result is None:
80
+ # db doesn't exist or 'n' flag was specified to create a new db
81
+ if 'c' in flag or 'n' in flag:
82
+ # file doesn't exist and the new flag was used so use default type
83
+ mod = _defaultmod
84
+ else:
85
+ raise error[0]("db file doesn't exist; "
86
+ "use 'c' or 'n' flag to create a new db")
87
+ elif result == "":
88
+ # db type cannot be determined
89
+ raise error[0]("db type could not be determined")
90
+ elif result not in _modules:
91
+ raise error[0]("db type is {0}, but the module is not "
92
+ "available".format(result))
93
+ else:
94
+ mod = _modules[result]
95
+ return mod.open(file, flag, mode)
96
+
97
+
98
+ def whichdb(filename):
99
+ """Guess which db package to use to open a db file.
100
+
101
+ Return values:
102
+
103
+ - None if the database file can't be read;
104
+ - empty string if the file can be read but can't be recognized
105
+ - the name of the dbm submodule (e.g. "ndbm" or "gnu") if recognized.
106
+
107
+ Importing the given module may still fail, and opening the
108
+ database using that module may still fail.
109
+ """
110
+
111
+ # Check for ndbm first -- this has a .pag and a .dir file
112
+ try:
113
+ f = io.open(filename + ".pag", "rb")
114
+ f.close()
115
+ f = io.open(filename + ".dir", "rb")
116
+ f.close()
117
+ return "dbm.ndbm"
118
+ except OSError:
119
+ # some dbm emulations based on Berkeley DB generate a .db file
120
+ # some do not, but they should be caught by the bsd checks
121
+ try:
122
+ f = io.open(filename + ".db", "rb")
123
+ f.close()
124
+ # guarantee we can actually open the file using dbm
125
+ # kind of overkill, but since we are dealing with emulations
126
+ # it seems like a prudent step
127
+ if ndbm is not None:
128
+ d = ndbm.open(filename)
129
+ d.close()
130
+ return "dbm.ndbm"
131
+ except OSError:
132
+ pass
133
+
134
+ # Check for dumbdbm next -- this has a .dir and a .dat file
135
+ try:
136
+ # First check for presence of files
137
+ os.stat(filename + ".dat")
138
+ size = os.stat(filename + ".dir").st_size
139
+ # dumbdbm files with no keys are empty
140
+ if size == 0:
141
+ return "dbm.dumb"
142
+ f = io.open(filename + ".dir", "rb")
143
+ try:
144
+ if f.read(1) in (b"'", b'"'):
145
+ return "dbm.dumb"
146
+ finally:
147
+ f.close()
148
+ except OSError:
149
+ pass
150
+
151
+ # See if the file exists, return None if not
152
+ try:
153
+ f = io.open(filename, "rb")
154
+ except OSError:
155
+ return None
156
+
157
+ with f:
158
+ # Read the start of the file -- the magic number
159
+ s16 = f.read(16)
160
+ s = s16[0:4]
161
+
162
+ # Return "" if not at least 4 bytes
163
+ if len(s) != 4:
164
+ return ""
165
+
166
+ # Convert to 4-byte int in native byte order -- return "" if impossible
167
+ try:
168
+ (magic,) = struct.unpack("=l", s)
169
+ except struct.error:
170
+ return ""
171
+
172
+ # Check for GNU dbm
173
+ if magic in (0x13579ace, 0x13579acd, 0x13579acf):
174
+ return "dbm.gnu"
175
+
176
+ # Later versions of Berkeley db hash file have a 12-byte pad in
177
+ # front of the file type
178
+ try:
179
+ (magic,) = struct.unpack("=l", s16[-4:])
180
+ except struct.error:
181
+ return ""
182
+
183
+ # Unknown
184
+ return ""
185
+
186
+
187
+ if __name__ == "__main__":
188
+ for filename in sys.argv[1:]:
189
+ print(whichdb(filename) or "UNKNOWN", filename)
evalkit_cambrian/lib/python3.10/venv/scripts/common/Activate.ps1 ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <#
2
+ .Synopsis
3
+ Activate a Python virtual environment for the current PowerShell session.
4
+
5
+ .Description
6
+ Pushes the python executable for a virtual environment to the front of the
7
+ $Env:PATH environment variable and sets the prompt to signify that you are
8
+ in a Python virtual environment. Makes use of the command line switches as
9
+ well as the `pyvenv.cfg` file values present in the virtual environment.
10
+
11
+ .Parameter VenvDir
12
+ Path to the directory that contains the virtual environment to activate. The
13
+ default value for this is the parent of the directory that the Activate.ps1
14
+ script is located within.
15
+
16
+ .Parameter Prompt
17
+ The prompt prefix to display when this virtual environment is activated. By
18
+ default, this prompt is the name of the virtual environment folder (VenvDir)
19
+ surrounded by parentheses and followed by a single space (ie. '(.venv) ').
20
+
21
+ .Example
22
+ Activate.ps1
23
+ Activates the Python virtual environment that contains the Activate.ps1 script.
24
+
25
+ .Example
26
+ Activate.ps1 -Verbose
27
+ Activates the Python virtual environment that contains the Activate.ps1 script,
28
+ and shows extra information about the activation as it executes.
29
+
30
+ .Example
31
+ Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
32
+ Activates the Python virtual environment located in the specified location.
33
+
34
+ .Example
35
+ Activate.ps1 -Prompt "MyPython"
36
+ Activates the Python virtual environment that contains the Activate.ps1 script,
37
+ and prefixes the current prompt with the specified string (surrounded in
38
+ parentheses) while the virtual environment is active.
39
+
40
+ .Notes
41
+ On Windows, it may be required to enable this Activate.ps1 script by setting the
42
+ execution policy for the user. You can do this by issuing the following PowerShell
43
+ command:
44
+
45
+ PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
46
+
47
+ For more information on Execution Policies:
48
+ https://go.microsoft.com/fwlink/?LinkID=135170
49
+
50
+ #>
51
+ Param(
52
+ [Parameter(Mandatory = $false)]
53
+ [String]
54
+ $VenvDir,
55
+ [Parameter(Mandatory = $false)]
56
+ [String]
57
+ $Prompt
58
+ )
59
+
60
+ <# Function declarations --------------------------------------------------- #>
61
+
62
+ <#
63
+ .Synopsis
64
+ Remove all shell session elements added by the Activate script, including the
65
+ addition of the virtual environment's Python executable from the beginning of
66
+ the PATH variable.
67
+
68
+ .Parameter NonDestructive
69
+ If present, do not remove this function from the global namespace for the
70
+ session.
71
+
72
+ #>
73
+ function global:deactivate ([switch]$NonDestructive) {
74
+ # Revert to original values
75
+
76
+ # The prior prompt:
77
+ if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
78
+ Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
79
+ Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
80
+ }
81
+
82
+ # The prior PYTHONHOME:
83
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
84
+ Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
85
+ Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
86
+ }
87
+
88
+ # The prior PATH:
89
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
90
+ Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
91
+ Remove-Item -Path Env:_OLD_VIRTUAL_PATH
92
+ }
93
+
94
+ # Just remove the VIRTUAL_ENV altogether:
95
+ if (Test-Path -Path Env:VIRTUAL_ENV) {
96
+ Remove-Item -Path env:VIRTUAL_ENV
97
+ }
98
+
99
+ # Just remove VIRTUAL_ENV_PROMPT altogether.
100
+ if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
101
+ Remove-Item -Path env:VIRTUAL_ENV_PROMPT
102
+ }
103
+
104
+ # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
105
+ if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
106
+ Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
107
+ }
108
+
109
+ # Leave deactivate function in the global namespace if requested:
110
+ if (-not $NonDestructive) {
111
+ Remove-Item -Path function:deactivate
112
+ }
113
+ }
114
+
115
+ <#
116
+ .Description
117
+ Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
118
+ given folder, and returns them in a map.
119
+
120
+ For each line in the pyvenv.cfg file, if that line can be parsed into exactly
121
+ two strings separated by `=` (with any amount of whitespace surrounding the =)
122
+ then it is considered a `key = value` line. The left hand string is the key,
123
+ the right hand is the value.
124
+
125
+ If the value starts with a `'` or a `"` then the first and last character is
126
+ stripped from the value before being captured.
127
+
128
+ .Parameter ConfigDir
129
+ Path to the directory that contains the `pyvenv.cfg` file.
130
+ #>
131
+ function Get-PyVenvConfig(
132
+ [String]
133
+ $ConfigDir
134
+ ) {
135
+ Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
136
+
137
+ # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
138
+ $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
139
+
140
+ # An empty map will be returned if no config file is found.
141
+ $pyvenvConfig = @{ }
142
+
143
+ if ($pyvenvConfigPath) {
144
+
145
+ Write-Verbose "File exists, parse `key = value` lines"
146
+ $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
147
+
148
+ $pyvenvConfigContent | ForEach-Object {
149
+ $keyval = $PSItem -split "\s*=\s*", 2
150
+ if ($keyval[0] -and $keyval[1]) {
151
+ $val = $keyval[1]
152
+
153
+ # Remove extraneous quotations around a string value.
154
+ if ("'""".Contains($val.Substring(0, 1))) {
155
+ $val = $val.Substring(1, $val.Length - 2)
156
+ }
157
+
158
+ $pyvenvConfig[$keyval[0]] = $val
159
+ Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
160
+ }
161
+ }
162
+ }
163
+ return $pyvenvConfig
164
+ }
165
+
166
+
167
+ <# Begin Activate script --------------------------------------------------- #>
168
+
169
+ # Determine the containing directory of this script
170
+ $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
171
+ $VenvExecDir = Get-Item -Path $VenvExecPath
172
+
173
+ Write-Verbose "Activation script is located in path: '$VenvExecPath'"
174
+ Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
175
+ Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
176
+
177
+ # Set values required in priority: CmdLine, ConfigFile, Default
178
+ # First, get the location of the virtual environment, it might not be
179
+ # VenvExecDir if specified on the command line.
180
+ if ($VenvDir) {
181
+ Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
182
+ }
183
+ else {
184
+ Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
185
+ $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
186
+ Write-Verbose "VenvDir=$VenvDir"
187
+ }
188
+
189
+ # Next, read the `pyvenv.cfg` file to determine any required value such
190
+ # as `prompt`.
191
+ $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
192
+
193
+ # Next, set the prompt from the command line, or the config file, or
194
+ # just use the name of the virtual environment folder.
195
+ if ($Prompt) {
196
+ Write-Verbose "Prompt specified as argument, using '$Prompt'"
197
+ }
198
+ else {
199
+ Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
200
+ if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
201
+ Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
202
+ $Prompt = $pyvenvCfg['prompt'];
203
+ }
204
+ else {
205
+ Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
206
+ Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
207
+ $Prompt = Split-Path -Path $venvDir -Leaf
208
+ }
209
+ }
210
+
211
+ Write-Verbose "Prompt = '$Prompt'"
212
+ Write-Verbose "VenvDir='$VenvDir'"
213
+
214
+ # Deactivate any currently active virtual environment, but leave the
215
+ # deactivate function in place.
216
+ deactivate -nondestructive
217
+
218
+ # Now set the environment variable VIRTUAL_ENV, used by many tools to determine
219
+ # that there is an activated venv.
220
+ $env:VIRTUAL_ENV = $VenvDir
221
+
222
+ if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
223
+
224
+ Write-Verbose "Setting prompt to '$Prompt'"
225
+
226
+ # Set the prompt to include the env name
227
+ # Make sure _OLD_VIRTUAL_PROMPT is global
228
+ function global:_OLD_VIRTUAL_PROMPT { "" }
229
+ Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
230
+ New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
231
+
232
+ function global:prompt {
233
+ Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
234
+ _OLD_VIRTUAL_PROMPT
235
+ }
236
+ $env:VIRTUAL_ENV_PROMPT = $Prompt
237
+ }
238
+
239
+ # Clear PYTHONHOME
240
+ if (Test-Path -Path Env:PYTHONHOME) {
241
+ Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
242
+ Remove-Item -Path Env:PYTHONHOME
243
+ }
244
+
245
+ # Add the venv to the PATH
246
+ Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
247
+ $Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
evalkit_cambrian/lib/python3.10/wsgiref/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (981 Bytes). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/__pycache__/__main__.cpython-310.pyc ADDED
Binary file (348 Bytes). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/__pycache__/_version.cpython-310.pyc ADDED
Binary file (489 Bytes). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (749 Bytes). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/compiler.cpython-310.pyc ADDED
Binary file (12.7 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/cudamath.cpython-310.pyc ADDED
Binary file (3.63 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/device_init.cpython-310.pyc ADDED
Binary file (3.41 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/dispatcher.cpython-310.pyc ADDED
Binary file (32.1 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/intrinsic_wrapper.cpython-310.pyc ADDED
Binary file (2.58 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/printimpl.cpython-310.pyc ADDED
Binary file (2.81 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/types.cpython-310.pyc ADDED
Binary file (1.16 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/__pycache__/vectorizers.cpython-310.pyc ADDED
Binary file (9.36 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/__init__.py ADDED
File without changes
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/__pycache__/reduction.cpython-310.pyc ADDED
Binary file (7.19 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/reduction.py ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ A library written in CUDA Python for generating reduction kernels
3
+ """
4
+
5
+ from numba.np.numpy_support import from_dtype
6
+
7
+
8
+ _WARPSIZE = 32
9
+ _NUMWARPS = 4
10
+
11
+
12
+ def _gpu_reduce_factory(fn, nbtype):
13
+ from numba import cuda
14
+
15
+ reduce_op = cuda.jit(device=True)(fn)
16
+ inner_sm_size = _WARPSIZE + 1 # plus one to avoid SM collision
17
+ max_blocksize = _NUMWARPS * _WARPSIZE
18
+
19
+ @cuda.jit(device=True)
20
+ def inner_warp_reduction(sm_partials, init):
21
+ """
22
+ Compute reduction within a single warp
23
+ """
24
+ tid = cuda.threadIdx.x
25
+ warpid = tid // _WARPSIZE
26
+ laneid = tid % _WARPSIZE
27
+
28
+ sm_this = sm_partials[warpid, :]
29
+ sm_this[laneid] = init
30
+ cuda.syncwarp()
31
+
32
+ width = _WARPSIZE // 2
33
+ while width:
34
+ if laneid < width:
35
+ old = sm_this[laneid]
36
+ sm_this[laneid] = reduce_op(old, sm_this[laneid + width])
37
+ cuda.syncwarp()
38
+ width //= 2
39
+
40
+ @cuda.jit(device=True)
41
+ def device_reduce_full_block(arr, partials, sm_partials):
42
+ """
43
+ Partially reduce `arr` into `partials` using `sm_partials` as working
44
+ space. The algorithm goes like:
45
+
46
+ array chunks of 128: | 0 | 128 | 256 | 384 | 512 |
47
+ block-0: | x | | | x | |
48
+ block-1: | | x | | | x |
49
+ block-2: | | | x | | |
50
+
51
+ The array is divided into chunks of 128 (size of a threadblock).
52
+ The threadblocks consumes the chunks in roundrobin scheduling.
53
+ First, a threadblock loads a chunk into temp memory. Then, all
54
+ subsequent chunks are combined into the temp memory.
55
+
56
+ Once all chunks are processed. Inner-block reduction is performed
57
+ on the temp memory. So that, there will just be one scalar result
58
+ per block. The result from each block is stored to `partials` at
59
+ the dedicated slot.
60
+ """
61
+ tid = cuda.threadIdx.x
62
+ blkid = cuda.blockIdx.x
63
+ blksz = cuda.blockDim.x
64
+ gridsz = cuda.gridDim.x
65
+
66
+ # block strided loop to compute the reduction
67
+ start = tid + blksz * blkid
68
+ stop = arr.size
69
+ step = blksz * gridsz
70
+
71
+ # load first value
72
+ tmp = arr[start]
73
+ # loop over all values in block-stride
74
+ for i in range(start + step, stop, step):
75
+ tmp = reduce_op(tmp, arr[i])
76
+
77
+ cuda.syncthreads()
78
+ # inner-warp reduction
79
+ inner_warp_reduction(sm_partials, tmp)
80
+
81
+ cuda.syncthreads()
82
+ # at this point, only the first slot for each warp in tsm_partials
83
+ # is valid.
84
+
85
+ # finish up block reduction
86
+ # warning: this is assuming 4 warps.
87
+ # assert numwarps == 4
88
+ if tid < 2:
89
+ sm_partials[tid, 0] = reduce_op(sm_partials[tid, 0],
90
+ sm_partials[tid + 2, 0])
91
+ cuda.syncwarp()
92
+ if tid == 0:
93
+ partials[blkid] = reduce_op(sm_partials[0, 0], sm_partials[1, 0])
94
+
95
+ @cuda.jit(device=True)
96
+ def device_reduce_partial_block(arr, partials, sm_partials):
97
+ """
98
+ This computes reduction on `arr`.
99
+ This device function must be used by 1 threadblock only.
100
+ The blocksize must match `arr.size` and must not be greater than 128.
101
+ """
102
+ tid = cuda.threadIdx.x
103
+ blkid = cuda.blockIdx.x
104
+ blksz = cuda.blockDim.x
105
+ warpid = tid // _WARPSIZE
106
+ laneid = tid % _WARPSIZE
107
+
108
+ size = arr.size
109
+ # load first value
110
+ tid = cuda.threadIdx.x
111
+ value = arr[tid]
112
+ sm_partials[warpid, laneid] = value
113
+
114
+ cuda.syncthreads()
115
+
116
+ if (warpid + 1) * _WARPSIZE < size:
117
+ # fully populated warps
118
+ inner_warp_reduction(sm_partials, value)
119
+ else:
120
+ # partially populated warps
121
+ # NOTE: this uses a very inefficient sequential algorithm
122
+ if laneid == 0:
123
+ sm_this = sm_partials[warpid, :]
124
+ base = warpid * _WARPSIZE
125
+ for i in range(1, size - base):
126
+ sm_this[0] = reduce_op(sm_this[0], sm_this[i])
127
+
128
+ cuda.syncthreads()
129
+ # finish up
130
+ if tid == 0:
131
+ num_active_warps = (blksz + _WARPSIZE - 1) // _WARPSIZE
132
+
133
+ result = sm_partials[0, 0]
134
+ for i in range(1, num_active_warps):
135
+ result = reduce_op(result, sm_partials[i, 0])
136
+
137
+ partials[blkid] = result
138
+
139
+ def gpu_reduce_block_strided(arr, partials, init, use_init):
140
+ """
141
+ Perform reductions on *arr* and writing out partial reduction result
142
+ into *partials*. The length of *partials* is determined by the
143
+ number of threadblocks. The initial value is set with *init*.
144
+
145
+ Launch config:
146
+
147
+ Blocksize must be multiple of warpsize and it is limited to 4 warps.
148
+ """
149
+ tid = cuda.threadIdx.x
150
+
151
+ sm_partials = cuda.shared.array((_NUMWARPS, inner_sm_size),
152
+ dtype=nbtype)
153
+ if cuda.blockDim.x == max_blocksize:
154
+ device_reduce_full_block(arr, partials, sm_partials)
155
+ else:
156
+ device_reduce_partial_block(arr, partials, sm_partials)
157
+ # deal with the initializer
158
+ if use_init and tid == 0 and cuda.blockIdx.x == 0:
159
+ partials[0] = reduce_op(partials[0], init)
160
+
161
+ return cuda.jit(gpu_reduce_block_strided)
162
+
163
+
164
+ class Reduce(object):
165
+ """Create a reduction object that reduces values using a given binary
166
+ function. The binary function is compiled once and cached inside this
167
+ object. Keeping this object alive will prevent re-compilation.
168
+ """
169
+
170
+ _cache = {}
171
+
172
+ def __init__(self, functor):
173
+ """
174
+ :param functor: A function implementing a binary operation for
175
+ reduction. It will be compiled as a CUDA device
176
+ function using ``cuda.jit(device=True)``.
177
+ """
178
+ self._functor = functor
179
+
180
+ def _compile(self, dtype):
181
+ key = self._functor, dtype
182
+ if key in self._cache:
183
+ kernel = self._cache[key]
184
+ else:
185
+ kernel = _gpu_reduce_factory(self._functor, from_dtype(dtype))
186
+ self._cache[key] = kernel
187
+ return kernel
188
+
189
+ def __call__(self, arr, size=None, res=None, init=0, stream=0):
190
+ """Performs a full reduction.
191
+
192
+ :param arr: A host or device array.
193
+ :param size: Optional integer specifying the number of elements in
194
+ ``arr`` to reduce. If this parameter is not specified, the
195
+ entire array is reduced.
196
+ :param res: Optional device array into which to write the reduction
197
+ result to. The result is written into the first element of
198
+ this array. If this parameter is specified, then no
199
+ communication of the reduction output takes place from the
200
+ device to the host.
201
+ :param init: Optional initial value for the reduction, the type of which
202
+ must match ``arr.dtype``.
203
+ :param stream: Optional CUDA stream in which to perform the reduction.
204
+ If no stream is specified, the default stream of 0 is
205
+ used.
206
+ :return: If ``res`` is specified, ``None`` is returned. Otherwise, the
207
+ result of the reduction is returned.
208
+ """
209
+ from numba import cuda
210
+
211
+ # ensure 1d array
212
+ if arr.ndim != 1:
213
+ raise TypeError("only support 1D array")
214
+
215
+ # adjust array size
216
+ if size is not None:
217
+ arr = arr[:size]
218
+
219
+ init = arr.dtype.type(init) # ensure the right type
220
+
221
+ # return `init` if `arr` is empty
222
+ if arr.size < 1:
223
+ return init
224
+
225
+ kernel = self._compile(arr.dtype)
226
+
227
+ # Perform the reduction on the GPU
228
+ blocksize = _NUMWARPS * _WARPSIZE
229
+ size_full = (arr.size // blocksize) * blocksize
230
+ size_partial = arr.size - size_full
231
+ full_blockct = min(size_full // blocksize, _WARPSIZE * 2)
232
+
233
+ # allocate size of partials array
234
+ partials_size = full_blockct
235
+ if size_partial:
236
+ partials_size += 1
237
+ partials = cuda.device_array(shape=partials_size, dtype=arr.dtype)
238
+
239
+ if size_full:
240
+ # kernel for the fully populated threadblocks
241
+ kernel[full_blockct, blocksize, stream](arr[:size_full],
242
+ partials[:full_blockct],
243
+ init,
244
+ True)
245
+
246
+ if size_partial:
247
+ # kernel for partially populated threadblocks
248
+ kernel[1, size_partial, stream](arr[size_full:],
249
+ partials[full_blockct:],
250
+ init,
251
+ not full_blockct)
252
+
253
+ if partials.size > 1:
254
+ # finish up
255
+ kernel[1, partials_size, stream](partials, partials, init, False)
256
+
257
+ # handle return value
258
+ if res is not None:
259
+ res[:1].copy_to_device(partials[:1], stream=stream)
260
+ return
261
+ else:
262
+ return partials[0]
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/kernels/transpose.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numba import cuda
2
+ from numba.cuda.cudadrv.driver import driver
3
+ import math
4
+ from numba.np import numpy_support as nps
5
+
6
+
7
+ def transpose(a, b=None):
8
+ """Compute the transpose of 'a' and store it into 'b', if given,
9
+ and return it. If 'b' is not given, allocate a new array
10
+ and return that.
11
+
12
+ This implements the algorithm documented in
13
+ http://devblogs.nvidia.com/parallelforall/efficient-matrix-transpose-cuda-cc/
14
+
15
+ :param a: an `np.ndarray` or a `DeviceNDArrayBase` subclass. If already on
16
+ the device its stream will be used to perform the transpose (and to copy
17
+ `b` to the device if necessary).
18
+ """
19
+
20
+ # prefer `a`'s stream if
21
+ stream = getattr(a, 'stream', 0)
22
+
23
+ if not b:
24
+ cols, rows = a.shape
25
+ strides = a.dtype.itemsize * cols, a.dtype.itemsize
26
+ b = cuda.cudadrv.devicearray.DeviceNDArray(
27
+ (rows, cols),
28
+ strides,
29
+ dtype=a.dtype,
30
+ stream=stream)
31
+
32
+ dt = nps.from_dtype(a.dtype)
33
+
34
+ tpb = driver.get_device().MAX_THREADS_PER_BLOCK
35
+ # we need to factor available threads into x and y axis
36
+ tile_width = int(math.pow(2, math.log(tpb, 2) / 2))
37
+ tile_height = int(tpb / tile_width)
38
+
39
+ tile_shape = (tile_height, tile_width + 1)
40
+
41
+ @cuda.jit
42
+ def kernel(input, output):
43
+
44
+ tile = cuda.shared.array(shape=tile_shape, dtype=dt)
45
+
46
+ tx = cuda.threadIdx.x
47
+ ty = cuda.threadIdx.y
48
+ bx = cuda.blockIdx.x * cuda.blockDim.x
49
+ by = cuda.blockIdx.y * cuda.blockDim.y
50
+ x = by + tx
51
+ y = bx + ty
52
+
53
+ if by + ty < input.shape[0] and bx + tx < input.shape[1]:
54
+ tile[ty, tx] = input[by + ty, bx + tx]
55
+ cuda.syncthreads()
56
+ if y < output.shape[0] and x < output.shape[1]:
57
+ output[y, x] = tile[tx, ty]
58
+
59
+ # one block per tile, plus one for remainders
60
+ blocks = int(b.shape[0] / tile_height + 1), int(b.shape[1] / tile_width + 1)
61
+ # one thread per tile element
62
+ threads = tile_height, tile_width
63
+ kernel[blocks, threads, stream](a, b)
64
+
65
+ return b
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (508 Bytes). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/cache_usecases.cpython-310.pyc ADDED
Binary file (6.44 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/cache_with_cpu_usecases.cpython-310.pyc ADDED
Binary file (1.72 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/extensions_usecases.cpython-310.pyc ADDED
Binary file (2.36 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_array_methods.cpython-310.pyc ADDED
Binary file (1.32 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_blackscholes.cpython-310.pyc ADDED
Binary file (3.77 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_caching.cpython-310.pyc ADDED
Binary file (13.3 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_complex_kernel.cpython-310.pyc ADDED
Binary file (1.11 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_cuda_jit_no_types.cpython-310.pyc ADDED
Binary file (3.38 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_datetime.cpython-310.pyc ADDED
Binary file (3.99 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_debug.cpython-310.pyc ADDED
Binary file (4.02 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_freevar.cpython-310.pyc ADDED
Binary file (1.18 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_frexp_ldexp.cpython-310.pyc ADDED
Binary file (2.59 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_globals.cpython-310.pyc ADDED
Binary file (2.04 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_gufunc_scalar.cpython-310.pyc ADDED
Binary file (5.05 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_gufunc_scheduling.cpython-310.pyc ADDED
Binary file (2.51 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_inspect.cpython-310.pyc ADDED
Binary file (5.11 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_intrinsics.cpython-310.pyc ADDED
Binary file (35.5 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_ipc.cpython-310.pyc ADDED
Binary file (8.23 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_iterators.cpython-310.pyc ADDED
Binary file (2.86 kB). View file
 
evalkit_tf449/lib/python3.10/site-packages/numba/cuda/tests/cudapy/__pycache__/test_laplace.cpython-310.pyc ADDED
Binary file (2.72 kB). View file