Skip to content

Commit 41adc43

Browse files
committed
Add autoload file for CLI
1 parent 13a7b7f commit 41adc43

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

CHANGES.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Enhancements
4141
* ``FileNames`` returns a sorted list (#1250).
4242
* ``FindRoot`` now receives several optional parameters like ``Method`` and ``MaxIterations``.
4343
* ``FixedPoint`` now supports the ``SameTest`` option.
44+
* ``mathics`` CLI now uses its own Mathics ``settings.m`` file
4445
* ``Prepend`` works with ``DownValues`` Issue #1251
4546
* ``Prime`` and ``PrimePi`` now accept a list parameter and have the ``NumericFunction`` attribute.
4647
* ``Read`` with ``Hold[Expression]`` now supported. (#1242)
@@ -66,10 +67,16 @@ Bug fixes
6667
* Functions gone over to ensure the ``Listable`` and ``NumericFunction`` properties are correct.
6768

6869

70+
Incompatible changes
71+
--------------------
72+
73+
``System`$UseSansSerif`` moved from core and is sent front-ends using ``Settings`$UseSansSerif``.
74+
6975
Internal changes
7076
----------------
7177

72-
* doctest accepts the option `-d` to show how long it takes to parse, evaluate and compare each individual test.
78+
* doctest accepts the option ``-d`` to show how long it takes to parse, evaluate and compare each individual test.
79+
``-x`` option (akin to ``pytests -x`` is a short-hand for stop on first error
7380

7481

7582
2.1.0

mathics/autoload-cli/settings.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(***********************************)
2+
(* Settings for Mathics CLI script *)
3+
(***********************************)
4+
5+
System`$Notebooks::usage = "Set True if the Mathics is being used with a notebook-based front end.";
6+
System`$Notebooks = False;

mathics/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
import subprocess
99
import sys
1010

11+
import os.path as osp
1112
from mathics.core.parser import MathicsFileLineFeeder, MathicsLineFeeder
1213

13-
from mathics.core.definitions import Definitions, Symbol
14+
from mathics.core.definitions import autoload_files, Definitions, Symbol
1415
from mathics.core.expression import strip_context
1516
from mathics.core.evaluation import Evaluation, Output
1617
from mathics import version_string, license_string, __version__
1718
from mathics import settings
1819

20+
def get_srcdir():
21+
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
22+
return osp.realpath(filename)
1923

2024
class TerminalShell(MathicsLineFeeder):
2125
def __init__(self, definitions, colors, want_readline, want_completion):
@@ -82,6 +86,7 @@ def __init__(self, definitions, colors, want_readline, want_completion):
8286

8387
self.incolors, self.outcolors = term_colors
8488
self.definitions = definitions
89+
autoload_files(definitions, get_srcdir(), "autoload-cli")
8590

8691
def get_last_line_number(self):
8792
return self.definitions.get_line_no()

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def subdirs(root, file="*.*", depth=10):
144144
"doc/xml/data",
145145
"doc/tex/data",
146146
"autoload/*.m",
147+
"autoload-cli/*.m",
147148
"autoload/formats/*/Import.m",
148149
"autoload/formats/*/Export.m",
149150
"packages/*/*.m",

0 commit comments

Comments
 (0)