Skip to content

Commit 529f896

Browse files
author
Marco Gario
authored
Define main function for pysmt as module (pysmt#573)
1 parent 749e5e3 commit 529f896

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

pysmt/__main__.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# This file is part of pySMT.
3+
#
4+
# Copyright 2014 Andrea Micheli and Marco Gario
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
def error():
20+
print("Invalid option try 'install' or 'shell'")
21+
exit(-1)
22+
23+
if __name__ == "__main__":
24+
import sys
25+
26+
cmd = error
27+
if len(sys.argv) >= 2:
28+
sys.argv = sys.argv[1:]
29+
if sys.argv[0] == 'install':
30+
import pysmt.cmd.install
31+
cmd = pysmt.cmd.install.main
32+
elif sys.argv[0] == 'shell':
33+
import pysmt.cmd.shell
34+
cmd = pysmt.cmd.shell.main
35+
cmd()

pysmt/cmd/install.py

-4
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,3 @@ def main():
259259
mirror_link=mirror_url,
260260
**i.extra_params)
261261
installer.install(force_redo=options.force_redo)
262-
263-
264-
if __name__ == "__main__":
265-
main()

setup.py

-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
install_requires=["six"],
6363
entry_points={
6464
'console_scripts': [
65-
'pysmt = pysmt.cmd.shell:main',
66-
'pysmt-shell = pysmt.cmd.shell:main_interactive',
6765
'pysmt-install = pysmt.cmd.install:main',
6866
],
6967
},

0 commit comments

Comments
 (0)