#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
# check.sh
# check a python file using pylint and pep8
#!/bin/sh
+# The software in this package is distributed under the GNU General
+# Public License version 2 (with a special exception described below).
+#
+# A copy of GNU General Public License (GPL) is included in this distribution,
+# in the file COPYING.GPL.
+#
+# As a special exception, if other files instantiate templates or use macros
+# or inline functions from this file, or you compile this file and link it
+# with other works to produce a work based on this file, this file
+# does not by itself cause the resulting work to be covered
+# by the GNU General Public License.
+#
+# However the source code for this file must still be made available
+# in accordance with section (3) of the GNU General Public License.
+#
+# This exception does not invalidate any other reasons why a work based
+# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
+
echo create rpm
python3 setup.py bdist_rpm --packager=Intra2net --group=Intra2net --vendor="Intra2net AG"
# run unittest suite using python2 and python3
+# The software in this package is distributed under the GNU General
+# Public License version 2 (with a special exception described below).
+#
+# A copy of GNU General Public License (GPL) is included in this distribution,
+# in the file COPYING.GPL.
+#
+# As a special exception, if other files instantiate templates or use macros
+# or inline functions from this file, or you compile this file and link it
+# with other works to produce a work based on this file, this file
+# does not by itself cause the resulting work to be covered
+# by the GNU General Public License.
+#
+# However the source code for this file must still be made available
+# in accordance with section (3) of the GNU General Public License.
+#
+# This exception does not invalidate any other reasons why a work based
+# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
+
python2 -m unittest discover test && python3 -m unittest discover test
#!/usr/bin/env python
+# The software in this package is distributed under the GNU General
+# Public License version 2 (with a special exception described below).
+#
+# A copy of GNU General Public License (GPL) is included in this distribution,
+# in the file COPYING.GPL.
+#
+# As a special exception, if other files instantiate templates or use macros
+# or inline functions from this file, or you compile this file and link it
+# with other works to produce a work based on this file, this file
+# does not by itself cause the resulting work to be covered
+# by the GNU General Public License.
+#
+# However the source code for this file must still be made available
+# in accordance with section (3) of the GNU General Public License.
+#
+# This exception does not invalidate any other reasons why a work based
+# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
+
from distutils.core import setup
setup(name='pyi2ncommon',
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Interface to arnied
only a stub; should at least contain a set_cnf and get_cnf
-
-.. codeauthor:: Intra2net
"""
def set_cnf(var_name, value):
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
"""
buffers.py: buffers of various shapes, sizes and functionalities
* CircularBuffer
* LogarithmicBuffer: saves only last N items, and after that less and less so
* very few old items are kept
-
-.. codeauthor:: Intra2net
"""
class CircularBuffer:
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Helpers for calling commands, capture their output, return result code
Subprocess library just does not provide all the simplicity we would like
Stay python2 compatible --> no timeouts
-
-.. codeauthor:: Intra2net
"""
from subprocess import Popen, PIPE
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
"""
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Helper functions and classes to deal with files and dirs and stuff
have full mount point info -> remove NOT_REAL_FILESYSTEMS_SPEC
.. todo:: check what can be replaced by module psutil
-
-.. codeauthor:: Intra2net
"""
from __future__ import print_function
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
"""
follow process output, log files and pipes using select and poll
len(my_follower)
Follower(my_file, my_file) # (twice the same)
-
-.. codeauthor:: Intra2net
"""
from __future__ import print_function
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Helper functions with iterators -- functional program is great!
Currently, recipes from python itertools docu (:py:mod:`itertools`) that have
been deemed useful
-
-.. codeauthor:: Intra2net
"""
import itertools as it
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Helpers for logging; featuring:
.. todo:: think about how to allow different levels per handler
.. todo:: do not limit logs by line numbers but by disc size? Warn when at 50%,
75%, 90%, 99% of limit?
-
-.. codeauthor:: Intra2net
"""
import logging
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Iterative reading of log files
like date, time, module name, urgency and message.
.. todo:: auto-detect log line layout
-
-.. codeauthor:: Intra2net
"""
import os
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Helpers for developing quick test scripts
.. todo:: Find out why fs not in REAL_FILESYSTEMS generate warnings so quickly
even if they are still empty
-
-.. codeauthor:: Intra2net
"""
from __future__ import print_function
-#!/usr/bin/env python3
+# The software in this package is distributed under the GNU General
+# Public License version 2 (with a special exception described below).
+#
+# A copy of GNU General Public License (GPL) is included in this distribution,
+# in the file COPYING.GPL.
+#
+# As a special exception, if other files instantiate templates or use macros
+# or inline functions from this file, or you compile this file and link it
+# with other works to produce a work based on this file, this file
+# does not by itself cause the resulting work to be covered
+# by the GNU General Public License.
+#
+# However the source code for this file must still be made available
+# in accordance with section (3) of the GNU General Public License.
+#
+# This exception does not invalidate any other reasons why a work based
+# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Functions for printing colored text using ANSI escape sequences
References:
* http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
* https://en.wikipedia.org/wiki/ANSI_escape_code
-
-.. codeauthor:: Intra2net AG <info@intra2net>
"""
from __future__ import print_function
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
"""
Helpers for type checking and conversion, like isstr(x), is_file_obj(x)
Provides abstraction from difference between PY2 and PY3
-
-.. codeauthor:: Intra2net
"""
from __future__ import print_function
+# The software in this package is distributed under the GNU General
+# Public License version 2 (with a special exception described below).
+#
+# A copy of GNU General Public License (GPL) is included in this distribution,
+# in the file COPYING.GPL.
+#
+# As a special exception, if other files instantiate templates or use macros
+# or inline functions from this file, or you compile this file and link it
+# with other works to produce a work based on this file, this file
+# does not by itself cause the resulting work to be covered
+# by the GNU General Public License.
+#
+# However the source code for this file must still be made available
+# in accordance with section (3) of the GNU General Public License.
+#
+# This exception does not invalidate any other reasons why a work based
+# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
+
""" Streamable version of zipfile
Python's :py:class:`zipfile.ZipFile` can only write to seekable streams
info = zip.create_zipinfo(big_file)
with open(big_file, 'rb') as input_stream:
zip.write_stream(input_stream, info)
-
-.. codeauthor:: Intra2net AG <info@intra2net>
"""
import sys
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
"""
Module name: Summary of this module
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" test_module_name.py: unit tests for module_name
Should be able run from python2 and python3!
For help see :py:mod:`unittest`
-
-.. codeauthor:: Intra2net
"""
from __future__ import print_function
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Test test_helpers.DiscFillChecker by actually writing lots of data to disc
Indulge in the luxury of assuming we have python3 here ;-)
*NOT* a unittest (unittest discover only finds tests in files test_*.py).
-
-.. codeauthor:: Intra2net
"""
from sys import stderr, argv as cmd_line_args
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" buffer_unittest.py: unit tests for buffers.py
Should be able run from python2 and python3!
For help see :py:mod:`unittest`
-
-.. codeauthor:: Intra2net
"""
from __future__ import absolute_import
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" call_helper_unittest.py: unit tests for call_helpers
Should be run from python2 and python3!
-
-.. codeauthor:: Intra2net
"""
from __future__ import absolute_import
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
import unittest
from src import cnfvar
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" file_helper_unittest.py: unit tests for file_helpers
Should be able to run from python2 and python3!
For help see :py:mod:`unittest`
-
-.. codeauthor:: Intra2net
"""
from __future__ import absolute_import
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Unittest for follow.py
.. warn:: DEPRECATED (at least for files see log_read; may still be useful for
pipes/sockets)
-
-.. codeauthor:: Intra2net
"""
from __future__ import absolute_import
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" Unittests for log_read
Creates own thread to write data to a log file
-
-.. codeauthor:: Intra2net
"""
from __future__ import absolute_import
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" test_helper_unittest.py: unit tests for test_helpers
Should be able run from python2 and python3!
For help see :py:mod:`unittest`
-
-.. codeauthor:: Intra2net
"""
# TODO: remove print, use logging instead
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" test_text_helpers.py: unit tests for text_helpers
Should be able run from python2 and python3!
For help see :py:mod:`unittest`
-
-.. codeauthor:: Intra2net
"""
from __future__ import absolute_import
#
# This exception does not invalidate any other reasons why a work based
# on this file might be covered by the GNU General Public License.
+#
+# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
""" type_helper_unittest.py: unit tests for type_helpers
Should be run from python2 and python3!
For help see :py:mod:`unittest`
-
-.. codeauthor:: Intra2net
"""
from __future__ import absolute_import