Skip to content

Commit 44b08fc

Browse files
committed
Improvements in Python support and installation of Python and includes
1 parent e88bdbe commit 44b08fc

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

lib/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ install(
2828
TARGETS tlspool_static
2929
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
3030
)
31+
32+
add_subdirectory(python)

lib/python/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# add_custom_target?
2+
# add_custom_command(TARGET libtlspool-python
3+
# POST_BUILD
4+
# COMMAND CFLAGS=I${CMAKE_SOURCE_DIR}/include python setup.py build)
5+
#
6+
# add_dependencies
7+
8+
# install(CODE "execute_process COMMAND CFLAGS=-I${CMAKE_SOURCE_DIR}/include python setup.py install")
9+
# install(CODE "execute_process(COMMAND CFLAGS=-I${CMAKE_SOURCE_DIR}/include python setup.py install)")
10+
install(CODE "execute_process(COMMAND python setup.py install WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
11+
12+
install(PROGRAMS webdemo.py
13+
DESTINATION /usr/local/bin)

lib/python/webdemo.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@
66
sys.path.append ('.')
77
import tlspool
88

9-
if len (sys.argv) == 2:
10-
tlspool.open_poolhandle (sys.argv [1])
9+
if len (sys.argv) >= 2:
10+
website = sys.argv [1]
11+
else:
12+
website = 'nlnet.nl'
13+
14+
if len (sys.argv) >= 3:
15+
tlspool.open_poolhandle (sys.argv [2])
1116

1217
sox = socket.socket (socket.AF_INET6, socket.SOCK_STREAM)
13-
sox.connect ( ('www.arpa2.net', 443) )
18+
sox.connect ( (website, 443) )
1419

1520
cli2srv = ( tlspool.PIOF_STARTTLS_LOCALROLE_CLIENT |
1621
tlspool.PIOF_STARTTLS_REMOTEROLE_SERVER )
1722
cnx = tlspool.Connection (sox, service='http', flags=cli2srv)
1823

1924
cnx.tlsdata.localid='testcli@tlspool.arpa2.lab'
20-
cnx.tlsdata.remoteid='www.arpa2.net'
25+
cnx.tlsdata.remoteid=website
2126

2227
web = cnx.starttls ()
2328

24-
web.send ('GET / HTTP/1.0\r\nHost: www.arpa2.net\r\n\r\n')
29+
web.send ('GET / HTTP/1.0\r\nHost: ' + website + '\r\n\r\n')
2530

2631
dta = web.recv (4096)
2732
while dta != '':

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,9 @@ install(
5252
TARGETS tlspool
5353
DESTINATION ${CMAKE_INSTALL_SBINDIR}
5454
)
55+
56+
install(
57+
DIRECTORY ${CMAKE_SOURCE_DIR}/include/tlspool/
58+
DESTINATION /usr/include/tlspool
59+
)
60+

0 commit comments

Comments
 (0)