removed all print() calls from network.py

Updated CHANGELOG.md. We (another word for 'me') can push after moving
naxalnet.service out of service/. I am told the unit file is having a
rather dull time coping with per lonely life.
This commit is contained in:
Pranav Jerry 2021-12-01 21:27:27 +05:30
parent fc1f3d4216
commit 888fdf3856
No known key found for this signature in database
GPG Key ID: F1DCDC4FED0A0C5B
4 changed files with 27 additions and 34 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## [Unreleased][] - 2021-12-01
- Optimised auto gateway mode selection (#25)
## [v0.5.1][] - 2021-10-22
- Fixed stopping at boot when GNOME starts location service (#21)

View File

@ -2,41 +2,37 @@
Everyone can [hack][] naxalnet. See below for how to hack.
## Questions, answers and hate speech
## Questions and answers
Join the XMPP channel <xmpp:naxalnet@chat.disroot.org> to talk about
anything related to this program or about mesh networks in general.
Redirect your hate messages to `/dev/null`
## Reporting issues and suggesting ideas
To report a bug or suggest an idea, create a new issue at
<https://git.disroot.org/pranav/naxalnet/issues>
While reporting a bug, you need to add the debug messages too. Run
`journalctl -fu naxalnet` on a terminal emulator (this could take some
time). Now on another one, type `sudo systemctl start naxalnet.service` or
whatever caused the error. Now copy the error messages and paste it in the
issue body along with the description.
While reporting a bug, you can add the debug messages to provide more
data. Run `journalctl -fu naxalnet` on a terminal emulator (this could
take some time on some machines). Now on another one, type `sudo systemctl start naxalnet.service` or whatever caused the error. Now copy the error
messages and paste it in the issue body along with the description.
## Improving documentation
The README and HACKING.md needs to be more beginner friendly.
See #20.
The README and HACKING.md needs to be more beginner friendly. See #20.
## Contribute code
To push to this repo, you need your username to be in the
contributors list. Add your username to issue #8 to add you
as a contributor. Before each commit, update the CHANGELOG.md
and `__version__` in `naxalnet/__init__.py`
To push to this repo, you need your username to be in the contributors
list. Add your username to issue #8 to add you as a contributor. Before
each commit, update the CHANGELOG.md and `__version__` in
`naxalnet/__init__.py`
## Packaging
Currently this program is only packaged for Arch Linux.
naxalnet needs packages in GNU+Linux+systemd
distributions such as Debian, Fedora, openSUSE,
and nixos. If you know/like to package it in your distro,
post a message to issue #6.
Currently this program is only packaged for Arch Linux. naxalnet needs
packages in GNU+Linux+systemd distributions such as Debian, Fedora,
openSUSE, and nixos. If you know/like to package it in your distro, post a
message to issue #6.
[hack]: https://catb.org/jargon/html/H/hack.html

View File

@ -42,4 +42,4 @@ given below.
#
# In case you forgot to change the version, skip the number
# and put the next number in the next commit.
__version__ = "0.5.1a0.dev7"
__version__ = "0.5.1a0.dev8"

View File

@ -122,9 +122,6 @@ class NetworkD:
self.remove_config(i.name)
# TODO: remove all calls to print() before merging to master
class NetworkLoop(NetworkD):
"""Used to wait until a condition is met
@ -136,7 +133,6 @@ class NetworkLoop(NetworkD):
"""
def __init__(self, *args, **kwargs):
print("NetworkLoop init")
# first, initialise the parent object
super().__init__(*args, **kwargs)
self.waitfor = None
@ -145,9 +141,6 @@ class NetworkLoop(NetworkD):
def start_loop(self):
"""start the dasbus loop"""
print("start loop")
print("waitfor", self.waitfor)
print("waitfor func", self.wait_function)
self.proxy.PropertiesChanged.connect(self.on_properties_changed)
self.loop.run()
@ -157,38 +150,38 @@ class NetworkLoop(NetworkD):
network interface is shown routable by networkd. Does not wait
for timeout if timeout==0
"""
print("wait until routable")
self.setup_timeout(timeout)
self.wait_for_change("AddressState", self.on_addressstate_change)
return self.is_routable()
def wait_for_change(self, name, function):
"""used by the public functions"""
print("wait for change")
"""
Wait until the given property is changed and stop. If setup_timeout()
is called before calling this function, the loop stops after the timeout
or after the property is changed, whichever occurs first.
"""
self.waitfor = name
self.wait_function = function
self.start_loop()
def on_addressstate_change(self):
"""quit the loop if the network is routable"""
print("on addrstate change")
if self.is_routable():
self.loop.quit()
def on_properties_changed(self, bus_interface, data, blah):
"""give this function some documentation"""
print("on properties changed")
"""called by dasbus everytime the configured property is changed"""
if self.waitfor in data:
return self.wait_function()
# Just to shut up pylint
return None
def setup_timeout(self, timeout):
"""setup a timeout"""
print("setup timeout")
if timeout != 0:
GLib.timeout_add(timeout, self.on_timeout)
def on_timeout(self):
"""called by dasbus when a timeout occurs"""
print("on timeout")
self.loop.quit()