Commit ab4a1e35 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Always use mono on Linux to call asn1scc

parent ecf2ef10
......@@ -60,14 +60,25 @@ def parse_asn1(*files, **options):
flags = options.get('flags', [ASN1.AstOnly])
assert isinstance(ast_version, ASN1)
assert isinstance(flags, list)
if os.name == 'posix' and hasattr(sys, 'frozen'):
#if os.name == 'posix' and hasattr(sys, 'frozen'):
# Frozen Linux binaries are expected to use the frozen ASN.1 compiler
asn1exe = 'asn1scc'
else:
asn1exe = 'asn1.exe'
path_to_asn1scc = spawn.find_executable(asn1exe)
# No: there are issues with freezing the .NET applications - discard
# asn1exe = 'asn1scc'
#else:
# asn1exe = 'asn1.exe'
path_to_asn1scc = spawn.find_executable('asn1.exe')
if not path_to_asn1scc:
raise TypeError('ASN.1 Compiler not found in path')
if os.name == 'posix':
path_to_mono = spawn.find_executable('mono')
if not path_to_mono:
raise TypeErorr('"mono" not found in path. Please install it.')
binary = path_to_mono
arg0 = path_to_asn1scc
else:
binary = path_to_asn1scc
arg0 = ''
asn1scc_root = os.path.abspath(os.path.dirname(path_to_asn1scc))
# Create a temporary directory to store dataview.py and import it
tempdir = tempfile.mkdtemp()
......@@ -81,12 +92,12 @@ def parse_asn1(*files, **options):
stg = asn1scc_root + os.sep + 'python.stg'
args = ['-customStgAstVerion', str(ast_version.value),
args = [arg0, '-customStgAstVerion', str(ast_version.value),
'-customStg', stg + ':' + filepath] + list(*files)
asn1scc = QProcess()
LOG.debug(os.getcwd())
LOG.debug(path_to_asn1scc + ' ' + ' '.join(args))
asn1scc.start(path_to_asn1scc, args)
LOG.debug(binary + ' ' + ' '.join(args))
asn1scc.start(binary, args)
if not asn1scc.waitForStarted():
raise TypeError('Could not start ASN.1 Compiler')
if not asn1scc.waitForFinished():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment