"""CASA Python Module
This is a standard python module that provides CASA tools and tasks
without regular CASA's bespoke CLI.
"""
import os
import re
import sys
import shutil
import platform
import subprocess
from subprocess import call as Proc
import glob
from setuptools import setup, Extension
from distutils.command.build import build
from setuptools.command.build_ext import build_ext
from urllib import request
from shutil import copyfileobj
from distutils.dir_util import copy_tree
casacpp_user_options = [
("with-casacpp=", None, "location where casacpp is installed")
]
mod_closure = False
class XmlCMakeExtension(Extension):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
class XmlCMakeBuild(build):
user_options = build.user_options + casacpp_user_options
def initialize_options(self):
super().initialize_options()
self.with_casacpp = None
def finalize_options(self):
super().finalize_options()
def run(self):
super().run()
class XmlCMakeBuildExt(build_ext):
user_options = build_ext.user_options + casacpp_user_options
def initialize_options(self):
super().initialize_options()
self.with_casacpp = None
def finalize_options(self):
super().finalize_options()
self.set_undefined_options("build", ("with_casacpp", "with_casacpp"))
def run(self):
try:
out = subprocess.check_output(['cmake', '--version'])
except OSError:
raise RuntimeError("CMake must be installed to build the following extensions: "
+ ", ".join(e.name for e in self.extensions))
for ext in self.extensions:
self.build_extension(ext)
def _xml_jar_fetch(self,xml_jar_path, xml_jar_url ):