File Makefile changed (mode: 100644) (index 90f78be..aa9c71b) |
... |
... |
DSO_LDFLAGS=-g -pthread -lm -lrt |
9 |
9 |
DSO_LDFLAGS += $(shell pkg-config --libs $(DEPS)) |
DSO_LDFLAGS += $(shell pkg-config --libs $(DEPS)) |
10 |
10 |
OBJECTS=$(SOURCES:.c=.o) |
OBJECTS=$(SOURCES:.c=.o) |
11 |
11 |
INCLUDES = $(wildcard *.h) |
INCLUDES = $(wildcard *.h) |
|
12 |
|
PYTHON = /usr/bin/env python3 |
12 |
13 |
|
|
13 |
14 |
|
|
14 |
15 |
# Targets |
# Targets |
|
... |
... |
gitversion.h: FORCE |
20 |
21 |
FORCE: |
FORCE: |
21 |
22 |
|
|
22 |
23 |
tox_bootstrap.h: |
tox_bootstrap.h: |
23 |
|
python generate_tox_bootstrap.py |
|
|
24 |
|
$(PYTHON) generate_tox_bootstrap.py |
24 |
25 |
|
|
25 |
26 |
%.o: %.c $(INCLUDES) gitversion.h tox_bootstrap.h |
%.o: %.c $(INCLUDES) gitversion.h tox_bootstrap.h |
26 |
27 |
@echo " CC $@" |
@echo " CC $@" |
File generate_tox_bootstrap.py changed (mode: 100644) (index 0cde94a..3198cd4) |
1 |
|
#!/usr/bin/python |
|
2 |
|
# pip install jinja2 requests |
|
|
1 |
|
#!/usr/bin/python3 |
|
2 |
|
# pip3 install jinja2 requests |
3 |
3 |
|
|
4 |
4 |
import datetime |
import datetime |
5 |
5 |
import jinja2 |
import jinja2 |
|
... |
... |
def toxtoc(value): |
52 |
52 |
Generate 1 line of C code - 16 bytes |
Generate 1 line of C code - 16 bytes |
53 |
53 |
@param value a hex string of length 32 (32 hex chars) |
@param value a hex string of length 32 (32 hex chars) |
54 |
54 |
""" |
""" |
55 |
|
if len(value) <> 32: |
|
|
55 |
|
if len(value) != 32: |
56 |
56 |
raise ValueError('%r is not a 32-char string') |
raise ValueError('%r is not a 32-char string') |
57 |
57 |
|
|
58 |
58 |
rv = "" |
rv = "" |
|
... |
... |
if __name__ == "__main__": |
86 |
86 |
for elem in data['nodes']: |
for elem in data['nodes']: |
87 |
87 |
node = {} |
node = {} |
88 |
88 |
if 'ipv4' not in elem or 'port' not in elem or 'public_key' not in elem: |
if 'ipv4' not in elem or 'port' not in elem or 'public_key' not in elem: |
89 |
|
print "SKIPPING", elem |
|
|
89 |
|
print("SKIPPING", elem) |
90 |
90 |
continue |
continue |
91 |
91 |
|
|
92 |
|
if len(elem['public_key']) <> 64: |
|
93 |
|
print "Bad public key %s, skipping!" % elem['public_key'] |
|
|
92 |
|
if len(elem['public_key']) != 64: |
|
93 |
|
print("Bad public key %s, skipping!" % elem['public_key']) |
94 |
94 |
continue |
continue |
95 |
95 |
|
|
96 |
96 |
node['port'] = int(elem['port']) |
node['port'] = int(elem['port']) |
|
... |
... |
if __name__ == "__main__": |
102 |
102 |
except socket.error: |
except socket.error: |
103 |
103 |
# IPv4 is not numeric, let's try resolving |
# IPv4 is not numeric, let's try resolving |
104 |
104 |
try: |
try: |
105 |
|
print "RESOLVING", elem['ipv4'] |
|
|
105 |
|
print("RESOLVING", elem['ipv4']) |
106 |
106 |
node['ipv4'] = socket.gethostbyname(elem['ipv4']) |
node['ipv4'] = socket.gethostbyname(elem['ipv4']) |
107 |
107 |
except socket.error: |
except socket.error: |
108 |
|
print "Could not resolve ipv4: %s, skipping!" % elem['ipv4'] |
|
|
108 |
|
print("Could not resolve ipv4: %s, skipping!" % elem['ipv4']) |
109 |
109 |
continue |
continue |
110 |
110 |
|
|
111 |
111 |
if 'status_udp' in elem and elem['status_udp']: |
if 'status_udp' in elem and elem['status_udp']: |