Skip to content

Commit c9e0f6c

Browse files
committed
Polish the various utility scripts
Use argparse for more friendly argument parsing, and rename script files so that they can be put on PATH. Add them as script files in setup.py, and install also sagetexparse.py module.
1 parent bf38e72 commit c9e0f6c

File tree

5 files changed

+209
-199
lines changed

5 files changed

+209
-199
lines changed

.gitignore

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,26 @@ E2.sobj
1414
auto/
1515
dist/
1616
example.synctex.gz
17-
extractsagecode.py
1817
makecmds.sty
19-
makestatic.py
20-
remote-sagetex.py
21-
run-sagetex-if-necessary.py
18+
sagetex-extract
19+
sagetex-extract.py
20+
sagetex-makestatic
21+
sagetex-makestatic.py
22+
sagetex-remote
23+
sagetex-remote.py
24+
sagetex-run
25+
sagetex-run.py
2226
sage-plots-for-*.tex/
2327
sagetex.glo
2428
sagetex.gls
2529
sagetex.idx
2630
sagetex.ilg
2731
sagetex.ind
2832
sagetex.py
29-
sagetex.pyc
3033
sagetex.sty
3134
sagetexparse.py
35+
*.pyc
36+
__pycache__
3237
.*.sage-history
3338
.*.sage-chat
3439
MANIFEST

Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ pkg=sagetex
22
dtxs=$(wildcard *.dtx)
33
# the subdir stuff makes the tarball have the directory correct
44
srcs=example.tex README sagetex.ins
5+
pyscripts=sagetex-run sagetex-extract sagetex-makestatic sagetex-remote
56

67
.SUFFIXES:
78

8-
all: sagetex.sty sagetex.py example.pdf $(pkg).pdf
9+
all: sagetex.sty sagetex.py $(pyscripts) $(pkg).pdf example.pdf
910

1011
# just depend on the .ind file, since we'll make the .gls and .ind together;
1112
# TEXOPTS is used by spkg-install to specify nonstopmode when building docs
@@ -35,14 +36,24 @@ sagetex.sty: py-and-sty.dtx $(pkg).dtx
3536
sagetex.py: py-and-sty.dtx $(pkg).dtx
3637
yes | latex $(TEXOPTS) $(pkg).ins
3738

38-
remote-sagetex.py: remote-sagetex.dtx
39+
sagetex-remote.py: remote-sagetex.dtx
3940
yes | latex $(TEXOPTS) $(pkg).ins
41+
mv -f sagetex-remote.py sagetex-remote
42+
chmod +x sagetex-remote
4043

41-
run-sagetex-if-necessary.py makestatic.py extractsagecode.py sagetexparse.py: scripts.dtx
44+
sagetex-run.py sagetex-extract.py sagetex-makestatic.py: py-and-sty.dtx scripts.dtx
4245
yes | latex $(TEXOPTS) $(pkg).ins
4346

47+
%: %.py
48+
cp -f $< $@
49+
chmod +x $@
50+
51+
$(pypkg): $(pypkgfiles)
52+
install -d sagetex
53+
cp -f $(notdir $@) sagetex/
54+
4455
clean: auxclean
45-
rm -fr sage-plots-for-* E2.sobj *.pyc sagetex.tar.gz sagetex.py sagetex.pyc sagetex.sty makestatic.py sagetexparse.py extractsagecode.py dist MANIFEST remote-sagetex.py auto *_doctest.sage *_doctest.sage.py example-*.table run-sagetex-if-necessary.py __pycache__
56+
rm -fr sage-plots-for-* E2.sobj *.pyc sagetex.tar.gz $(pypkg) $(pypkgfiles) $(pyscripts) sagetex.sty dist MANIFEST remote-sagetex.py auto *_doctest.sage *_doctest.sage.py example-*.table __pycache__
4657

4758
auxclean:
4859
/bin/bash -c "rm -f {$(pkg),example}.{glo,gls,aux,out,toc,dvi,pdf,ps,log,ilg,ind,idx,fdb_latexmk,sagetex.*}"
@@ -54,5 +65,5 @@ test:
5465
./test
5566

5667
# make a source distribution, used for building the spkg
57-
dist: sagetex.sty
68+
dist: sagetex.sty $(pypkg) $(pyscripts)
5869
python setup.py sdist --formats=gztar

sagetex.ins

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,22 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
8484
\from{py-and-sty.dtx}{python}}}
8585
\generate{\file{sagetexparse.py}{\from{scripts.dtx}{parsermod}}}
8686

87-
8887
\usedir{scripts/sagetex}
8988

9089
% Now define a new preamble with the shebang line at the top.
9190

9291
\def\envpypreamble{\hash!/usr/bin/env python^^J\pypreamble}
9392
\usepreamble\envpypreamble
9493

95-
\generate{\file{run-sagetex-if-necessary.py}{\from{scripts.dtx}{ifnecessaryscript}}}
96-
\generate{\file{makestatic.py}{\from{scripts.dtx}{staticscript}}}
97-
\generate{\file{extractsagecode.py}{\from{scripts.dtx}{extractscript}}}
98-
\generate{\file{remote-sagetex.py}{\from{remote-sagetex.dtx}{remotesagetex}}}
94+
\generate{\file{sagetex-run.py}{\from{scripts.dtx}{ifnecessaryscript}}}
95+
\generate{\file{sagetex-makestatic.py}{\from{scripts.dtx}{staticscript}}}
96+
\generate{\file{sagetex-extract.py}{\from{scripts.dtx}{extractscript}}}
97+
\generate{\file{sagetex-remote.py}{\from{remote-sagetex.dtx}{remotesagetex}}}
9998

10099
\obeyspaces
101100
\Msg{******************************************************************}
102101
\Msg{* *}
103-
\Msg{* To finish the installation, move the following files *}
102+
\Msg{* To finish the installation, move the following file/package *}
104103
\Msg{* into directories searched by TeX and Sage, respectively: *}
105104
\Msg{* *}
106105
\Msg{* sagetex.sty *}

0 commit comments

Comments
 (0)