Move antlr version choice out of setup.py

Purpose:
Restore vanilla setup.py so it doesn't clash with automated updates

Change:
Moved antlr version choice logic to compile.py, the first place antlr is loaded
symlink manipulation based on __file__ rather than cwd for dependability

Change-Id: I790e871a40a624da1ca4c60c5f7e73c31e96a18b
This commit is contained in:
Eric K 2015-12-03 19:54:22 -08:00
parent 2759d2c4ee
commit 3a56980c3f
2 changed files with 15 additions and 15 deletions

View File

@ -22,18 +22,31 @@ import uuid
import six import six
from six.moves import range from six.moves import range
import antlr3
from oslo_log import log as logging from oslo_log import log as logging
from congress.datalog import analysis from congress.datalog import analysis
from congress.datalog.builtin import congressbuiltin from congress.datalog.builtin import congressbuiltin
# set up appropriate antlr symlinks and import
import os
_congressDir = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if os.path.islink(_congressDir + "/antlr3"):
os.remove(_congressDir + "/antlr3") # remove existing symlink
if six.PY2: if six.PY2:
os.symlink(_congressDir +
"/thirdparty/antlr3-antlr-3.5/runtime/Python/antlr3/",
_congressDir + "/antlr3")
from congress.datalog.Python2 import CongressLexer from congress.datalog.Python2 import CongressLexer
from congress.datalog.Python2 import CongressParser from congress.datalog.Python2 import CongressParser
else: else:
os.symlink(_congressDir +
"/thirdparty/antlr3-antlr-3.5/runtime/Python3/antlr3/",
_congressDir + "/antlr3")
from congress.datalog.Python3 import CongressLexer from congress.datalog.Python3 import CongressLexer
from congress.datalog.Python3 import CongressParser from congress.datalog.Python3 import CongressParser
import antlr3
from congress.datalog import utility from congress.datalog import utility
from congress import exception from congress import exception
from congress import utils from congress import utils

View File

@ -24,19 +24,6 @@ try:
except ImportError: except ImportError:
pass pass
import os
import six
# Remove existing symlink
if os.path.islink("antlr3"):
os.remove("antlr3")
# Add appropriate symlink
if six.PY2:
os.symlink("thirdparty/antlr3-antlr-3.5/runtime/Python/antlr3/", "antlr3")
else:
os.symlink("thirdparty/antlr3-antlr-3.5/runtime/Python3/antlr3/", "antlr3")
setuptools.setup( setuptools.setup(
setup_requires=['pbr>=1.8'], setup_requires=['pbr>=1.8'],
pbr=True) pbr=True)