"""
Create source tarball, create rpm from it together with spec file.
-Create a source tarball that is compatbile with standard build pipelines. Then
+Create a source tarball that is compatible with standard build pipelines. Then
run rpmbuild on it to create an installable rpm.
.. codeauthor:: Intra2net AG <info@intra2net.com>
# dir to contain tarball
DIST_DIR = join(BASE_DIR, 'dist')
-# files and dirs to add to tarball; keep in sync with %files secion in spec
+# files and dirs to add to tarball; keep in sync with %files section in spec
DATA = (
'COPYING.GPL', 'Linking-Exception.txt', 'README', 'CONTRIBUTING',
- 'setup.py', 'src', 'test', 'doc/about_docu.rst', 'doc/conf.py'
+ 'setup.py', 'src', 'test', 'doc/about_docu.rst', 'doc/conf.py',
+ 'doc/cnfvar-api-ascii-art.rst'
)
# dir where rpmbuild expects its tarballs
name, version, tarball_file = get_spec_info()
tarball_path = join(DIST_DIR, tarball_file)
print(f'Creating {tarball_path}')
- dirname = f'{name}-{version}'
+ dir_name = f'{name}-{version}'
with tarfile.open(tarball_path, 'w:gz') as tarball:
for entry in DATA:
- tarball.add(entry, join(dirname, entry), filter=tar_add_filter)
+ tarball.add(entry, join(dir_name, entry), filter=tar_add_filter)
return tarball_path
if __name__ == '__main__':
sys.exit(main())
-
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
- )
+ )
"""
Read cnf data from data bytes.
- :param bytes data: raw data
+ :param data: raw data
+ :type data: str or bytes
:return: the parsed cnf data
:rtype: {str, {str, str or int}}
"""
usage()
return -1
+
if __name__ == "__main__":
sys.exit(main(sys.argv))
"arnied_dial_hangup", "arnied_dial_doc", "arnied_dial_permanent", "dialout", "get_wan_address", "DIALOUT_MODE_PERMANENT", "DIALOUT_MODE_MANUAL", "DIALOUT_MODE_DEFAULT", "DIALOUT_MODE_BY_NAME"
)
-TELL_CONND_BIN = "/usr/intranator/bin/tell-connd"
-
DIALOUT_MODE_PERMANENT = 0
DIALOUT_MODE_MANUAL = 1
DIALOUT_MODE_DEFAULT = DIALOUT_MODE_PERMANENT
NEEDLE_OFFLINE = re.compile("connection map:\nend of connection map")
DIALTOOLS_HANGUP_BIN = "/usr/intranator/bin/hangup"
+
+#: binary for manual dialing (dial on command)
DIALTOOLS_DOC_BIN = "/usr/intranator/bin/doc"
DIALTOOLS_TIMEOUT = 10 # s
+
+#: client binary for talking to connd
TELL_CONND_BIN = "/usr/intranator/bin/tell-connd"
def arnied_dial_doc(prid="P1", block=False):
"""
- Bring provider up via arnied manual dial.
+ Bring provider up via arnied manual dial (dial on command).
:param prid: Provider id, default *P1*. It is up to the caller to ensure
this is a valid provider id.
.. seealso:: http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
.. seealso:: https://en.wikipedia.org/wiki/ANSI_escape_code
+.. seealso:: :py:mod:`textwrap`
INTERFACE
:yields: `n_head+n_tail` elements from iterable plus the `skip_elem` (or
less if iterable is shorter than this).
- .. seealso:: :py:func:`slice`, :py:func:`itertools.islice`
+ .. seealso:: :py:func:`slice`, :py:func:`itertools.islice`, :py:func:`textwrap.shorten`
+
"""
if n_elems is None:
n_elems = len(iterable)
from src import arnied_wrapper
-class DummyCmdOutputMapping(object):
+class DummyCmdOutputMapping:
"""
Class to replace the :py:function:`arnied_wrapper.run_cmd` function.