passagemath-repl 10.5.42__py3-none-any.whl → 10.5.44__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_repl-10.5.44.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.5.44.dist-info}/METADATA +3 -3
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.5.44.dist-info}/RECORD +29 -31
- sage/doctest/util.py +8 -2
- sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +1 -1
- sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +1 -1
- sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +1 -1
- passagemath_repl-10.5.42.data/data/share/jupyter/kernels/sagemath/kernel.json +0 -1
- sage/interfaces/cleaner.py +0 -48
- sage/interfaces/quit.py +0 -178
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/data/share/jupyter/kernels/sagemath/logo.svg +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.42.data → passagemath_repl-10.5.44.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.5.44.dist-info}/WHEEL +0 -0
- {passagemath_repl-10.5.42.dist-info → passagemath_repl-10.5.44.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"argv": ["python3", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"], "display_name": "passagemath 10.5.44", "language": "sage"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: passagemath-repl
|
3
|
-
Version: 10.5.
|
3
|
+
Version: 10.5.44
|
4
4
|
Summary: passagemath: IPython kernel, Sage preparser, doctester
|
5
5
|
Author-email: The Sage Developers <sage-support@googlegroups.com>
|
6
6
|
Maintainer: Matthias Köppe, passagemath contributors
|
@@ -28,8 +28,8 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
28
28
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
29
29
|
Requires-Python: <3.14,>=3.9
|
30
30
|
Description-Content-Type: text/x-rst
|
31
|
-
Requires-Dist: passagemath-objects~=10.5.
|
32
|
-
Requires-Dist: passagemath-environment~=10.5.
|
31
|
+
Requires-Dist: passagemath-objects~=10.5.44.0
|
32
|
+
Requires-Dist: passagemath-environment~=10.5.44.0
|
33
33
|
Requires-Dist: ipykernel>=5.2.1
|
34
34
|
Requires-Dist: ipython>=7.13.0
|
35
35
|
Requires-Dist: ipywidgets>=7.5.1
|
@@ -1,24 +1,24 @@
|
|
1
|
-
passagemath_repl-10.5.
|
2
|
-
passagemath_repl-10.5.
|
3
|
-
passagemath_repl-10.5.
|
4
|
-
passagemath_repl-10.5.
|
5
|
-
passagemath_repl-10.5.
|
6
|
-
passagemath_repl-10.5.
|
7
|
-
passagemath_repl-10.5.
|
8
|
-
passagemath_repl-10.5.
|
9
|
-
passagemath_repl-10.5.
|
10
|
-
passagemath_repl-10.5.
|
11
|
-
passagemath_repl-10.5.
|
12
|
-
passagemath_repl-10.5.
|
13
|
-
passagemath_repl-10.5.
|
14
|
-
passagemath_repl-10.5.
|
15
|
-
passagemath_repl-10.5.
|
16
|
-
passagemath_repl-10.5.
|
17
|
-
passagemath_repl-10.5.
|
18
|
-
passagemath_repl-10.5.
|
19
|
-
passagemath_repl-10.5.
|
20
|
-
passagemath_repl-10.5.
|
21
|
-
passagemath_repl-10.5.
|
1
|
+
passagemath_repl-10.5.44.data/data/share/jupyter/kernels/sagemath/kernel.json,sha256=qBV0H2HMDadseiO_oVJHUw_YKl8zEV1W6zq3DRmP5mQ,141
|
2
|
+
passagemath_repl-10.5.44.data/data/share/jupyter/kernels/sagemath/logo-64x64.png,sha256=pE3myKl2ywp6zDUD0JiMs-lvAk6T4O3z5PdEC_B0ZL4,3421
|
3
|
+
passagemath_repl-10.5.44.data/data/share/jupyter/kernels/sagemath/logo.svg,sha256=C9lkyX-_DqtTKOlcLFRu36k7scdBufRnYdy4AMHa7GQ,19074
|
4
|
+
passagemath_repl-10.5.44.data/scripts/sage-cachegrind,sha256=FRrT4BoRsrATlQOrXALHAbDI_KLhz0XuDOD6xzECEl8,651
|
5
|
+
passagemath_repl-10.5.44.data/scripts/sage-callgrind,sha256=pWhrI8NsVa_XSuay052htjxcM3thrpX8rI6Uj_pK5Uo,442
|
6
|
+
passagemath_repl-10.5.44.data/scripts/sage-cleaner,sha256=vM0CkzbxiSCE0Z85AViQIvoxb5oUz5WOmVOvShbLDUY,7778
|
7
|
+
passagemath_repl-10.5.44.data/scripts/sage-coverage,sha256=IhvqnFvmvNJBMQtiSu5_Qy52a67hG-r3cAeyhYOOj7w,10199
|
8
|
+
passagemath_repl-10.5.44.data/scripts/sage-eval,sha256=4IHv01xH34wJPj61wzcL5ufhoO6Y3UTTGz7b-0YKJFw,266
|
9
|
+
passagemath_repl-10.5.44.data/scripts/sage-fixdoctests,sha256=xcbw2EmxtwE6Xkrdxx2-59srUwSgzenrNwLP0757UNs,37571
|
10
|
+
passagemath_repl-10.5.44.data/scripts/sage-inline-fortran,sha256=T3U943WNPKrxQJuanBhTpXU3jJ5vjaXd56R8yWv_8PM,234
|
11
|
+
passagemath_repl-10.5.44.data/scripts/sage-ipynb2rst,sha256=PynBPdthnpwGbILDRA38IwpT319Ze-g8UMmWaaTnimQ,1345
|
12
|
+
passagemath_repl-10.5.44.data/scripts/sage-ipython,sha256=RYYd8-gmE5JE_-dCkOSDpC6rRsX6i6tma3pqgmXYJvM,342
|
13
|
+
passagemath_repl-10.5.44.data/scripts/sage-massif,sha256=Tfqb6ON9d0OZnt6VlGS21asbdMq8zWzx8ZnvV1n_buI,613
|
14
|
+
passagemath_repl-10.5.44.data/scripts/sage-notebook,sha256=QJ1Y4eTptc6TbNVXZswpcsn-NqaQNuSwjWE-lYmGpW8,8453
|
15
|
+
passagemath_repl-10.5.44.data/scripts/sage-omega,sha256=4ARnHyZyB69ltxHj9xYpzad_YCBT3Nk0Wq3Ke09gExM,595
|
16
|
+
passagemath_repl-10.5.44.data/scripts/sage-preparse,sha256=3L1KKgvSApvoK467Wza0S4WQLCXiYvivrhDKIvA1omc,10595
|
17
|
+
passagemath_repl-10.5.44.data/scripts/sage-run,sha256=F1oAgPN7Kh5dO1smCyfGVT0Dy46NQ_dQ3OQZ8Wa6foM,689
|
18
|
+
passagemath_repl-10.5.44.data/scripts/sage-run-cython,sha256=02mTGXokayRxISoCWWsDcKZwGrmh5B0mJJxTT87J01Q,235
|
19
|
+
passagemath_repl-10.5.44.data/scripts/sage-runtests,sha256=nUvI3fCrBjqPUict01wIxwYPjvaZf4ttLp85tavUEpY,111
|
20
|
+
passagemath_repl-10.5.44.data/scripts/sage-startuptime.py,sha256=RtIuC7jM3SOwROXTa6nnpJhzK0sQ24nDqyE6zXpCWEI,6209
|
21
|
+
passagemath_repl-10.5.44.data/scripts/sage-valgrind,sha256=fZxy00oXU4PpHf_wc2uYKb7lzqSBY4VkhUxiuvXHKhA,1201
|
22
22
|
sage/all__sagemath_repl.py,sha256=z6lERTYuw3I4LQ7-hnEYbY1i-hMJj2uAm2ujOmWitSo,5713
|
23
23
|
sage/doctest/__init__.py,sha256=JJMNkq7Rh3gCshtynqXDTLJgUKweNFlUhpnbvTLRMwg,166
|
24
24
|
sage/doctest/__main__.py,sha256=wGVNiaPbhQwzoAs3Y1xhYBlB18pBieEDhi71ggF8NkQ,13647
|
@@ -35,7 +35,7 @@ sage/doctest/reporting.py,sha256=8SBJ7I6Ea8OAENNdtfns4TlhLNvgF8Ss1Y8tef5-02o,333
|
|
35
35
|
sage/doctest/rif_tol.py,sha256=m8XljRCPyaj_Kpng-sNxsRSo0BJR3QY3CArhjEZ9c5s,4973
|
36
36
|
sage/doctest/sources.py,sha256=JWQikdzIAL8CVfz-AFeqA6JmI-Q_Mm-O8bE3KzA9AQo,63535
|
37
37
|
sage/doctest/test.py,sha256=XU8RASl7HPLM_YoPcyQ9uIwG9oUTUyjl7N7xH74vzdo,22616
|
38
|
-
sage/doctest/util.py,sha256=
|
38
|
+
sage/doctest/util.py,sha256=vSzMRDxGlLjJ0SbT0VuKP-_w8LdSO5jDh-uUWF7zRaM,31025
|
39
39
|
sage/doctest/tests/1second.rst,sha256=CHBQjhfvPPyBQmTslo-G7kC8Jr6i5DujXTT19AewsIk,74
|
40
40
|
sage/doctest/tests/99seconds.rst,sha256=1FUWC-u5vVHqYd2VUUe_GELikmMvUEDZDt-kAU8u4TA,75
|
41
41
|
sage/doctest/tests/abort.rst,sha256=lqKD_TZvcnO38zmXrp76HyLlVZNKd72rbaGGGhPgywQ,164
|
@@ -57,8 +57,6 @@ sage/ext_data/all__sagemath_repl.py,sha256=6mNw0BEw6mZsoOi004elrLvD4m4RffLmgY921
|
|
57
57
|
sage/ext_data/notebook-ipython/logo-64x64.png,sha256=pE3myKl2ywp6zDUD0JiMs-lvAk6T4O3z5PdEC_B0ZL4,3421
|
58
58
|
sage/ext_data/notebook-ipython/logo.svg,sha256=C9lkyX-_DqtTKOlcLFRu36k7scdBufRnYdy4AMHa7GQ,19074
|
59
59
|
sage/interfaces/all__sagemath_repl.py,sha256=6mNw0BEw6mZsoOi004elrLvD4m4RffLmgY921IwsNXk,43
|
60
|
-
sage/interfaces/cleaner.py,sha256=sd8_F8xGC7OMSoWcCPL3VAOPOuXZAOZu0ys1FExKYjQ,1560
|
61
|
-
sage/interfaces/quit.py,sha256=iKuZ8m98g_2CNF4J9pfc-0KbE0HAadFZxwHPSydbrcA,5935
|
62
60
|
sage/misc/all__sagemath_repl.py,sha256=Qxsf_bNAVB4CScgVoD0Lb9_RFwdK8BI3S0aqjFBz88c,1791
|
63
61
|
sage/misc/banner.py,sha256=69sC578x0-t8a_l14w08xMLPBp0wcd8RsdTrcJq7ERQ,7883
|
64
62
|
sage/misc/benchmark.py,sha256=4hW6hTGWfPb_E_U8V19Y_CPRN9_mUMsefrIb1rkzhfQ,6162
|
@@ -172,9 +170,9 @@ sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py,sh
|
|
172
170
|
sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py,sha256=0_g61BiD1KN0uYbushiM8hFbcFhiC_RIJV0oUDyCMdA,12924
|
173
171
|
sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py,sha256=B6u9FVvauYhOt0awu0DJFdsIMwBJgwA7PTbVxsH1B60,9131
|
174
172
|
sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py,sha256=bQrWl-Kj-mRXUVOoibceFmippeZfcTmb2uveSkxS5VA,11971
|
175
|
-
sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py,sha256=
|
173
|
+
sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py,sha256=Xv3YF2bBMrRuU91u1bZ1g3MVOhxz7NFsyZdLH2oyog4,13482
|
176
174
|
sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py,sha256=5TtnZFm0W8x-slYxCmykY062Am_irOfz8ZWkBDOpSCY,6439
|
177
|
-
sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py,sha256=
|
175
|
+
sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py,sha256=p8KUzKMTzIICMzVl0Sd156BNiMH0w7DmLN19Ntu-8CY,15314
|
178
176
|
sage/tests/books/computational-mathematics-with-sagemath/nonlinear_doctest.py,sha256=dtmCBeceWs3S8FoNYprbC1kRphm7WNSnQmccXCoQ3gk,15994
|
179
177
|
sage/tests/books/computational-mathematics-with-sagemath/numbertheory_doctest.py,sha256=V0ODEcX8TKFR3RZFbzsy-sAUSDxuOPjkRkPnyMlEFMM,4287
|
180
178
|
sage/tests/books/computational-mathematics-with-sagemath/polynomes_doctest.py,sha256=4HvSa47suD18pocaTVyZ1-gM2OvtW0kLJvRzGm4PPR4,12171
|
@@ -192,7 +190,7 @@ sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest
|
|
192
190
|
sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py,sha256=jRhas7BbMjf5GJfSojIHjdifaPBUutGDoARRcJV4xto,2324
|
193
191
|
sage/tests/books/computational-mathematics-with-sagemath/sol/linsolve_doctest.py,sha256=lHIxy_4k7bi2B0RIZN7Fww7FIKAdGgtLMulU2vPtDww,808
|
194
192
|
sage/tests/books/computational-mathematics-with-sagemath/sol/lp_doctest.py,sha256=PrUfACtviY3pn2X4M3H48KTm5C1yh9Nh6xWSnwYEUTM,1634
|
195
|
-
sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py,sha256=
|
193
|
+
sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py,sha256=30U9zkSEOY_rCjjlY12tWOWjd2dB4gIB09taAFAU-9U,3777
|
196
194
|
sage/tests/books/computational-mathematics-with-sagemath/sol/nonlinear_doctest.py,sha256=EK6YXSPtCJ-H5v3IZHyHG33J5mIZ8a0jtYYC2xSRZuI,3846
|
197
195
|
sage/tests/books/computational-mathematics-with-sagemath/sol/numbertheory_doctest.py,sha256=HkWcbvfCjtguL9ZyXs_HRmwO6VVkOInaFaF_gXYC_7g,6141
|
198
196
|
sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py,sha256=cm_KDyZR9UgaK66HF0pfQv85LY33YCwtEJXkfZR79sM,3518
|
@@ -229,7 +227,7 @@ sage/tests/memcheck/run_tests.py,sha256=waPUB_tHk1YvSCd45BOXHeWubtA2St4ZQR-O88R3
|
|
229
227
|
sage/tests/memcheck/run_tests_in_valgrind.py,sha256=Ht4-bpgRl2sH4SICRKN5S5VyMhebmCvRRz4ktOmwKFo,933
|
230
228
|
sage/tests/memcheck/symbolic_expression.py,sha256=oEFxHEpGZK8-sCr_vTiVu8bk-e5lTzp4GQSepnGN-OQ,272
|
231
229
|
sage/tests/memcheck/verify_no_leak.py,sha256=6TiUam0TTe1D_Gbaftz5uGSb8QZygRGXQow-WpVH6kg,984
|
232
|
-
passagemath_repl-10.5.
|
233
|
-
passagemath_repl-10.5.
|
234
|
-
passagemath_repl-10.5.
|
235
|
-
passagemath_repl-10.5.
|
230
|
+
passagemath_repl-10.5.44.dist-info/METADATA,sha256=jcSqWgc2gVrHWd8Nralb6u-0oNLrek_Y9vynxpcy9vM,4604
|
231
|
+
passagemath_repl-10.5.44.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
232
|
+
passagemath_repl-10.5.44.dist-info/top_level.txt,sha256=Kmzulf9WsphADFQuqgvdy5mvTLDj_V2zkFHU2s3UXos,6
|
233
|
+
passagemath_repl-10.5.44.dist-info/RECORD,,
|
sage/doctest/util.py
CHANGED
@@ -332,7 +332,10 @@ class Timer:
|
|
332
332
|
sage: Timer().start()
|
333
333
|
{'cputime': ..., 'walltime': ...}
|
334
334
|
"""
|
335
|
-
|
335
|
+
try:
|
336
|
+
from sage.interfaces.quit import expect_objects
|
337
|
+
except ImportError:
|
338
|
+
expect_objects = []
|
336
339
|
self.cputime = self._quick_cputime(expect_objects)
|
337
340
|
self.walltime = walltime()
|
338
341
|
return self
|
@@ -351,7 +354,10 @@ class Timer:
|
|
351
354
|
sage: timer.stop()
|
352
355
|
{'cputime': ..., 'walltime': ...}
|
353
356
|
"""
|
354
|
-
|
357
|
+
try:
|
358
|
+
from sage.interfaces.quit import expect_objects
|
359
|
+
except ImportError:
|
360
|
+
expect_objects = []
|
355
361
|
self.cputime = self._quick_cputime(expect_objects) - self.cputime
|
356
362
|
self.walltime = walltime() - self.walltime
|
357
363
|
return self
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-repl
|
2
|
-
# sage.doctest: needs scipy sage.modules
|
2
|
+
# sage.doctest: needs scipy sage.modules sage.plot
|
3
3
|
r"""
|
4
4
|
This file (./linsolve_doctest.sage) was *autogenerated* from ./linsolve.tex,
|
5
5
|
with sagetex.sty version 2011/05/27 v2.3.1.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-repl
|
2
|
-
# sage.doctest: needs fpylll sage.libs.singular
|
2
|
+
# sage.doctest: needs fpylll sage.libs.singular sage.symbolic
|
3
3
|
r"""
|
4
4
|
This file (./mpoly_doctest.sage) was *autogenerated* from ./mpoly.tex,
|
5
5
|
with sagetex.sty version 2011/05/27 v2.3.1.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# sage_setup: distribution = sagemath-repl
|
2
|
-
# sage.doctest: needs fpylll sage.libs.pari sage.libs.singular sage.rings.number_field
|
2
|
+
# sage.doctest: needs fpylll sage.libs.pari sage.libs.singular sage.rings.number_field sage.symbolic
|
3
3
|
"""
|
4
4
|
This file (./sol/mpoly_doctest.sage) was *autogenerated* from ./sol/mpoly.tex,
|
5
5
|
with sagetex.sty version 2011/05/27 v2.3.1.
|
@@ -1 +0,0 @@
|
|
1
|
-
{"argv": ["python3", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"], "display_name": "passagemath 10.5.42", "language": "sage"}
|
sage/interfaces/cleaner.py
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
# sage_setup: distribution = sagemath-repl
|
2
|
-
"""
|
3
|
-
Interface to the Sage cleaner
|
4
|
-
|
5
|
-
Triva Note: For the name "sage-cleaner", think of the
|
6
|
-
"The Cleaner" from Pulp Fiction:
|
7
|
-
http://www.frankjankowski.de/quiz/illus/keitel.jpg
|
8
|
-
"""
|
9
|
-
# ****************************************************************************
|
10
|
-
# Copyright (C) 2007 William Stein <wstein@gmail.com>
|
11
|
-
#
|
12
|
-
# Distributed under the terms of the GNU General Public License (GPL)
|
13
|
-
# as published by the Free Software Foundation; either version 2 of
|
14
|
-
# the License, or (at your option) any later version.
|
15
|
-
# https://www.gnu.org/licenses/
|
16
|
-
# ****************************************************************************
|
17
|
-
import os
|
18
|
-
import atexit
|
19
|
-
import tempfile
|
20
|
-
|
21
|
-
_spd = tempfile.TemporaryDirectory()
|
22
|
-
SAGE_SPAWNED_PROCESS_FILE = os.path.join(_spd.name, "spawned_processes")
|
23
|
-
atexit.register(lambda: _spd.cleanup())
|
24
|
-
|
25
|
-
|
26
|
-
def start_cleaner():
|
27
|
-
"""
|
28
|
-
Start ``sage-cleaner`` in a new process group.
|
29
|
-
"""
|
30
|
-
if not os.fork():
|
31
|
-
os.setpgid(os.getpid(), os.getpid())
|
32
|
-
|
33
|
-
# Redirect stdin, stdout, stderr to /dev/null
|
34
|
-
with open(os.devnull, "r+") as f:
|
35
|
-
os.dup2(f.fileno(), 0)
|
36
|
-
os.dup2(f.fileno(), 1)
|
37
|
-
os.dup2(f.fileno(), 2)
|
38
|
-
|
39
|
-
# Close all other file descriptors
|
40
|
-
try:
|
41
|
-
maxopenfiles = os.sysconf("SC_OPEN_MAX")
|
42
|
-
if maxopenfiles <= 0:
|
43
|
-
raise ValueError
|
44
|
-
except ValueError:
|
45
|
-
maxopenfiles = 1024
|
46
|
-
os.closerange(3, maxopenfiles)
|
47
|
-
|
48
|
-
os.execlp("sage-cleaner", "sage-cleaner")
|
sage/interfaces/quit.py
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
# sage_setup: distribution = sagemath-repl
|
2
|
-
"""
|
3
|
-
Quitting interfaces
|
4
|
-
"""
|
5
|
-
|
6
|
-
################################################################################
|
7
|
-
# Copyright (C) 2010 William Stein <wstein@gmail.com>
|
8
|
-
#
|
9
|
-
# Distributed under the terms of (any version of) the GNU
|
10
|
-
# General Public License (GPL). The full text of the GPL is available at:
|
11
|
-
#
|
12
|
-
# https://www.gnu.org/licenses/
|
13
|
-
################################################################################
|
14
|
-
|
15
|
-
from __future__ import annotations
|
16
|
-
|
17
|
-
import os
|
18
|
-
import subprocess
|
19
|
-
import sys
|
20
|
-
from typing import TYPE_CHECKING
|
21
|
-
|
22
|
-
from sage.env import DOT_SAGE, HOSTNAME
|
23
|
-
from sage.misc.cachefunc import cached_function
|
24
|
-
|
25
|
-
if TYPE_CHECKING:
|
26
|
-
from weakref import ReferenceType
|
27
|
-
|
28
|
-
from sage.interfaces.expect import Expect
|
29
|
-
|
30
|
-
|
31
|
-
@cached_function
|
32
|
-
def sage_spawned_process_file() -> str:
|
33
|
-
"""
|
34
|
-
EXAMPLES::
|
35
|
-
|
36
|
-
sage: from sage.interfaces.quit import sage_spawned_process_file
|
37
|
-
sage: len(sage_spawned_process_file()) > 1
|
38
|
-
True
|
39
|
-
"""
|
40
|
-
# This is the old value of SAGE_TMP. Until sage-cleaner is
|
41
|
-
# completely removed, we need to leave these spawned_processes
|
42
|
-
# files where sage-cleaner will look for them.
|
43
|
-
d = os.path.join(DOT_SAGE, "temp", HOSTNAME, str(os.getpid()))
|
44
|
-
os.makedirs(d, exist_ok=True)
|
45
|
-
return os.path.join(d, "spawned_processes")
|
46
|
-
|
47
|
-
|
48
|
-
def register_spawned_process(pid: int, cmd: str = "") -> None:
|
49
|
-
"""
|
50
|
-
Write a line to the ``spawned_processes`` file with the given
|
51
|
-
``pid`` and ``cmd``.
|
52
|
-
"""
|
53
|
-
if cmd != "":
|
54
|
-
cmd = cmd.strip().split()[0]
|
55
|
-
# This is safe, since only this process writes to this file.
|
56
|
-
try:
|
57
|
-
with open(sage_spawned_process_file(), "a") as file:
|
58
|
-
file.write("%s %s\n" % (pid, cmd))
|
59
|
-
except OSError:
|
60
|
-
pass
|
61
|
-
else:
|
62
|
-
# If sage is being used as a python library, we need to launch
|
63
|
-
# the cleaner ourselves upon being told that there will be
|
64
|
-
# something to clean.
|
65
|
-
from sage.interfaces.cleaner import start_cleaner
|
66
|
-
|
67
|
-
start_cleaner()
|
68
|
-
|
69
|
-
|
70
|
-
expect_objects: list[ReferenceType[Expect]] = []
|
71
|
-
|
72
|
-
|
73
|
-
def expect_quitall(verbose: bool = False) -> None:
|
74
|
-
"""
|
75
|
-
EXAMPLES::
|
76
|
-
|
77
|
-
sage: sage.interfaces.quit.expect_quitall()
|
78
|
-
sage: gp.eval('a=10') # needs sage.libs.pari
|
79
|
-
'10'
|
80
|
-
sage: gp('a') # needs sage.libs.pari
|
81
|
-
10
|
82
|
-
sage: sage.interfaces.quit.expect_quitall()
|
83
|
-
sage: gp('a') # needs sage.libs.pari
|
84
|
-
a
|
85
|
-
sage: sage.interfaces.quit.expect_quitall(verbose=True) # needs sage.libs.pari
|
86
|
-
Exiting PARI/GP interpreter with PID ... running .../gp --fast --emacs --quiet --stacksize 10000000
|
87
|
-
"""
|
88
|
-
for reference in expect_objects:
|
89
|
-
process = reference()
|
90
|
-
if process is not None:
|
91
|
-
try:
|
92
|
-
process.quit(verbose=verbose)
|
93
|
-
except RuntimeError:
|
94
|
-
pass
|
95
|
-
kill_spawned_jobs()
|
96
|
-
|
97
|
-
|
98
|
-
def kill_spawned_jobs(verbose: bool = False):
|
99
|
-
"""
|
100
|
-
INPUT:
|
101
|
-
|
102
|
-
- ``verbose`` -- boolean (default: ``False``); if ``True``, display a
|
103
|
-
message each time a process is sent a kill signal
|
104
|
-
|
105
|
-
EXAMPLES::
|
106
|
-
|
107
|
-
sage: gp.eval('a=10') # needs sage.libs.pari
|
108
|
-
'10'
|
109
|
-
sage: sage.interfaces.quit.kill_spawned_jobs(verbose=False)
|
110
|
-
sage: sage.interfaces.quit.expect_quitall()
|
111
|
-
sage: gp.eval('a=10') # needs sage.libs.pari
|
112
|
-
'10'
|
113
|
-
sage: sage.interfaces.quit.kill_spawned_jobs(verbose=True) # needs sage.libs.pari
|
114
|
-
Killing spawned job ...
|
115
|
-
|
116
|
-
After doing the above, we do the following to avoid confusion in other doctests::
|
117
|
-
|
118
|
-
sage: sage.interfaces.quit.expect_quitall()
|
119
|
-
"""
|
120
|
-
fname = sage_spawned_process_file()
|
121
|
-
if not os.path.exists(fname):
|
122
|
-
return
|
123
|
-
|
124
|
-
with open(fname) as file:
|
125
|
-
for line in file:
|
126
|
-
i = line.find(" ")
|
127
|
-
pid = line[:i].strip()
|
128
|
-
try:
|
129
|
-
if verbose:
|
130
|
-
print("Killing spawned job %s" % pid)
|
131
|
-
if sys.platform == "win32":
|
132
|
-
# From https://stackoverflow.com/a/47756757/873661
|
133
|
-
subprocess.call(["taskkill", "/F", "/T", "/PID", pid])
|
134
|
-
else:
|
135
|
-
os.killpg(int(pid), 9)
|
136
|
-
except OSError:
|
137
|
-
pass
|
138
|
-
|
139
|
-
|
140
|
-
def is_running(pid: int) -> bool:
|
141
|
-
"""
|
142
|
-
Return ``True`` if and only if there is a process with id pid running.
|
143
|
-
"""
|
144
|
-
try:
|
145
|
-
os.kill(int(pid), 0)
|
146
|
-
return True
|
147
|
-
except (OSError, ValueError):
|
148
|
-
return False
|
149
|
-
|
150
|
-
|
151
|
-
def invalidate_all() -> None:
|
152
|
-
"""
|
153
|
-
Invalidate all of the expect interfaces.
|
154
|
-
|
155
|
-
This is used, e.g., by the fork-based ``@parallel`` decorator.
|
156
|
-
|
157
|
-
EXAMPLES::
|
158
|
-
|
159
|
-
sage: # needs sage.libs.pari sage.symbolic
|
160
|
-
sage: a = maxima(2); b = gp(3)
|
161
|
-
sage: a, b
|
162
|
-
(2, 3)
|
163
|
-
sage: sage.interfaces.quit.invalidate_all()
|
164
|
-
sage: a
|
165
|
-
(invalid Maxima object -- The maxima session in which this object was defined is no longer running.)
|
166
|
-
sage: b
|
167
|
-
(invalid PARI/GP interpreter object -- The pari session in which this object was defined is no longer running.)
|
168
|
-
|
169
|
-
However the maxima and gp sessions should still work out, though with their state reset::
|
170
|
-
|
171
|
-
sage: a = maxima(2); b = gp(3) # needs sage.libs.pari sage.symbolic
|
172
|
-
sage: a, b # needs sage.libs.pari sage.symbolic
|
173
|
-
(2, 3)
|
174
|
-
"""
|
175
|
-
for reference in expect_objects:
|
176
|
-
process = reference()
|
177
|
-
if process:
|
178
|
-
process.detach()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|