Ejemplo n.º 1
0
_no_config_handler = _logging.StreamHandler()
_no_config_handler.setFormatter(_logging.Formatter(_logging.BASIC_FORMAT))
_no_config_handler.addFilter(_NoConfigFilter())
logger = _logging.getLogger(__name__)
logger.addHandler(_no_config_handler)

# BEGIN VERSION CHECK
# Get package version when locally imported from repo or via -e develop install
try:
    import katversion as _katversion
except ImportError:
    import time as _time
    __version__ = "0.0+unknown.{}".format(_time.strftime('%Y%m%d%H%M'))
else:
    __version__ = _katversion.get_version(__path__[0])
# END VERSION CHECK

# -----------------------------------------------------------------------------
# -- Top-level functions passed on to the appropriate format handler
# -----------------------------------------------------------------------------

formats = [H5DataV3, H5DataV2, H5DataV1]


def _file_action(action, filename, *args, **kwargs):
    """Perform action on data file using the appropriate format class.

    Parameters
    ----------
    action : string
Ejemplo n.º 2
0
# BEGIN VERSION CHECK
# Get package version when locally imported from repo or via -e develop install
try:
    import katversion as _katversion
except ImportError:  # pragma: no cover
    import time as _time
    __version__ = "0.0+unknown.{}".format(_time.strftime('%Y%m%d%H%M'))
else:  # pragma: no cover
    __version__ = _katversion.get_version(__path__[0])   # type: ignore
# END VERSION CHECK
Ejemplo n.º 3
0
        gitstring = '{filename}\t[{username}@{hostname}]\t[{origin}]\t' \
                    '[{hashstring}]\t' \
                    '[{branch}]\t{modified_files}'.format(
                        username=username.replace('\n', ''),
                        hostname=hostname.replace('\n', ''),
                        hashstring=output1 or 'file not in Git',
                        branch=output3[0] + ' - ' + output3[1],
                        modified_files=modified_files,
                        filename=file_or_dir,
                        origin=output4)
    except GitInfoError as e:
        gitstring = file_or_dir + ' - ' + str(e)
    return gitstring

if args.katversion:
    new_info = args.file_dir + '\t' + katversion.get_version(args.file_dir)
else:
    new_info = get_new_git_info(args.file_dir)
if args.target:
    try:
        fptr = open(args.target, 'a')
    except IOError:
        sys.exit(-2)
    fptr.write(new_info)
    fptr.close()
elif args.fpgstring:
    print('?meta\t77777_git\trcs\t{}'.format(new_info)),
else:
    if not os.path.exists(args.file_dir):
        print ('ERROR no_such_file: ' + args.file_dir)
        sys.exit(-1)
Ejemplo n.º 4
0
"""
corr2 - control and monitoring for casper-based instruments.
"""

# import the base corr2 modules
import fxcorrelator
import host_fpga
import host
import instrument
import utils
# corr2 requires casperfpga

# BEGIN VERSION CHECK
# Get package version when locally imported from repo or via -e develop install
try:
    import katversion as _katversion
except ImportError:
    import time as _time
    __version__ = "0.0+unknown.{}".format(_time.strftime('%Y%m%d%H%M'))
else:
    __version__ = _katversion.get_version(__path__[0])
# END VERSION CHECK

# end
Ejemplo n.º 5
0
                        'File not in Git. Compiled: {}'.format(
                            time.strftime("%a, %d %b %Y %H:%M:%S %z")),
                        branch=output3[0] + ' - ' + output3[1],
                        modified_files=modified_files,
                        filename=file_or_dir,
                        origin=output4)
    except GitInfoError as e:
        gitstring = '{filename}\tCompiled: {compile_time}\t{err}'.format(
            filename=file_or_dir,
            compile_time=time.strftime("%a, %d %b %Y %H:%M:%S %z"),
            err=str(e))
    return gitstring


if args.katversion:
    new_info = args.file_dir + '\t' + katversion.get_version(args.file_dir)
else:
    new_info = get_new_git_info(args.file_dir)
if args.target:
    try:
        fptr = open(args.target, 'a')
    except IOError:
        sys.exit(-2)
    fptr.write(new_info)
    fptr.close()
elif args.fpgstring:
    print('?meta\t77777_git\trcs\t{}'.format(new_info))
else:
    if not os.path.exists(args.file_dir):
        print(('ERROR no_such_file: ' + args.file_dir))
        sys.exit(-1)
Ejemplo n.º 6
0
#!/usr/bin/env python

from setuptools import setup, find_packages

from katversion import get_version

setup(name="kattui",
      version=get_version(),
      description="Karoo Array Telescope Text User Interface",
      packages=find_packages(),
      scripts=["scripts/kat"],
      url='https://github.com/martinslabber/kattui',
      license="BSD",
      classifiers=["Development Status :: 5 - Production/Stable",
                   "Intended Audience :: Developers",
                   "License :: OSI Approved :: BSD License",
                   "Operating System :: OS Independent",
                   "Programming Language :: Python :: 2",
                   "Topic :: Scientific/Engineering :: Astronomy"],
      platforms=["OS Independent"],
      install_requires=['cmd2',
                        # 'katcp',  # Enabling this here causes problems with
                        # various versions of katcp.
                        ],
      keywords="kat kat7 ska MeerKAT",
      data_files=[('/usr/local/lib/kattui', ['plugins/stop.py']),
                  ('/usr/local/lib/kattui', ['plugins/start.py']), ],
      test_suite="nose.collector")