Go to file
Oliver Smith 934caf1a81 Drop python2 support (again)
Re-apply reverted commit Iabda95073faa2191fd117e9637e0858c589e9d9e
("Drop python2 support"), but with additional changes to make the
scripts actually work with python3 and to make it build without python2.

I have verified, that the contrib/jenkins.sh scripts of all Osmocom
repositories (with their python3 patches on top) are working with this
patch and that all Osmocom repositories with the python3 patches build
in OBS (tested in own namespace).

All related patches for changing from python2 to 3 in other repositories
must be merged shortly after this one, as soon as the build slaves were
(automatically) updated to have the new osmo-python-tests installed:

New fixes:
* osmopy/obscvty.py: verify: fix compare
  Comparing maps in python3 does not work the same as in python2. Convert
  them to lists first, so the compare works as intended again.
  Fix error:
	  File "/home/user/code/osmo-dev/src/osmo-python-tests/scripts/osmotestvty.py", line 57, in test_history
	    assert(self.vty.w_verify(test_str, [t1]))
* osmopy/obscvty.py: use enc/dec with send/recv
  Fix error:
		self.socket.send("%s\r" % request)
	TypeError: a bytes-like object is required, not 'str'
* scripts/osmotestconfig.py: use encode() before writing to file
  Fix error:
	File "/home/user/code/osmo-dev/src/osmo-python-tests/scripts/osmotestconfig.py", line 91, in copy_config
	File "/usr/lib/python3.5/tempfile.py", line 622, in func_wrapper
		return func(*args, **kwargs)
	TypeError: a bytes-like object is required, not 'str'
* debian/control: add --buildsystem=pybuild. Otherwise "--with python3"
  is ignored and the build fails if python2 is not installed, with:
  	Can't exec "pyversions": No such file or directory at /usr/[...]/python_distutils.pm line 120.

Related: OS#2819
Change-Id: I3ffc3519bf6c22536a49dad7a966188ddad351a7
2019-12-11 12:28:40 +01:00
contrib Drop python2 support (again) 2019-12-11 12:28:40 +01:00
debian Drop python2 support (again) 2019-12-11 12:28:40 +01:00
doc/examples ctrl2cgi: update default parameters in config 2019-01-07 17:04:10 +01:00
osmopy Drop python2 support (again) 2019-12-11 12:28:40 +01:00
scripts Drop python2 support (again) 2019-12-11 12:28:40 +01:00
tests Drop python2 support (again) 2019-12-11 12:28:40 +01:00
.gitignore Ignore compilation byproducts 2017-12-20 16:05:49 +00:00
.gitreview Add git-review config 2017-11-23 14:46:07 +01:00
README tweak README 2019-07-08 15:19:19 +02:00
setup.py Drop python2 support (again) 2019-12-11 12:28:40 +01:00



	sudo python setup.py install
	sudo python3 setup.py install

If you prefer to have it cleanly removable, install checkinstall and run

	sudo checkinstall python setup.py install

Alternatively, just run

	pip install --user -e ./
	pip3 install --user -e ./

depending on your python version.

There are currently following scripts in this package:
osmotestconfig.py - test that apps start/write with example configs
soap.py - implementation of SOAP <-> Ctrl proxy implemented on top of Twisted (deprecated, unmaintained)
ctrl2cgi.py - implementation of CGI <-> Ctrl proxy implemented on top of Twisted (deprecated, unmaintained)
osmo_trap2cgi.py - implementation of CGI <-> Ctrl proxy implemented on top of asyncio and aiohttp
osmo_rate_ctr2csv.py - rate counter dumper on top of osmo_ipa
osmo_interact_vty.py - pipe stdin/stdout to a VTY session
osmo_interact_ctrl.py - pipe stdin/stdout to a CTRL port
osmo_verify_transcript_vty.py - VTY testing by VTY session screen dumps
osmo_verify_transcript_ctrl.py - CTRL testing by CTRL session script files
twisted_ipa.py - implementation of IPA and Ctrl protocols on top of Twisted framework
osmodumpdoc.py - dump documentation, superseded by osmo_interact_vty.py -X
osmotestvty.py - test vty operations, superseded by osmo_verify_transcript_vty.py

Some of these scripts import a project-specific osmoappdesc.py,
which provides information about the available apps, configs, vty ports, etc.
and is provided by other source trees (like osmo-bsc.git, osmo-msc.git, ...)

Run the scripts with osmoappdesc.py in the current directory (preferred)
or with -p <the directory containing osmoappdesc.py>.
Remember that osmoappdesc.py may contain relative paths.

After install osmodumpdoc for openbsc's apps can be run by:
cd <your_source_dir>/openbsc/openbsc && osmodumpdoc.py

osmopy/osmoutil.py - code that's shared between the scripts
osmopy/osmo_ipa.py - generic implementation of IPA and Ctrl protocols in python
osmopy/trap_helper.py - generic Trap class and related helpers used by soap.py and ctrl2cgi.py
osmopy/osmo_interact/{vty,ctrl}.py - general interactions with VTY and CTRL ports
osmopy/obscvty.py - connect to a vty, superseded by osmo_interact/vty

obscvty.py may be of general use. osmoutil.py probably isn't.