-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathINSTALL
164 lines (122 loc) · 5.32 KB
/
INSTALL
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Demystify Installation Requirements
This file describes how to setup your Linux environment in order to build
and run Demystify under Python3. The 7 things that need to be installed are:
Java 1.6 or later
Python 3.2
ANTLR 3.5
antlr3 script (available in this repo in antlr3/)
python-progressbar 3.3
ANTLR Python3 runtime
The order isn't necessarily fixed but some things are dependent on others.
I ran through this list on a debian squeeze machine and recorded the commands
I used to install the components.
1) Java 1.6.0 runtime (or later)
Required to run ANTLR
Install using your package manager, eg:
$ sudo apt-get install java-common
I suspect this one is not necessary:
$ sudo apt-get install openjdk-8-jdk
2) Python 3.2 or later (not Python 3.1!)
Required to run demystify
Install using your package manager.
$ sudo apt-get install python3
(Since it's at least 2017, the default is at least 3.5.
Don't install 3.2 in that case.)
3) jpackage-utils 1.7.5 (or later)
This used to be necessary for the antlr3 script, but I modified it because
it was too much of headache to get this thing working, for a commandline
that hardly ever changes.
4) ANTLR 3.5
Required to generate the DemystifyParser
You will need a jar file from the ANTLR website. The jar files with "complete"
in the name contain everything you need. Put it in a location where jpackage
will find it, such as /usr/share/java.
antlr-3.5.2-complete.jar
Available at http://www.antlr3.org/download/
It might have been updated, eg.
antlr-3.5.2-complete.jar
See https://github.com/antlr/antlr3 for the updated link.
Installation:
$ wget www.antlr3.org/download/antlr-3.5.2-complete.jar
$ sudo mv antlr-3.5.2-complete.jar /usr/share/java
5) antlr3 script (from this repo, in antlr3/)
Note that if any of the filenames in (4) are different, you'll need to
edit the antlr3 script to indicate that.
$ sudo cp antlr3/antlr3 /usr/bin/antlr3
$ sudo chown root:root /usr/bin/antlr3
You can, instead of installing the antlr3 script in /usr/bin, copy it or put
a symlink to it in $HOME/bin, where it will work just as well (if $HOME/bin
is in your PATH).
======
At this point you should be able to run "antlr3" on the command line and get:
ANTLR Parser Generator Version 3.5.2
usage: java org.antlr.Tool [args] file.g [file2.g file3.g ...]
If you don't, there was an issue installing something earlier:
Check that java is installed properly and can run as "java".
Check that the antlr3 script is pointed at the right jar file,
and that you have read permissions on it.
======
6) python-progressbar2 (currently 3.3)
$ sudo apt-get install python3-pip
$ pip3 install --user progressbar2
If you'd rather install from source, the project is here:
http://github.com/WoLpH/python-progressbar
You can probably set it up by downloading from Github and running
$ sudo python3 setup.py install
It works when you can run:
$ python3
>>> import progressbar
>>>
(i.e. with no errors)
7) ANTLR 3 Python3 runtime
This can be acquired either through the antlr.org website or through github.
a) From the website:
Download http://www.antlr.org/download/antlr-3.5.tar.gz and unpack it.
The Python3 runtime is in the runtime/Python3 directory, and can be installed
much like any other Python3 library.
$ wget http://www.antlr3.org/download/antlr-3.5.tar.gz
$ tar xf antlr-3.5.tar.gz
$ cd antlr3-antlr-3.5/runtime/Python3
$ sudo python3 setup.py install
b) From github (this may be more up-to-date):
Download or check out the github repo http://github.com/antlr/antlr3. Then,
from wherever you put the repo:
$ cd antlr3/runtime/Python3
$ sudo python3 setup.py install
Installing on debian squeeze:
$ wget http://github.com/antlr/antlr3/tarball/master -O antlr3.tgz
$ tar xf antlr3.tgz
$ cd antlr-antlr3-8312471/runtime/Python3/
$ sudo python3 setup.py install
Regardless of whether you did (a) or (b), it works when you can run:
$ python3
>>> import antlr3
>>>
(i.e. with no errors)
Installing this in this way requires setuptools. Some distros may
already have it as part of python. If running:
$ sudo python3 setup.py install
caused complaints about something in setuptools, you need setuptools.
Some distros might be able to just install it:
$ sudo apt-get install python3-setuptools
And then try again:
$ sudo python3 setup.py install
If that still doesn't work, remove distribute, setuptools, and easy_install
from your system: https://pypi.python.org/pypi/setuptools/0.9.8#uninstalling
and download https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
and run it:
$ sudo python3 ez_setup.py
======
At this point, you should be done installing all of Demystify's dependencies.
To see if it works, change into the grammar directory and run:
$ antlr3 Demystify.g
If it works, you will get a bunch of warning(138)s that I haven't figured out
how to silence, then it will exit silently (this takes some time). If you ls
afterwards, you should see a lot of Demystify*.py and *.tokens files that
weren't there before.
Still with me? Go one directory level up and run:
$ python3 demystify.py test
It should say "OK" several times as it runs each of the provided unit tests.
If so, hooray! Demystify is working on your machine, as evidenced by the
correctly parsing unit tests.
And that's all you need!