forked from PreTeXtBook/pretext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmbx
executable file
·67 lines (56 loc) · 2.6 KB
/
mbx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
# ********************************************************************
# Copyright 2010-2020 Robert A. Beezer
#
# This file is part of PreTeXt.
#
# PreTeXt is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 or version 3 of the
# License (at your option).
#
# PreTeXt is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
# *********************************************************************
# 2020-05-21: this is a quick-and-dirty attempt to provide
# backward-compatibility for the old script/mbx script
import os.path, sys, subprocess
msg = """*********************************************************************
*********************************************************************
The script/mbx script has been retired and has
been replaced by the pretext/pretext script. You may need
to give this new script permission to execute. Furthermore,
the stock configuration file, script/mbx.cfg, has moved to
pretext/pretext.cfg, requiring no changes on your part.
But if you have a custom configuration file, user/mbx.cfg,
then you will need to rename it to user/pretext.cfg.
PRESS A KEY TO ACKNOWLEDGE THIS MESSAGE, and then we will
attempt to run the new script for you with either a new custom
configuration file, or if unavailable, your old one.
Please do not rely on this fallback behavior, and please make the
necessary changes soon. We apologize for the inconvenience.
Thank-you.
2020-05-21
*********************************************************************
*********************************************************************"""
print(msg) # to inform
input() # to annoy/cripple
# Orient onesself, form replacement script filename
mbx_file = os.path.abspath(sys.argv[0])
script_dir, _ = os.path.split(mbx_file)
distribution_dir, _ = os.path.split(script_dir)
new_exec = os.path.join(distribution_dir, 'pretext', 'pretext')
# repeat command line, but sub in new script
cmd = sys.argv
cmd[0] = new_exec
print("ATTEMPTING new pretext/pretext script with command line:")
print(' '.join(cmd))
print("2020-05-21: Please start using the new pretext/pretext script!")
print("Press any key. Again.")
input() # to annoy/cripple
subprocess.call(cmd) # to please