mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2025-03-11 10:29:18 +05:30
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:
parent
fc1f3d4216
commit
888fdf3856
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [Unreleased][] - 2021-12-01
|
||||||
|
|
||||||
|
- Optimised auto gateway mode selection (#25)
|
||||||
|
|
||||||
## [v0.5.1][] - 2021-10-22
|
## [v0.5.1][] - 2021-10-22
|
||||||
|
|
||||||
- Fixed stopping at boot when GNOME starts location service (#21)
|
- Fixed stopping at boot when GNOME starts location service (#21)
|
||||||
|
32
HACKING.md
32
HACKING.md
@ -2,41 +2,37 @@
|
|||||||
|
|
||||||
Everyone can [hack][] naxalnet. See below for how to hack.
|
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
|
Join the XMPP channel <xmpp:naxalnet@chat.disroot.org> to talk about
|
||||||
anything related to this program or about mesh networks in general.
|
anything related to this program or about mesh networks in general.
|
||||||
Redirect your hate messages to `/dev/null`
|
|
||||||
|
|
||||||
## Reporting issues and suggesting ideas
|
## Reporting issues and suggesting ideas
|
||||||
|
|
||||||
To report a bug or suggest an idea, create a new issue at
|
To report a bug or suggest an idea, create a new issue at
|
||||||
<https://git.disroot.org/pranav/naxalnet/issues>
|
<https://git.disroot.org/pranav/naxalnet/issues>
|
||||||
|
|
||||||
While reporting a bug, you need to add the debug messages too. Run
|
While reporting a bug, you can add the debug messages to provide more
|
||||||
`journalctl -fu naxalnet` on a terminal emulator (this could take some
|
data. Run `journalctl -fu naxalnet` on a terminal emulator (this could
|
||||||
time). Now on another one, type `sudo systemctl start naxalnet.service` or
|
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
|
||||||
whatever caused the error. Now copy the error messages and paste it in the
|
messages and paste it in the issue body along with the description.
|
||||||
issue body along with the description.
|
|
||||||
|
|
||||||
## Improving documentation
|
## Improving documentation
|
||||||
|
|
||||||
The README and HACKING.md needs to be more beginner friendly.
|
The README and HACKING.md needs to be more beginner friendly. See #20.
|
||||||
See #20.
|
|
||||||
|
|
||||||
## Contribute code
|
## Contribute code
|
||||||
|
|
||||||
To push to this repo, you need your username to be in the
|
To push to this repo, you need your username to be in the contributors
|
||||||
contributors list. Add your username to issue #8 to add you
|
list. Add your username to issue #8 to add you as a contributor. Before
|
||||||
as a contributor. Before each commit, update the CHANGELOG.md
|
each commit, update the CHANGELOG.md and `__version__` in
|
||||||
and `__version__` in `naxalnet/__init__.py`
|
`naxalnet/__init__.py`
|
||||||
|
|
||||||
## Packaging
|
## Packaging
|
||||||
|
|
||||||
Currently this program is only packaged for Arch Linux.
|
Currently this program is only packaged for Arch Linux. naxalnet needs
|
||||||
naxalnet needs packages in GNU+Linux+systemd
|
packages in GNU+Linux+systemd distributions such as Debian, Fedora,
|
||||||
distributions such as Debian, Fedora, openSUSE,
|
openSUSE, and nixos. If you know/like to package it in your distro, post a
|
||||||
and nixos. If you know/like to package it in your distro,
|
message to issue #6.
|
||||||
post a message to issue #6.
|
|
||||||
|
|
||||||
[hack]: https://catb.org/jargon/html/H/hack.html
|
[hack]: https://catb.org/jargon/html/H/hack.html
|
||||||
|
@ -42,4 +42,4 @@ given below.
|
|||||||
#
|
#
|
||||||
# In case you forgot to change the version, skip the number
|
# In case you forgot to change the version, skip the number
|
||||||
# and put the next number in the next commit.
|
# and put the next number in the next commit.
|
||||||
__version__ = "0.5.1a0.dev7"
|
__version__ = "0.5.1a0.dev8"
|
||||||
|
@ -122,9 +122,6 @@ class NetworkD:
|
|||||||
self.remove_config(i.name)
|
self.remove_config(i.name)
|
||||||
|
|
||||||
|
|
||||||
# TODO: remove all calls to print() before merging to master
|
|
||||||
|
|
||||||
|
|
||||||
class NetworkLoop(NetworkD):
|
class NetworkLoop(NetworkD):
|
||||||
"""Used to wait until a condition is met
|
"""Used to wait until a condition is met
|
||||||
|
|
||||||
@ -136,7 +133,6 @@ class NetworkLoop(NetworkD):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
print("NetworkLoop init")
|
|
||||||
# first, initialise the parent object
|
# first, initialise the parent object
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.waitfor = None
|
self.waitfor = None
|
||||||
@ -145,9 +141,6 @@ class NetworkLoop(NetworkD):
|
|||||||
|
|
||||||
def start_loop(self):
|
def start_loop(self):
|
||||||
"""start the dasbus loop"""
|
"""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.proxy.PropertiesChanged.connect(self.on_properties_changed)
|
||||||
self.loop.run()
|
self.loop.run()
|
||||||
|
|
||||||
@ -157,38 +150,38 @@ class NetworkLoop(NetworkD):
|
|||||||
network interface is shown routable by networkd. Does not wait
|
network interface is shown routable by networkd. Does not wait
|
||||||
for timeout if timeout==0
|
for timeout if timeout==0
|
||||||
"""
|
"""
|
||||||
print("wait until routable")
|
|
||||||
self.setup_timeout(timeout)
|
self.setup_timeout(timeout)
|
||||||
self.wait_for_change("AddressState", self.on_addressstate_change)
|
self.wait_for_change("AddressState", self.on_addressstate_change)
|
||||||
|
|
||||||
return self.is_routable()
|
return self.is_routable()
|
||||||
|
|
||||||
def wait_for_change(self, name, function):
|
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.waitfor = name
|
||||||
self.wait_function = function
|
self.wait_function = function
|
||||||
self.start_loop()
|
self.start_loop()
|
||||||
|
|
||||||
def on_addressstate_change(self):
|
def on_addressstate_change(self):
|
||||||
"""quit the loop if the network is routable"""
|
"""quit the loop if the network is routable"""
|
||||||
print("on addrstate change")
|
|
||||||
if self.is_routable():
|
if self.is_routable():
|
||||||
self.loop.quit()
|
self.loop.quit()
|
||||||
|
|
||||||
def on_properties_changed(self, bus_interface, data, blah):
|
def on_properties_changed(self, bus_interface, data, blah):
|
||||||
"""give this function some documentation"""
|
"""called by dasbus everytime the configured property is changed"""
|
||||||
print("on properties changed")
|
|
||||||
if self.waitfor in data:
|
if self.waitfor in data:
|
||||||
return self.wait_function()
|
return self.wait_function()
|
||||||
|
# Just to shut up pylint
|
||||||
|
return None
|
||||||
|
|
||||||
def setup_timeout(self, timeout):
|
def setup_timeout(self, timeout):
|
||||||
"""setup a timeout"""
|
"""setup a timeout"""
|
||||||
print("setup timeout")
|
|
||||||
if timeout != 0:
|
if timeout != 0:
|
||||||
GLib.timeout_add(timeout, self.on_timeout)
|
GLib.timeout_add(timeout, self.on_timeout)
|
||||||
|
|
||||||
def on_timeout(self):
|
def on_timeout(self):
|
||||||
"""called by dasbus when a timeout occurs"""
|
"""called by dasbus when a timeout occurs"""
|
||||||
print("on timeout")
|
|
||||||
self.loop.quit()
|
self.loop.quit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user